Secondary Led Lighting Circuit Project

February FOTM Photo Contest Starts Now!
FishForums.net Fish of the Month
🏆 Click to enter! 🏆

kaivalagi

Fish Herder
Joined
Nov 28, 2009
Messages
1,889
Reaction score
0
Location
Norwich, UK
Hi,

First of all I am only in the planning stages and am not sure whether this project will actually go anywhere, but here's what I am thinking.

I would like this sequence of lighting to take place:

In the morning (dark->light):
  1. wait ? minutes for "light"
  2. very dim blue output off
  3. very dim white output on
  4. wait 10 minutes
  5. dim white output
  6. wait 10 minutes
  7. normal white output
  8. wait 10 minutes
  9. bright white output
  10. wait ? minutes
  11. main t5's on (seperate timer plug)
In the evening (light->dark):
  1. main t5's off (seperate timer plug)
  2. wait ? minutes for "dark"
  3. bright white output (as before)
  4. wait 10 minutes
  5. normal white output
  6. wait 10 minutes
  7. dim white output
  8. wait 10 minutes
  9. white off
  10. very dim blue output on
The LED's will ideally be evenly spaced along the length of the tank and diffused a little, mostly white LEDs with some additional blue ones for moonlight output.

I have been looking at circuits for driving LEDs as I want to be able to up the brightness in stages from nothing when first turned on, to full across 3 stages with say 10 minutes in-between each stage, and do the same in reverse when switched off. I would also like to drive some moonlight LEDs when it gets dark(ish). All of this can be auto-switched by way of a LDR (light dependant resistor) and pot resistor.

So here are the web pages I have found promising so far:
http://electroschema...quarium-lights/
http://www.circuitst...ramping-circuit

Neither of which do exactly what I need but I do think the first link using a counter circuit is the way to go, just need it to do it's thing when dark/light triggers the on or off...and change the output layout to get varying brightness rather than separate LED series going on/off. T5's can then come on well into the morning when the sun is definitely up as they do now via a timer plug, when the white LEDs are already running. I am hoping the white LED light wont count towards lighting hours of the tank w.r.t. algae/plant growth due to being a lot weaker than tubes, which will hopefully mean I can get away with shorter periods of T5 based lighting so algae will be less of a problem :)

It may be a while off before I go out and get bits etc, I am trying to get an electronic circuit simulator working on my PC so I can prove the circuits before I buy parts...if that doesn't work then I might have to do the old fashioned thing and use breadboard to test with the actual bits.
Anyone else done this sort of thing before now? I am a little rusty with my electronics, having not done any in almost 15 years now...I still have my old Uni books so I am hoping I can pick it all up again
crazy.gif


Would be great if someone else in the forum who has a little knowledge of this could share any understanding they have...and maybe give me some feedback/constructive criticism?

===============================================================
Parts List

2 x 120cm Waterproof White LED Strip (£4 each) | £8 | ebay
4 x 50cm Waterproof Blue LED Strip (£2 each) | £8 | ebay
1 x LDR (9-22k) | £1.49 | http://www.maplin.co...?ModuleNo=35963
1 x Pot Resistor (100K Linear JM86T) | £0.72 | http://www.maplin.co...x?ModuleNo=2215
4 x Transistors (BC548B - 19p Each) | £0.76 | http://www.maplin.co...?ModuleNo=32952
1 x Binary Counter CMOS (74HCT4060N) | £0.79 | http://www.maplin.co...?ModuleNo=31818 Various resistors and capacitor | £1
Power Adapter (9V 1A) | £10? | ?I am contemplating using a PIC microcontroller instead of the analog electronics. I would have to write the fade in and fade out routines using PWM features of a PIC but the end result would be great, what with auto on and off based on light levels too. I can get the programmer board and several chips for £40 and already have a development environment which I can run simulations on........tempting. Anyone got any suggestions on features? So far I can think of adjustable fade times and max brightness via twisty knobs, anything else?

Estimated total: £29.76
 
I guess no one in all that interested in DIY LED secondary lighting?

I have researched some more and I am contemplating using a PIC microcontroller instead of the analog electronics. I would have to write the fade in and fade out routines using PWM features of a PIC but the end result would be great, a more natural change, and with auto on and off based on light levels too I think it would work well. I can get the programmer board and several chips for £40 and already have a development environment which I can run simulations on........tempting.

