I was considering using a Raspberry Pi controlling a USB Relay to dim 12V LED lights, but I'm having trouble finding a solution that isn't a simple ON/OFF. What type of device would I need for dimming?
1 Answer
You probably want a PWM (pulse width modulation) solution. Essentially this means flashing the led on and off faster than you can see. To make it brighter, you increase the amount of on time versus off time.
You could use an external PWM LED driver, or possibly you can produce PWM from the GPIO ports on the Pi and step it up using a transistor and / or relay.
-
1$\begingroup$ Upvoted for being exactly the answer I wanted to give. Tom: You want to use PWM. $\endgroup$ Jul 3, 2013 at 9:05
-
$\begingroup$ Keep in mind that running PWM through a mechanical relay (instead of a solid-state relay) will be very rough on the moving parts -- as shown here: youtube.com/watch?v=vQ5nfQjgW70. (This video shows how to convert PWM to a smooth signal before it hits the relay, it's not a solution to your problem). $\endgroup$– IanJul 3, 2013 at 18:08