I'm looking for a mystery component or circuit that will allow me to gradually dim a 12 Volt LED.
I suppose it would be a sort of RELAY/DIMMER hybrid.
This is easy manually, using a potentiometer or slider on a closed circuit. However! Being a difficult person I'd like to do this using Arduino control. (So the light can react to ambient conditions.)
I have a basic relay circuit.
But this obviously limiting me to an on/off function, I would like to have gradients of light and possibly a smooth transition.
I have seen videos on youtube of Arduino users dimming AC Mains bulbs through a complex system of diodes, several relays and scary oscilloscope readings but Its all to heavyweight. (because its all AC mains voltage I guess.) There must be a simpler way of dimming a 12v DC circuit from a 5v arduino.
Do google PWM, but the above post is the hint you were looking for.
PWM (pulse width modulation) dims the LED by turning it off and on real fast. The ratio of off time to on time determines the brightness of the LED. If it's off all the time = dark. If it's on all the time = bright. If it's on half the time and off half the time = dim. Of course you can vary brightness between the off/half/on. Your eyes integrate this very well as long as the cycle time (one complete off and on cycle) is fast enough.
The AVR chip has the ability to do the PWM function, where effectively you define the off time and on time. Lots of example code on how to use the PWM function is on this board.
Because you are driving a 12 V LED, you need something to deal with the fact that the output of the Arduino is only 3-4 V. The transistor/FET could do that. Plenty of examples on the net.
That's great.
I had used transistors to step things up back in high school but that was about 4 years ago now
and we only used them for digital in and output.
I hadn't realised they were capable of stepping up analogue values too.
Pretty bad show of ignorance on my part but thanks for all the input.
So now I have a row of 8 transistors on a chip and can fire up these 12 volt LED's with easy control of brightness and dimming... and without the annoying relay clicking!
Rob
(PS also playing with pulse width modulation to create effects in colour thanks again for helpful posts!)