Another day, another project started. I have a nice 5-meter LED strip in the office, which provides indirect lighting at Jee Labs. Works fine, but despite being called “warm white”, it’s slightly greenish. Not so great…
Someone suggested adding an RGB strip next to it, to compensate for the color.
So to start off this multi-part series, I wanted to simply control RGB. This is very easy to do with three MOSFETs. I used IRLZ34N’s N-channel, since the LED strips are common anode. The circuit is trivial: source to ground, drain to LED cathode, and gate to an I/O pin. Rinse and repeat three times. I didn’t even add a pull-down resistor to the gate, though I probably should.
Here’s the circuit, fully connected to a test strip with 9 RGB LEDs using a separate 12V power supply:
I wrote a little test sketch which ramps the light levels up and down using PWM, and which goes through all the RGB combinations – using some bit fiddling:
The LEDs are pulsed in software, with a cycle time of 8160 µsec (32 * 255), i.e. roughly 120 Hz. No discernible flickering. A more advanced version ought to use interrupts to keep the PWM going in the background.
Here’s a video of the result – with apologies for the very low quality.
Since the JeeNode has RF on board, it will only be a small step to add wireless control. Stay tuned…
Update – Source and drain were listed the wrong way around, I’ve updated the text above.