Anyone got any suggestions on features?

So far I can think of 1 slide control to set the light level triggering point, and also 8 adjustable fade times (incl zero fade time) and 8 max brightness levels, both set via a 8 setting dip switch. Maybe some external switches to turn off LED strip output too. I am guessing there will be 3 lighting outputs, 1 output for 2 x blue strips (moonlight at night) and 2 outputs for the 2 x white strips (dusk/dawn/daylight)

Rough sketch below so I can illustrate the arrangement hopefully
picled.jpg


Any comments/questions/suggestions are welcome

P.S. Updated above estimates based on LED strip purchase from ebay, I hope these strips are good enough...1 LED per 2cm of length so should be okay.
 
How are you intending to turn them on initially? The LDR can't help you stagger your lights before the main T5s come on... this would be okay for turning your LEDs off after they go off.

If you are going to have to use some kind of timer to turn on the LEDs before the T5, why not use a relay to control the T5s yourself? No need for an LDR to handle that.


/EDIT - I realise that because you intend on keeping the blue LEDs on at night, that the LEDs will not be on a "wall timer", this means you will probably have to handle the timing yourself in your own circuit, it adds more complication. I'll wait to see what you are thinking first...



Have you done PIC development before? You can get by with programmers for a few quid and 50p a time PIC chips... I'm not sure what sort of set up you are looking at for £40. A few chips around you can wire up directly to the parallel port to program :p
 
How are you intending to turn them on initially? The LDR can't help you stagger your lights before the main T5s come on... this would be okay for turning your LEDs off after they go off.

If you are going to have to use some kind of timer to turn on the LEDs before the T5, why not use a relay to control the T5s yourself? No need for an LDR to handle that.

/EDIT - I realise that because you intend on keeping the blue LEDs on at night, that the LEDs will not be on a "wall timer", this means you will probably have to handle the timing yourself in your own circuit, it adds more complication. I'll wait to see what you are thinking first...

The T5's are on a standard wall plug timer to ensure the BIG output is restricted to the usual amounts, for me probably about 7 hours, they are not connected (yet!) to the design, other than being the primary light source in the middle of the day.

The white LEDs will replace the blue LEDs output when the LDR resistance goes low enough, and a variable pot will be in the mix to determine the threshold for that LDR resistance before output is high on the PIC input. Potential divider stuff if memory serves me right.


Have you done PIC development before? You can get by with programmers for a few quid and 50p a time PIC chips... I'm not sure what sort of set up you are looking at for £40. A few chips around you can wire up directly to the parallel port to program :p


The £40 was for a PICKIT 2 plus demo board (can take up to 28 pin PIC I think) plus 10 assosrted PICs for me to play with long term. The PICKIT 2 can also help debug the PIC hence the price I think

Can you point me in the direction of the cheaper options you're talking about? I'd like to know all the options :)

Thanks for your input so far!


 
Okay so you are using the LDR just to switch from white to blue LEDs... I assume you are using the LDR to monitor the light output from the T5s not outside sources? (otherwise they will be affected by sunlight changes, curtains opening/closing, lights etc).

Doing this you can step down from white to blue when the lights go out... but you still have the "issue" of getting them to start up staggered before the lights come on - assuming you are going by the T5s output.



As for programming - a kit that can do multiple chips is nice, if you are going to be doing a bit more development with PIC etc - otherwise I would stick to the one you intend to use. I've only really used PIC 12F629 (and variants) and AVR ATMega8L and I have a cheap serial programmer for each - usually you can make your projects fit around the chip type and it becomes easier to work with. As for development, enough tools out there, GCBasic is one. Some of these programmer circuits are so simple, that you can build them yourself (most people that PIC develop should be able to), even get little kits with all the parts. Though saying all this - PICKIT 2 looks pretty well supported so getting help should be easy.
 
Okay so you are using the LDR just to switch from white to blue LEDs... I assume you are using the LDR to monitor the light output from the T5s not outside sources? (otherwise they will be affected by sunlight changes, curtains opening/closing, lights etc).

Doing this you can step down from white to blue when the lights go out... but you still have the "issue" of getting them to start up staggered before the lights come on - assuming you are going by the T5s output.



