loading

Aquarium LED driver?

im looking for a schematic that controls 1w leds for my fish tank light? i need the control to be dimmable and hopefully programmable so i can incorporate a sun motion effect and then a moon motion effect! i say hopefully because this will need to be an add on later in the project as id like to have the initial lighting up as quickly as possible! As far as i know so far, the circuit is a basic constant current circuit but  i need a "buck" driver or PWM to enable the dimming by varying the current! so my questions are :-

1. Does anyone know of a simple, reliable and cheap circuit to use?
2. Because of the amount of LED's ill be using im not sure i like the idea of having all the lights in a series configuration because if one fails, thats a lot of lights to test!
3. If i have to use a computer to run the lights id like to be able to make it compatable with the raspberry pi therefore id need a program and mounting software for the pi, so anyone know of one?
4.Right to the power, i dont care what voltage it runs on but id like to only utalize one plug socket if possible, i do have a few power supplies laying about for various things like old laptops and old pc's, so what do i need to power it!

i cant think of any more at the moment but you guys know what im trying to achieve so im sure you know what questions i have missed! as i said though, id like to start simple and work up to sun motion control and timers!

Thanks in advance for any help anyone is offering! 

sort by: active | newest | oldest
How MANY 1W leds are you driving ?
Xmortx114145 (author)  steveastrouk4 years ago
Well im looking to light a 500 litre aquarium which would normally be lit by at least 4 t8 36w aquarium bulbs so in that respect id take a guess at 144 to equal the wattage of the original bulbs but im pretty sure it doesn't quite work like that! but currently its running with one bulb at 36w so lets start with say 72?
Pick your LEDs next....Presumably you want RGB leds ?
Xmortx114145 (author)  steveastrouk4 years ago
well i was looking at 1w stars 2 types one 440-450nm and the other 650-660nm! they were on ebay heres the links,

650-660nm - http://www.ebay.co.uk/itm/5pcs-1W-Red-660nm-power-LED-1watt-for-plant-grow-light-/250944193935?pt=LH_DefaultDomain_0&hash=item3a6d70858f

440-450nm - http://www.ebay.co.uk/itm/5x-1-Watt-1W-350mA-440-450nm-Royal-Blue-Power-LED-on-star-26-lumen-/290842444868?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item43b78f8444
From my understanding, since green doesn't penetrate water well anyway, you can get great results with just
cool white alone,
cool white and blue,
cool white, blue and a few red. (for sunrise portion).


You need to look at the lumens of output, not necessarily watts, as the fluorescent bulbs have a different luminous efficacy per watt than the leds, and since you're introducing colour, eyes detect different wavelengths of light at different intensities so only 'white' can be an easy 'equivalent' measure.

Xmortx114145 (author)  frollard4 years ago
i always thought lumens were a bad way of measuring light in water penetration as plants are not related to lumen output but more PAR output as thats a measure of useable light? as for the colours, tall fast growing aquatic plants generally use more of the red spectrum but this doesn't like to penetrate water and blue lights are for short slow growing plants that sit deeper in the water as blue penetrates water better? i may be wrong but i think thats how it works..... im looking to have a 20% or 25% red lights to 80% or 75% cool white basically! but i chose those particular spectrums of output as i read somewhere that they are the particular spectrums of red and blue respectively that aquatic plants respond too... again i may be wrong!
Right, the exact mix isn't the most important thing - just considering that a mix of red, blue (gives good fluorescence) and cool white. having each on its own controllable channel.

