I have had ideas for an arduino-controlled led-lamp for a while now. It's mostly fancypants stuff, but could be fun.
The lamp is made up of several individually controllable leds. And on power-on I want these to light up in order. So far I think my mostly-software skillset is enough. However, I want the reverse thing to happen when the power is cut. So in essence, the arduino must detect that the power is gone, and then trigger a subroutine that shuts down the leds in some order.
Can I do this with some kind of capasitor-setup? I know my car uses a cap to keep the lighting inside on for a few seconds after i shut of the ignition.
-
\$\begingroup\$ I doubt the car's interior's light uses a capacitor. It doesn't need one; it has the battery. The fading will be done in software, that's free, the capacitor isn't. \$\endgroup\$stevenvh– stevenvh2012年09月03日 12:13:44 +00:00Commented Sep 3, 2012 at 12:13
-
\$\begingroup\$ Hmm... The cheapo carstuff stores here sold an aftermarket dimming thingy which was mostly a cap that you connected to the existing rooflight... \$\endgroup\$Christian Wattengård– Christian Wattengård2012年09月03日 12:20:17 +00:00Commented Sep 3, 2012 at 12:20
-
\$\begingroup\$ OK, in that case it's possible. I was talking of an in-designed thing. \$\endgroup\$stevenvh– stevenvh2012年09月03日 12:21:30 +00:00Commented Sep 3, 2012 at 12:21
-
\$\begingroup\$ @ChristianW: What are you powering it with? The source, the voltage, and approximate current draw? \$\endgroup\$boardbite– boardbite2012年09月03日 12:52:34 +00:00Commented Sep 3, 2012 at 12:52
-
\$\begingroup\$ Since it only exists in my head still; I'm not quite sure. What I want is to be able to control at least 8 of something like this: wtn.gd/PUS9Bh \$\endgroup\$Christian Wattengård– Christian Wattengård2012年09月03日 13:19:24 +00:00Commented Sep 3, 2012 at 13:19
2 Answers 2
Step back and think of the true requirements. You want the lamp to come on softly when you turn it on, and go off softly when you turn it off. Don't complicate things by dictating where in all this power must be switched.
You have a microcontroller, so the on and off signals can be inputs to it instead of physically interrupting power. The micro can then decide what to do about it and eventually switch off the power or go into sleep mode such that the power draw is so low as to be irrelevant. A modern micro in sleep mode with the right power supply can draw far less current than the average clock, for example.
A arduino is a lot of fancy stuff and layers of abstraction wrapped around a microcontroller dumbed down for the masses. Whether that can go to very low power I don't know, but a bare micro certainly can. If not, you can use a micro directly (it's really not that hard, just seems intimidating at first, which is what the arduino caters to), or maybe have the arduino physically turn off power when it is done with the dimming via a relay or something.
The on/off button would force the relay on with the micro having the ability to keep it on thereafter. On power up, the micro knows the lamp is being turned on. It drives the enable to keep the relay on after the on/off button is released, then goes thru the soft start sequence. When the button is detected while on, the micro goes thru the soft off sequence, then stops forcing the relay on, which will completely cut power.
-
\$\begingroup\$ True. That way it would probably be easier to implement my future goal of making it remotely controllable to. My language of choice is C#, but I could probably code C if my life depended on it ;) \$\endgroup\$Christian Wattengård– Christian Wattengård2012年09月03日 13:21:58 +00:00Commented Sep 3, 2012 at 13:21
I can think of a diode in the power line, separating the main power from a large capacitor supplying your controller and LEDs. Sense the main power in front of the diode and start your shutdown sequence when power disappears right there.
This requires of course some kind of power supply, you can not directly work on the mains from the wall outlet.