As for programming - a kit that can do multiple chips is nice, if you are going to be doing a bit more development with PIC etc - otherwise I would stick to the one you intend to use. I've only really used PIC 12F629 (and variants) and AVR ATMega8L and I have a cheap serial programmer for each - usually you can make your projects fit around the chip type and it becomes easier to work with. As for development, enough tools out there, GCBasic is one. Some of these programmer circuits are so simple, that you can build them yourself (most people that PIC develop should be able to), even get little kits with all the parts. Though saying all this - PICKIT 2 looks pretty well supported so getting help should be easy.

To began with I intend on automating the switching of LEDs from blue to white when the LDR goes low (it gets light), the LEDs are not powerful ones for now, they will hopefully run throughout the day without causing algae issues - to be honest I will have to see whether algae is an issue. What I want is the tank slowly getting light for the fish rather than abruptly, if the final amount of light from the LEDs is lowish that's fine as long as when the T5's kick in on a timer it isn't too much of an abrupt thing...

I have started writing a small MikroC based C prog for all the functions today, it's allowing me to think things through a bit more. No doubt what I come up with will be improved upon and built on...long term it would be nice to add some keys and LCD/LEDs to allow changing of settings easily. Short term I think I'll get a prototype working with default values in code, v.2 using DIP switches for the values and . v.3 might have decent keys and visual feedback if I get to that :)

I think I will go with a PICKIT2, it looks like it will do anything I may ever need it to

Any other feedback is much appreciated, I will have no doubt made a few design errors that may not show for me until later on...
 
I'm still a bit confused at one point.

Will the LDR be to detect light from your T5s or daylight (outside the tank)?

-T5s
You won't beable to get your lights to start up before the T5s do... so they will still abrubtly turn on.

-Daylight
Various reasons the lighting will change at varying times - quite possibly coming on before or after the T5s - thus the abrubt start up still.
 
I'm still a bit confused at one point.

Will the LDR be to detect light from your T5s or daylight (outside the tank)?

-T5s
You won't beable to get your lights to start up before the T5s do... so they will still abrubtly turn on.

-Daylight
Various reasons the lighting will change at varying times - quite possibly coming on before or after the T5s - thus the abrubt start up still.

My bad, the LDR will detect daylight and switch the "white" output on and blue output off when light levels are high enough

I think I may have to sample the LDR input several times (say 10 times, once every 20 seconds) before deciding it is dark or light...to hopefully get around any short term variations. I guess the LDR based approach might work but it does depend on environment, with a variable resistor to dictate the cut off maybe the sensitivity could be managed.

The other option is to stick a relay into the mix so I have the LEDs turn on based on a plug timer, which in turn switch on the T5's when the LEDs are at full strength? But then how do I have blue lights on at night, develop a programmable timer on chip too? edit: just realised you mentioned this a few posts back :)

I don't like the idea of developing a keypad and LCD for timer based settings, I would also need a backup battery to keep the thing on and the values registered...having not done any PIC dev before I am unsure whether this sort of thing can be done easily or not? Any ideas?

I have ordered my Pickit 2 and demo board today on the premise I will have to use PICs for this however I do it, the code based control over the PWM functionality is what I want. I have a copy of MikroC installed and running in a Windows VM, and am looking at GPASM, GPSIM and SDCC on Linux (I run Linux mostly at home). Any help or tips on the development tools front?

Anyway, this is all getting overly technical for a fish forum so I will shut up now (for a bit) :)
 
There are units out there to step up your lights anyway, tend to be high end. You run 2 T5s on one ballast? or 4 on a pair? If you run 4 the solution would be simply to run the one pair longer (30 min earlier, 30 min later).

Then you could run your blue LEDs based on the T5 output - or just leave them running all the time.

Your relay would be powered by the same source that would power the LEDs 24/7 - and thus can turn your 240v off at will.


Timers in PIC projects can indeed be a pain - and as you say the user programmability of it complicates the design slightly.


As for tools I will let you decide - I just use what I need when I need it, I don't do as much PIC programming as I would like to so I get by on minimums.



Might be worth posting your idea up on the PIC KIT forum... I'm sure for some of them there this will be simple as pie :p (ever tried to make pie? I doubt it's that simple - maybe they are referring to eating of the pie?)
 
There are units out there to step up your lights anyway, tend to be high end. You run 2 T5s on one ballast? or 4 on a pair? If you run 4 the solution would be simply to run the one pair longer (30 min earlier, 30 min later).