https://www.instructables.com/id/Circuits-for-using-High-Power-LED-s/ has everything you need to know about dimming high power leds with a cheap relatively efficient component (look for the pwm section).
Xmortx114145 (author)  frollard4 years ago
ok well i like the look of the one that involves microcontrollers as it could start out pwm controlled then i could add in the raspberry pi after....only problem is, if i understand, the led's are still all ran in series and also the circuits dont seem very capable of running the number of leds ill be needing unless i break the leds into groups of a few.... unless i missed something.... which for some reason my mind is telling me i am...?
the more the merrier -- run each series strand with a constant current driver - again, if the voltage is 'close' to the requirements (say 35 volts of led in series and 36 volt supply) the efficiency of the current driver is very high -- and they are cheap, just make multiple strands of them, and drive them all from their own pwm pin (or group them on the same pwm pin). Yes, its a bit harder to make a handful of drivers, but then you can control many banks to create that sunrise effect even better.
Xmortx114145 (author)  frollard4 years ago
okay so i have multiple drivers down the length of the tank, each controlling a strip of leds then start by having a simple pwm output to all the driver circuits, then when i want to try the sunrise effect i have each of these drivers connected to a PIC or raspberry pi channel and program in the times for each channel and the pwm speed for each channel.... if this makes sense how iv said it lol??
100% correct.
Tip if you want to use a LOT of leds and fewer cheaper drivers: run the highest voltage you can get through the driver (about 30-36v DC) and put as many leds as the forward drop will allow on each strand. Improves efficiency and reduces the number of drivers needed.
Xmortx114145 (author)  frollard4 years ago
Okay so 1w leds forward vdrop is between 3.3-3.6v i think... So were talking 9 in each string right? Id assume i dont want to go tight up to the 36v limit?
Xmortx114145 (author)  Xmortx1141454 years ago
I lie they are 1w 350ma so its 2.85v each so ill be looking nearer 12 leds per strip meaning id need 6 drivers for the 72 leds?
Each colour is different, use the correct forward voltage from the datasheet. You can experiment to find the forward voltage by measuring the drop while just one is lit up (with the correct current driver).
Xmortx114145 (author)  frollard4 years ago
okay once i have those i build these drivers, all sorted there but firstly how am i going to build the pwm?? and then what parts for the pi am i going to need to get the outputs... i did find a break out board but it only supported 4 channels pwm control which wont be enough?
Xmortx114145 (author)  Xmortx1141454 years ago
http://www.nxp.com/documents/data_sheet/PCA9952_PCA9955.pdf

is this the sort of thing ill need? oooh this is looking complicated to include the pi as its only actually able to output 1 pwm signal lol so i would need that above?? or i should use something else maybe! basically i just thought id use the pi for the easy to use display....
http://arduino.cc/en/Reference/AnalogWrite?from=AnalogWrite.PWM
Xmortx114145 (author)  frollard4 years ago
Correct me if im wrong but although it says the arduino mega can have 11 pwm outputs, it says in the code that one pin would be 'pot' input and another as pwm output, all great but if im going to need say 10 channels then there aren't enough outputs 11/2 effectively as half would be inputs? Or have i missed something? Either way though, thats at least 5 useable outputs which makes it 5 times better than the pi lol
That's only if you need to use those analog pins as inputs also -- you aren't using them as inputs - just the example code takes an analog reading (input) - then sets the pwm pin to the same value as pwm (putput).

Since you aren't reading any pots, you're writing code that calculates time of day and changes the lights accordingly.
Xmortx114145 (author)  frollard4 years ago
Ah okay thought i may be missing something! Okay well could you point me to an arduino that suits my needs? I did find one on ebay but it stated that it had 54 i/o ports 14 used for pwm! Thats fine but just seems a waste of a lot of hardware lol was only 20 quid tho! Also is the language code in c+ kuz if thats the code then i already know a basic ammount of that so it will be easier than learning python! Im assuming also that i will be using the circuit as before attached to each channel to protect the ardiuno and also to provide the voltage the leds need? Just making sure i understand what im doing before i dive in lol!
Arduino is programmed in a variant of C - very easy to understand/pick up.

Depends how many individual channels of pwm you need. You can get away with 3-6, then get the uno. I really like the teensy http://www.pjrc.com/teensy/index.html which has 7-12 pwm outputs and is very inexpensive, and works with arduino code out of the box.

