I wouldn't mess with trying to "dim" the fan, it can be done from the arduino (I've done it and it works fine) but requires extra hardware to be built and speacial coding for proper control since fans want higher frequency pwm than led drivers (you'll probably have to make the circuit yourself otherwise they are kind of pricey pre made) Just switch the fans on and off via the arduino (even for that you will need an arduino compatible relay ($2-3 on ebay) to isolate the fan from the arduino. The fan may be able to run off the same power supply if it has the right voltage and amperage but you should not supply the power thru the arduino board in most cases the fan will pull too much power for the arduino board to handle.
Zachts, The fans are 5V and I plan to power the Arduino with 5V from the same wall wart. Would a 5V relay be a better choice for me than 12V?
Gorgok, I did try multiplying the ms and it seemed to work but I was dealing with ridiculously big numbers. I'm going to try to understand that coding you gave me. I was thrown by ms.=D, now I realize ms. does not equal D, that's a happy face. LOL I still have to work on understanding that code.
Thanks guys!
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(6*60000); // wait for a 6 minutes
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(10*60000); // wait for a 10 minutes
}
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(minutesInMs(6));
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(minutesInMs(10));
}
// Returns minutes in milliseconds
int minutesInMs(int m){
return m*60000; // minutes * 60 seconds * 1000 milliseconds
}
If you opened it in the arduino program it should look pretty straight forward and all be in simple English. If you're seeing gobbledy gook then try downloading and unzipping the file again. might have been corrupted. Should look just like this:What I hope to achieve is to control brightness as well as photoperiod and display it on an LCD.
Back in post 19, the sketch shows up as a bunch of odd characters- IDK what the deal is there. When I first looked at it I thought that's how it's supposed to look.
/*
This is a simple 5v Analog to PWM converter for the Arduino.
Meant to be used with an Arduino Nano or equivalent.
Made by asid61 of reefcentral.com, or MeepNand of nano-reef.com.
This supports up to 6 PWM outputs. Controlled via 10K Ohm Reverse Audio Anti Log Taper Potentiometers
*/
int read1, read2, read3, read4, read5, read6;
void setup()
{
//This is the PWM outputs. Make sure to connect the grounds!
pinMode(3, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
//Attach potentiometer middle pins to these pins.
pinMode(A1, INPUT);
pinMode(A2, INPUT);
pinMode(A3, INPUT);
pinMode(A4, INPUT);
pinMode(A5, INPUT);
pinMode(A6, INPUT);
}
void loop()
{
read1 = analogRead(A1);
read2 = analogRead(A2);
read3 = analogRead(A3);
read4 = analogRead(A4);
read5 = analogRead(A5);
read6 = analogRead(A6);
analogWrite(3, read1/4);
analogWrite(5, read2/4);
analogWrite(6, read3/4);
analogWrite(9, read4/4);
analogWrite(10, read5/4);
analogWrite(11, read6/4);
}
a touch screen will make programing the interface something of a nightmare as a beginner project. LCD with a few buttons will be relatively straight forward once you get the hang of it. follow the example tutorials out there to see how the code for different pieces of hard ware works.I bought a 16x2 LCD, but would the built in controller in this make things easier for me? Could I forgo the button library if I used this display? http://www.ebay.com/itm/2-8-Inch-TF...284?pt=LH_DefaultDomain_2&hash=item23486af45c
Yes, but at some point in the sketch they will be linked and the photoperiod code will over ride the dimming code and shut off the lights. look at using "else" and "if" statements on the arduino home page.Can the dimming control be separated from the photoperiod control as far as writing the sketch is concerned?
You might be better off just writing your own code since all you really need is to dim the leds and display the level (it would be simpler to just display the level of pwm from 0-254 on the display, but not too much extra work to convert that to percent I suppose)I've been at this most of today, I need to let it go for now. I sure wish the button library was included in the sketch window list. I spent, no wasted a lot of time trying to get the button library downloaded. Once I get that sorted out, I'll lift some code from the Typhon sketch and see if that can be made to work. The Typhon dims by percentage which is perfect.
Then, wire the buttons with their pull down or pull up resistors and hook up the LCD. Get some meaningful dimming numbers from the LCD. Does that sound like a logical start?