Author Options:

Fade LEDs on and off when the power is switched on and off Answered


I'm still a complete novice when it comes to electronics so I was wondering if anyone here would be able to help.

I'm rigging up some LED lighting for my aquarium which is set to switch on and off with timers on the mains supply to the house. The timers switch on/off the power transformers which supply the LED lights. I would love to find a way so that when the power comes on the lights fade on and when it goes out they fade out, would be nice if it was a long fade too, maybe 15-30 minutes, ideally 30 mins to an hour.

I am guessing there would have to be some pretty big capacitors involved to that would fill up, increasing the brightness as they goe, when the power comes on and slowly discharge as the power switches off.

Another thing to note is that I am using 2 different LED systems.

The blue LEDs are using standard LEDs that are sold in blocks (3 LEDs per block, I'm using 3 blocks, so 9 LEDs total) and are designed to run on 12v. I am currently running them on 6v as they are pretty bright, but if the circuity could have them fade over an hour I would like to put them up to the full 12v. 

The white LEDs are 4 of 3w luexon star type LEDs that are running in serial. The system goes mains > 12v transformer > 3w LED Driver > LEDs. Here is a link to the driver I'm using


I assume that the fade device would have to go between the driver and the LEDs?

Thanks for any help you can give me.



You might want to look on ebay for car audio capacitors, as they have a huge capacity for a relatively small cost, and run on 12V. Far simpler, and only slightly more expensive than aquiring a microcontroller and programmer.

I had a look on eBay, and they did have an 18 farad power cap, which would be ok for the blue LEDs. That cost £90 whereas the Arduino uno was around £20, so even if it costs that again to build the circuit to go in the aquarium it would still be half the cost of the power cap, and that would only do 1 set of LEDs. The other LEDs would need around 600 Farads.

The other thing is that I've read that usng the capacitor method is not good if you are using power LEDs with drivers, as the driver will always try to get the LED to a specified output.

Plus, I've been looking into Arduino's and they look really cool. I would be able to do a lot more with the aquarium's lighting and do it from one power source. should also be able to use it to control the cooling fans so that they're spinning slower at night. I may even be able to add a servo to vary the flow from the water output and create a wave effect.

It is only occasionaly that you get a good deal on them, I have seen 20 farads go for around £25 to £30 before.

A basic 8 pin microcontroller is the best thing to use here, seeing as only a few I/O pins are needed. You might also consider a PIC chip, as after the cost of the programmer (£10 to £50), the chips are only around £1.50 each, and require only a 5V regulator and 0.1uf cap to operate. In terms of programming, it is fairly simple to get it working, and the free software supports C and ASM.

Thanks for the info.

That was the only thing I was unsure of with the Arduino, it seems like you'd have to use the development board in the final product as I could never see any end product type boards that only had the chip and I/O pins on it. The closest was the nano, which still had a USB port so I still consider it a development platform.

Do you have any links to good places for beginners to PIC? The community was one of the things that atracted me to the Arduino, that and the API was simple and familiar as I used to code Java.

Do PIC chips have similar PWM features as Arduino, as looking at my projects I'd need 4 or 5 PWM outputs to vary the light level of the LEDs and speed of the fans. I'm asuming that the digital outputs are either on or off, whereas I'm looking for degrees of power. I could be completely wrong as I'm a complete novice when it comes to this sort of thing.

Many of the recent chips have features such as PWM, duty cycle measurement & compare, analog to digital converters and internal clock up to 8MHz.

For getting started, you should invest in a breadboard, and copy of pic in practice, which I learned to program from, and goes from lighting an LED, to driving LCD displays.

If you still want to use the arduino, I beleive it uses a normal microcontroller, so cold be used as a programmer if you identify the correct pins.


7 years ago

I've been doing more investigating of my own and now think that a capacitor would not cut it. Well, they would do the job but the size of the capacitor I'd need would be huge. The smallest would be 18 Farads for the blue LEDs.

So I think I need a more advanced solution, but one that would still be ok for a novice to understand an build reasonably cheaply.

I have also noticed that the LED driver has a port that can be used for dimming using a PWM, so that may be a better alternative for them. I really don't have a clue about programming microcontrollers, though I understand the syntax is similar to Java which I have coded in the past. If the microcontroller understands time, I could always have it so that the power switches on, the microcontroller fades the light up waits 10 hours, fades the lights down, then the power would be set to cut once the lights are dim.

Any advice or thoughts would be most welcome.