Xmortx114145 (author)  frollard4 years ago
just read that and it says the teensy only has 10 pwm outputs! think ill use the mega to get it working and them downgrade to something more suitable when i know exactly how many pwm's ill actually need lol
right so to the code! is there any program for windows i can use to simulate a program for arduino?
Xmortx114145 (author)  Xmortx1141454 years ago
never mind about that actually... when i output the pwm would i have to set each individual channels on off time as + or - the actual time to start the dimmer rolling across the channels or is there an easier way to do it that just tells the arduino to start here and cycle through the channels at set frequencies and set times? hope that makes sense!
Xmortx114145 (author)  Xmortx1141454 years ago
or actually will i be setting each channel at each time seperately then looping it?
You will need to come up with an algorithm that reads the time (use an external RealTimeClock (RTC) like the chronodot, then fades different channels in based on the 'on' time.

think of time as 'number of seconds from midnight to now' - very easy to calculate
03:15:21 is 3x60*60 + 15*60 + 21 = 11721 seconds
12:25:15 is 12*60*60 + 25*60 + 15 = 44715 seconds
"on" time is when the first channel starts its fade in (as a whole number)
brightness1 = if (nowtime - ontime) >0, then (now - on), else zero.
channel 2 happens at on time plus x (whatever)
brightness2 = 'number of seconds since 'on' minus x, or zero, whichever is greater'
channel 3, plus 2x - you're writing a program, you can do ANYTHING with it!

heck, add a lightning emp detector circuit and flash the leds all to full bright for 10ms to mimic real lightning in the area.

add a random value that constantly adds a bit of a slowly shifting sine-wave random number to each channel so it looks like its shimmering...
Xmortx114145 (author)  frollard4 years ago
http://code.google.com/p/jarduino-aquarium-controller/

good idea?
Xmortx114145 (author)  Xmortx1141454 years ago
Problem i have is, i do know c+ but after looking at these programs as an example i have a lot of learning to do in terms of the language! Have done intigers and floating point and im pretty sure i have some coursework somewhere but i was always far better with electronic devices like logic or op amps for example! My learning about c+ was mixed with c and visual basic and a tiny ammount of java..... I really dont have the knowledge to write a program that complex! I will indeed learn it because i love the idea of having lots of little home built devices built around arduino and raspberry pi but again i understand im going to have to start from the beginning and learn it all again! So for the moment i just want a pre built program to turn my lights off and on at set times but has everything in place so that after learning arduino code or/and python i can write a code and mount it and job done lol!
Just start small, and work up from there.
Xmortx114145 (author)  frollard4 years ago
Yeah but my plant is dying out so im gunna need something! Dont see the point in buying new bulbs when ill be going led anyway haha
*small program. Get the lights working, add pwm later.
Xmortx114145 (author)  frollard4 years ago
//Arduino 2560 mega

int ledpin0 = 1;
int ledpin1 = 2;
int ledpin2 = 3;
int ledpin3 = 5;
int ledpin4 = 6;
int analogpin = 98;
int val = 0;

void setup ()
{
pinMode(ledpin0, OUTPUT);
pinMode(ledpin1, OUTPUT);
pinMode(ledpin2, OUTPUT);
pinMode(ledpin3, OUTPUT);
pinMode(ledpin4, OUTPUT);
}

void loop()
{
val = analogRead(analogPin);
analogWrite(ledpin0, val / 4);
analogWrite(ledpin1, val / 4);
analogWrite(ledpin2, val / 4);
analogWrite(ledpin3, val / 4);
analogWrite(ledpin4, val / 4);
}

am i right in thinking that this simple code will control 5 pwms from 1 pot?
Xmortx114145 (author)  Xmortx1141454 years ago
//Arduino Mega 2560

int daypin0 = 1;
int daypin1 = 2;
int daypin2 = 3;
int daypin3 = 5;
int daypin4 = 6;
int nightpin0 = 7;
int nightpin1 = 8;
int nightpin2 = 9;
int nightpin3 = 10;
int nightpin4 = 11;
void setup ()
{
pinMode(daypin0, OUTPUT);
pinMode(daypin1, OUTPUT);
pinMode(daypin2, OUTPUT);
pinMode(daypin3, OUTPUT);
pinMode(daypin4, OUTPUT);
}

void loop()
{
analogWrite(daypin0, 127);
analogWrite(daypin1, 0);
analogWrite(daypin2, 0);
analogWrite(daypin3, 0);
analogWrite(daypin4, 0);
analogWrite(nightpin0, 0);
analogWrite(nightpin1, 0);
analogWrite(nightpin2, 0);
analogWrite(nightpin3, 0);
analogWrite(nightpin4, 0);
delay(7200000);
analogWrite(daypin0, 255);
analogWrite(daypin1, 127);
analogWrite(daypin2, 0);
analogWrite(daypin3, 0);
analogWrite(daypin4, 0);
analogWrite(nightpin0, 0);
analogWrite(nightpin1, 0);
analogWrite(nightpin2, 0);
analogWrite(nightpin3, 0);
analogWrite(nightpin4, 0);
delay(7200000);
analogWrite(daypin0, 127);
analogWrite(daypin1, 255);
analogWrite(daypin2, 127);
analogWrite(daypin3, 0);
analogWrite(daypin4, 0);
analogWrite(nightpin0, 0);
analogWrite(nightpin1, 0);
analogWrite(nightpin2, 0);
analogWrite(nightpin3, 0);
analogWrite(nightpin4, 0);
delay(7200000);
analogWrite(daypin0, 0);
analogWrite(daypin1, 127);
analogWrite(daypin2, 255);
analogWrite(daypin3, 127);
analogWrite(daypin4, 0);
analogWrite(nightpin0, 0);
analogWrite(nightpin1, 0);
analogWrite(nightpin2, 0);
analogWrite(nightpin3, 0);
analogWrite(nightpin4, 0);
delay(7200000);
analogWrite(daypin0, 0);
analogWrite(daypin1, 0);
analogWrite(daypin2, 127);
analogWrite(daypin3, 255);
analogWrite(daypin4, 127);
analogWrite(nightpin0, 0);
analogWrite(nightpin1, 0);
analogWrite(nightpin2, 0);
analogWrite(nightpin3, 0);
analogWrite(nightpin4, 0);
delay(7200000);
analogWrite(daypin0, 0);
analogWrite(daypin1, 0);
analogWrite(daypin2, 0);
analogWrite(daypin3, 127);
analogWrite(daypin4, 255);
analogWrite(nightpin0, 0);
analogWrite(nightpin1, 0);
analogWrite(nightpin2, 0);
analogWrite(nightpin3, 0);
analogWrite(nightpin4, 0);
delay(7200000);
analogWrite(daypin0, 0);
analogWrite(daypin1, 0);
analogWrite(daypin2, 0);
analogWrite(daypin3, 0);
analogWrite(daypin4, 127);
analogWrite(nightpin0, 127);
analogWrite(nightpin1, 0);
analogWrite(nightpin2, 0);
analogWrite(nightpin3, 0);
analogWrite(nightpin4, 0);
delay(5400000);
analogWrite(daypin0, 0);
analogWrite(daypin1, 0);
analogWrite(daypin2, 0);
analogWrite(daypin3, 0);
analogWrite(daypin4, 0);
analogWrite(nightpin0, 255);
analogWrite(nightpin1, 127);
analogWrite(nightpin2, 0);
analogWrite(nightpin3, 0);
analogWrite(nightpin4, 0);
delay(5400000);
analogWrite(daypin0, 0);
analogWrite(daypin1, 0);
analogWrite(daypin2, 0);
analogWrite(daypin3, 0);
analogWrite(daypin4, 0);
analogWrite(nightpin0, 127);
analogWrite(nightpin1, 255);
analogWrite(nightpin2, 127);
analogWrite(nightpin3, 0);
analogWrite(nightpin4, 0);
delay(5400000);
analogWrite(daypin0, 0);
analogWrite(daypin1, 0);
analogWrite(daypin2, 0);
analogWrite(daypin3, 0);
analogWrite(daypin4, 0);
analogWrite(nightpin0, 0);
analogWrite(nightpin1, 127);
analogWrite(nightpin2, 255);
analogWrite(nightpin3, 127);
analogWrite(nightpin4, 0);
delay(5400000);
analogWrite(daypin0, 0);
analogWrite(daypin1, 0);
analogWrite(daypin2, 0);
analogWrite(daypin3, 0);
analogWrite(daypin4, 0);
analogWrite(nightpin0, 0);
analogWrite(nightpin1, 0);
analogWrite(nightpin2, 127);
analogWrite(nightpin3, 255);
analogWrite(nightpin4, 127);
delay(5400000);
analogWrite(daypin0, 0);
analogWrite(daypin1, 0);
analogWrite(daypin2, 0);
analogWrite(daypin3, 0);
analogWrite(daypin4, 0);
analogWrite(nightpin0, 0);
analogWrite(nightpin1, 0);
analogWrite(nightpin2, 0);
analogWrite(nightpin3, 127);
analogWrite(nightpin4, 255);
delay(5400000);
analogWrite(daypin0, 0);
analogWrite(daypin1, 0);
analogWrite(daypin2, 0);
analogWrite(daypin3, 0);
analogWrite(daypin4, 0);
analogWrite(nightpin0, 0);
analogWrite(nightpin1, 0);
analogWrite(nightpin2, 0);
analogWrite(nightpin3, 0);
analogWrite(nightpin4, 127);
delay(5400000);
analogWrite(daypin0, 63);
analogWrite(daypin1, 0);
analogWrite(daypin2, 0);
analogWrite(daypin3, 0);
analogWrite(daypin4, 0);
analogWrite(nightpin0, 0);
analogWrite(nightpin1, 0);
analogWrite(nightpin2, 0);
analogWrite(nightpin3, 0);
analogWrite(nightpin4, 63);
delay(5400000);
}

I know this is a long code and im sure i could do it much more simply but im trying to get the hang of it so am i going in the right direction here??
reasonably you need 3 pwm outputs, one for each colour. (remember one output can drive multiple transistors)
Xmortx114145 (author)  frollard4 years ago
surely to get the strips to roll from left to right id need one channel per strip not a channel for colour?
I honestly don't know how to output pwm on a pi - operating system level programming is beyond me. Something simple like a Pic or Arduino compatible dev kit can easily handle the task.