Friday, March 3, 2023

Flicker LED Amplifier



Flicker LEDs are nifty little components. Give them a tiny bit of current, and they produce a light that bounces up and down in a random-appearing fashion. It can bear a passing resemblance to the flame of a candle. The main problem with these LEDs is that they aren’t very bright. I have my Lightboard with a nice firelight effect, but I still wanted something cheaper and simpler with almost as nice of an effect.

Most of these LEDs have a small integrated circuit embedded in the plastic head that can seen if you look closely. 

image from Tim's Blog


There’s a great discussion of reverse engineering these flicker LEDs in Tim’s Blog post “Hacking a Candleflicker LED”. He uses a logic analyzer to look at current drawn by the flicker LED. This reveals what appears to be a PWM signal of varying intensity that controls the flicker effect.


He then goes on a really impressive deep dive quantifying the PWM levels and speculating on the pseudorandom sequence generation. —Go read it, seriously. It’s not long and really fascinating.—


Windell Oskay, over at Evil Mad Scientist, put together a great post "Does this LED sound funny to you?" in which he uses a PNP transistor to amplify the signal being drawn by the flicker LED. he then sends this to a LED and then a speaker. Unfortunately the STX790a transistor he selects has been discontinued, and I had some difficulty finding a similar spec’d transistor (ie stopped after 10 minutes of google-ing). I did have some PN2907 PNP transistors lying around. I tried one of those in Oskay’s circuit. 


The flicker LED would flicker nicely, but unfortunately just caused the transistor to continuously conduct. The secondary LED would just stay lit, perhaps a bit dimmer than usual. Interestingly enough, when I hooked the transistor up backwards (still in the same place in the circuit, but just swapping the collector and the emitter leads) both the flicker LED and the secondary LED would flicker. The effect seemed stable. The transistor was still working as a PNP transistor, but just with unknown specs. Seemed kind of sketchy and not exactly something I could recommend to others… So back to my parts box…

I have several "logic-level" N-channel mosfets lying around in my parts box, specifically the IRLB8721 and the FQP30N06L. I use both of these frequently for rapid switching (PWM and otherwise) up to a few amps of current at 12V. 

I set up my mini digital oscilloscope to query the voltage at a few points along a simple flicker LED circuit and found that I could reliably detect the signal between the LED and the resistor when they were arranged like this.


This meant that I could replace the oscilloscope with my mosfet and use that to turn on and off my secondary LED. In order to protect the LED from the few picoseconds of in rush current to the gate when the fet was switching, I split the resistor before and after the LED like this-

This gave me the following signal





Voltage reliably switches back and forth between 0 and 5v. Perfect for running my mosfet. (Interestingly, it looks like the flicker LED uses an approximately 400Hz PWM signal and varies the duty cycle to change brightness. Most of the time the LED is full on, but will give “flickers” of various lower duty cycles.) This gave me the final circuit diagram.


The circuit is easy to put together on a breadboard, but I wanted a cleaner solution that could run flicker lights for several pumpkins, so I put together a PCB. 




Here’s a picture of the board assembled and mounted. It has holes placed such that a zip tie can fasten the board to a 1/2” PVC T fitting. I can then slide a plastic cup over the top. This lets me mount it in the yard, covered from rain, and able to drain well.


And finally, here’s a video of the circuit in action and my assembly of an electronic PVC candle.




So, I’m still rather partial to the firelight effect on my Lightboard, but if you’re looking for something that doesn’t need any coding, this circuit is a great option. You can easily put this together on a breadboard, but if you’d like a more streamlined solution, I’m happy to put a PCB board in the mail. Check out the Jekyll-Labs Store and contact me through the link in the side bar. 



No comments:

Post a Comment