Everyone playing with electronics these days knows about LED strips made of dozens or hundreds of individually addressable RGB LEDs. I love them and make great use of them in the nootropic design Lumazoid music visualizer. But what about incandescent lamps? Old-school light bulbs with a filament have a soft warm glow that you just can’t get from LEDs. Wouldn’t it be great to be able to control a bunch of lamps individually by setting their brightness in code on a microcontroller? This is just what I set out to do recently, and the results are great.
How it works
I simply used the same technology as LED strips to allow communication between lamp modules. LED strips have RGB LEDs with an embedded driver chip which uses PWM (pulse width modulation) to control the duty cycle on the red, green, and blue LEDs. This combined LED/chip is called WS2812 or WS2812B. On older LED strips, the driver chip was not embedded into the LED itself, but was a separate chip called WS2811. These standalone driver chips are somewhat obsolete now which means they are cheap! I got 50 of them on eBay for $5.00. Since these modules use the same technology as LED strips, the same code can be used. Adafruit’s NeoPixel library is a very simple way to control LEDs, so we can control each lamp easily. The lamp is controlled by the “blue” pin on the WS2811 so that is the value to set.
lamps.setPixelColor(lampNum, pixels.Color(0, 0, brightness));
The driver chip cannot sink enough current to control a lamp directly, so I connected one of the LED output pins (the pin designated for blue) to a P-channel MOSFET. The PWM output from the WS2811 pin controls the MOSFET gate and the MOSFET then controls the current flowing to the lamp. I tried several MOSFETs to find one that worked best for a 5V source and allowed good control at very low PWM duty cycle. The FQP27P06 MOSFET allows the lamp filament to glow at an almost imperceptible level at a PWM duty cycle of 1/255. Since a lamp filament takes a bit of time to turn on/off, there is no flicker at low duty cycles. Nice!
Notice that the module has a big 1500uF capacitor. This is because the PWM creates a lot of ripple in the power line that needs to be smoothed out. At first I did not experience this when using only one WS2811/MOSFET/lamp in the circuit, but as soon as I added more there was lots of flickering caused by power line noise. A big fat cap solved that.
Lamp bulbs and sockets
The board is designed to allow the lamp socket to be mounted on the top or the bottom. That’s why there are 2 lamps in the schematic. There are also solder pads with holes to allow wires to be attached if I don’t want the lamp directly on the board. I used E10 miniature sockets from eBay and #27 bulbs with an E10 miniature base. These are 5V bulbs that draw up to 300mA. These can be bought at Mouser (part number 560-27). Or you can get them and lots of other bulbs from Bulb Town. Who knows more about bulbs than Bulb Town? Nobody, that’s who.
If you are using lots of them at full brightness, you’ll need a beefy power supply. I have 20 lamp modules strung together and power it with a 10A supply. If I try to set all 20 lamps to full brightness at the same time, the lamps at the end of the string are dim because of the resistance in the power wires, so my Arduino driver programs need to account for this. Also, a lamp filament doesn’t turn on/off immediately like an LED, so I also had to take this in consideration in my programs. This slowness in the on/off actually smooths out the illumination so there is no flicker, even at very low duty cycles.
I’m really happy with how this all turned out. I’m not planning on offering these modules as a product because I think the minimum price would need to be about $7 each, which I’m not sure people would want to pay. If you really think I should offer these or are interested, please let me know.