Then you could run your blue LEDs based on the T5 output - or just leave them running all the time.

Your relay would be powered by the same source that would power the LEDs 24/7 - and thus can turn your 240v off at will.


Timers in PIC projects can indeed be a pain - and as you say the user programmability of it complicates the design slightly.


As for tools I will let you decide - I just use what I need when I need it, I don't do as much PIC programming as I would like to so I get by on minimums.



Might be worth posting your idea up on the PIC KIT forum... I'm sure for some of them there this will be simple as pie :p (ever tried to make pie? I doubt it's that simple - maybe they are referring to eating of the pie?)

lol, I never did get that saying, I have only tried baking a few pies and it's best left to the bakeries and Delia Smiths of this world :)

I wonder whether this is best left to the LED lighting guys too, but I am not willing to pay their prices...

I am only using 2 x t5 with one ballast, any more and I might have to injet CO2 etc to encourage plant growth over algae, I don't want to go there really as I am not a "proper" planted tank enthusiast.

On the tool front, I could get away with minimum tools as debugging can be done through gpsim (linux based simulator for pics) which is pretty cool, but I do like the idea of being able to debug through the source and see the expected stages taking place (or not).

I think it's time to think this through over the next couple of days, and come up with some proper direction.

Thanks for all your input and feedback, it's been good to have someone to bounce this stuff off :)

Edit: Do you know of any good self contained timing units to power off DC with a simple high/low output for on/off?, If there is such a thing I can put one between a self made PSU (240V AC/12V DC/5V DC) and my PIC circuit, and then have blue LEDs when off and white LEDs on followed by relay switching for AC to the tubes after. It would be sort of simpler in operation (a switch to bypass fade duration to full on and a DIP switch for duration and light level) and the duration of the fade of the LEDs could be managed to set how long the T5s will be delayed before turning on.
Edit2: I could use a digital thermostat (cheaper alternative to a digital timer): http://www.reuk.co.uk/Convert-Thermostat-to-12v-Timer-Switch.htm
 
This is pretty interesting, I'm not a programmer, and until now had never heard of PIC. But it intreagues me, take away as many little bits to do with your fish that aren't enjoyable, even something as small as turning on/off lights etc, and you're left with that little bit more to enjoy watching... and other reasons too i'm sure.

I'm afraid I'm a little confused with how complicated you're making it...

I'd go simple, and analogue, with everything on timers. I'd buy 3 timers, take them apart, put them in a new casing where they're all together, feed all 3 off the same power source (have a plug coming out of the box) then have all the outputs coming through a multi-core cable, up to the different lights...

one comment on how you're doing it though,

with a daylight sensor, you may have solved short term variances, but sunrise/sunset happen at different times throughout the year, so muring some parts of the year, it may work perfectly, but the other parts, you may end up with the T5s coming on before anything happens with the LEDs... unless you change the timer settings for the T5s on a regular basis based on current daylight times
 
This is pretty interesting, I'm not a programmer, and until now had never heard of PIC. But it intreagues me, take away as many little bits to do with your fish that aren't enjoyable, even something as small as turning on/off lights etc, and you're left with that little bit more to enjoy watching... and other reasons too i'm sure.

I'm afraid I'm a little confused with how complicated you're making it...

I'd go simple, and analogue, with everything on timers. I'd buy 3 timers, take them apart, put them in a new casing where they're all together, feed all 3 off the same power source (have a plug coming out of the box) then have all the outputs coming through a multi-core cable, up to the different lights...

one comment on how you're doing it though,

with a daylight sensor, you may have solved short term variances, but sunrise/sunset happen at different times throughout the year, so muring some parts of the year, it may work perfectly, but the other parts, you may end up with the T5s coming on before anything happens with the LEDs... unless you change the timer settings for the T5s on a regular basis based on current daylight times


I've been unemployed for the last 2 months so have been looking for things to get my head into until work is found, so this little niggle of mine with the lights abruptly turning on and off has been amplified :)
Just typical that I got work lined up for Monday as of 2 hours ago though...I just got into this project and I have contract work lined up for the next 6 weeks and potentially longer. It will obviously mean this project will slow down (a little).

As far as the timings go, my t5's turn on well after sunrise and well before sunset even at this time of year in the UK. I have a very big gap between sunrise/sunset before the t5's would come on/go off.

I struggled to find a good standard analog approach to fading in LEDs over a long period (in minutes) nice and smoothly and came to the conclusion that PWM (pulse width modulation) was the only thing that would give good control on light output levels. When I looked for any PWM solutions using opamps/pre-made chips I couldn't find anything I liked so decided on this PIC based approach. I am a programmer by trade and did this assembly/C cross-assembled stuff in my engineering degree over 15 years ago, that's not to say this will be easy as I am very rusty with electronics and assembly in general these days and will no doubt have to re-teach myself a bunch of stuff - maybe I'll dig out my all course notes and books :)


I do think though that the general board design (even on stripboard) will be a lot smaller and simpler with a PIC, which for me is a big deal, I don't want a hugh great circuit board to house somewhere...

If anyone could suggest an alternative analog design I'd be game for checking it out, but it has to fade the lights nicely, maybe ramping up/down current rather than PWM duty but it must handle atleast 1 minute of "fade"
 
fair enough,

the analogue timer wouldn't do a proper fade, but it would be better than a simple abrupt change. stepping up lights one by one...

when you finish, maybe you could post specs n stuff so we idiots like myself can figure out doing something like this.
 
If you want to go the 3 timer approach and fade in the LEDS - you could still do that with the on phase, turning off you could always run it off a small battery for your period, and recharge it when the unit is powered externally. The Blue LEDs could then be run (without a timer) based on the light output of your T5s - actually ending up with only 2 timers.

The Blue circuit is much simpler then (actually could run off a relay for one of the T5s inputs... even simpler).
The white circuit is a bit simpler too, the logic is easier to comprehend.


If you want PWM dimming, there are premade driver boards that people use for building torches/other LED light driven projects that might be suitable.



But it intreagues me, take away as many little bits to do with your fish that aren't enjoyable, even something as small as turning on/off lights etc, and you're left with that little bit more to enjoy watching... and other reasons too i'm sure.

I'm afraid I'm a little confused with how complicated you're making it...


Who says circuit development/design isn't enjoyable? Some of us do enjoy it - why not combine the both :p

Buying the 2 extra timers would "work", and be simpler - what's the fun in that? :)
 
fair enough,

the analogue timer wouldn't do a proper fade, but it would be better than a simple abrupt change. stepping up lights one by one...

when you finish, maybe you could post specs n stuff so we idiots like myself can figure out doing something like this.

Right now I have a thing for a half decent PIC based project, I have already started on the reading of the documentation and done a little code development using a thing called MikroC, but haven't tested any of it so it's probably all wrong right now.

Once I have done one circuit/program with a PIC any future ones will be much easier (I hope).

I must emphasise I am still feeling my way back into electronics/assembly so I could well be an idiot myself here and there :)


When I'm done I may well post the project in full on my own website (which wasn't had any love for months), if I nail it and it's a really good thing (doubtful) then I may well build on order and not release the project code...we'll see how it goes...it will be a couple of months before I have anything to demonstrate I would think, now that I have got contract work lined up for the next couple of months.


If you want to go the 3 timer approach and fade in the LEDS - you could still do that with the on phase, turning off you could always run it off a small battery for your period, and recharge it when the unit is powered externally. The Blue LEDs could then be run (without a timer) based on the light output of your T5s - actually ending up with only 2 timers.

The Blue circuit is much simpler then (actually could run off a relay for one of the T5s inputs... even simpler).
The white circuit is a bit simpler too, the logic is easier to comprehend.


If you want PWM dimming, there are premade driver boards that people use for building torches/other LED light driven projects that might be suitable.

Thanks I'll have a look see, I'm done with electronics for tonight though, I think I should sit and watch my fish (with no lights off :()) for a while...

Who says circuit development/design isn't enjoyable? Some of us do enjoy it - why not combine the both :p

Buying the 2 extra timers would "work", and be simpler - what's the fun in that? :)


I already have one spare electronic timer spare....I could use this in the short term for my blue LEDs when they arrive :)

I don't see the point of lighting stages using 3 timers long term though, there will be 2 times the amount of abrupt light changes in the tank instead of one (albeit smaller differences but still enough to doubly annoy me!)

I've been trying for ages to think of something I could take on that would combine my existing programming career and scuba diving (the geek in me)...this is the closest I have found so far
laugh.gif

 

Most reactions

Back
Top