Fireflies - Analog Version...




Or, How to randomly flash 8 LEDs

OK. I'll admit that the fireflies in a jar thing has been done already. The difference here will be that this version will be done entirely with an analog circuit.

For anyone without a lot of electrical knowledge, what that means is that you can do the firefly circuit without needing to buy a PIC micro controller or do any programing on your computer. This circuit can be put together entirely from parts available at Radio Shack for a reasonable amount of money.

The one or two I have built are being used in enclosed projects with a translucent lens. I'm using them as night lights. The one pictured below is built from an old Weston meeter. You could easily use the micro LEDs and finer wire to simulate free-flying fireflies. I used green and yellow LEDs, and arranged them so some are closer to the front than others. The effect is somewhat hypnotic and organic. like there is something really alive in there.

The primary difficulty in designing this was in finding a way to randomly flash the LEDs. Much of the project was based off the very good instructions found here:

The Decade counter chip (LED driver) can actually drive up to 8 LEDs. I kept it to 5 just to keep the size and complexity down.

The second difficulty was finding a simple way to get a fade-effect in the LEDs. After a long series of fruitless searches and overly complex ideas, I found a few posts suggesting the use of a large capacitor and resistor combination. I worked it in, and the results were good enough. It does require some experimenting, though, to get the effect to work to your taste.

Parts List:
1 lm555 timer chip
1 cd4026b combined counter and display driver IC
16v 47uf capacitor
2 - 10k resistors
Jumper wire, a few feet.
LEDs. used 5-6 here, but with some creativity you could add more.
5-6 large capacitors. I'm using 1500uf
5-6 resistors of varying values
5-6 diodes.
5v to 9V DC power source of some kind. You can use 4 AA batteries as well. It's not that fussy. I would not go any stronger than 9V without a 7805 power regulator or something.

Soldering Iron
Wire Cutters
Housing of some kind

Step 1: The Chips

This circuit used two separate IC chips. A 555 timer and a 4026 counter. Both are actually pretty simple devices. It can be a little confusing and scary the first time you have to deal with ICs, but we will go slow.

The 555 chip is just a timer. It works by taking in electricity, and depending on the combination of resistors and capacitor you connect, it will output a pulse of electricity on pin 3. This is a very useful chip that has been perverted in a huge number of ways for many.. many purposes:

In this case, we are just going to use it as a basic timer just putting out a simple pulse. The pulse will go to the input pin of the 4026 counter.

The 4026 counter is pretty much what it sounds like. It counts. when power is applied to the chip, it will count up from 0 every time it receives a pulse on pin 1. Where it gets useful for us is that it will try to display that count on an 7 segment LED display it *assumes* we have attached to it. Now, if we instead attach a separate LED to each of these segment-outputs, it will appear to be flashing the LEDs randomly.

I know this is not true randomness, but you do have to watch it for quite a while before you see it repeat.

"But Photozz.. you said a 7 segment LED...Why are there 8 LEDs in the diagram"..

Thanks for asking, Timmy, I'll tell you. The eighth LED is driven by an output that is normally used for connecting to more counters. You could have several of the 4026s in a row, and each one would count to 10, then trigger the next.. etc..

Step 2: The "Fader" Part.

OK.. this took some screwing around. This circuit is not nearly as scary as it looks. It's basicaly the same as the previous diagram, but with a few added parts.

I cut the diagram down to just show two lights. Keeps it simple to understand. The value of the resistor is one of two factors that will affect the fade time. The other is the Capacitor.

On the output from the counter, there is a standard diode. This keeps the stored up charge in the capacitor from draining back into the counter chip.

The resistor mostly affects the "drain" time. This is how long the LED takes to fade after the signal is cut off. larger values mean more fade, as it takes longer to drain the capacitor, but slightly dimmer light.

The Capacitor mostly affects the "charge" time. When the pulse comes in from the chip, it will start to charge up the capacitor. the LED won't light up, for the most part, until the cap is charged. this leads to a fade-in effect.

Feel free to play with the values. I actually use a different value for each LED.


I highly recommend laying this out on a proto-board first, like the one below, just so you can play with the values without having to unsolder stuff continuously.

Start by assembling the 555 circuit first to assure that you have a working "pulse". connect the resistors and capacitor. then run a LED between pin 3 (positive) and ground. then connect the power. If everything is right, the LED should blink. If not, disconnect the power and check all your connections.

Once you have a pulse, connect up the counter IC. output of the 555 (pin three) to pin one of the counter IC. then connect a few LEDs to the output pins. add jumpers as per the diagram for the power and see what happens. the LEDs should start blinking somewhat randomly. If not, disconnect the power and check all your connections.

Once you have pretty blinking lights, you could just stop here and solder it up. I'm not going to go into techniques for layout or soldering. There are a lot of other great tutorials in here for those skills, and it's getting late. I'm sleepy.

If you want the fade effect, then it's time to start wiring in the extras.
First, wire in the diodes. this is important, as you don't want the capacitors discharging back through the counter IC.

start wiring in the capacitors and resistors. Play with different values to get the effect you want.

Oh, and before anyone asks me, the animation below is a GIF. I made it in Photoshop, but there are a lot of other software packages that can do it.

Step 4: Add a Housing

Now that you have it assembled, it time to find a housing of some kind. Admittedly, this would have been something to think of earlier, but I just don't work that way, baby.

For this lamp, I took an old Weston meeter I had laying around. I removed all the old internal mechanism.

I then fitted the board to some of the old mounting points, and arranged the LEDs on their stalks to about where I wanted them.

For the front cover, I just removed the existing glass, then used some decoupage to past on a firefly pattern I had printed out on the computer using tissue paper. I can go into that technique later if anyone asks. I remounted the glass.

The power source shown is scavenged from an old DVD player. One of those cheap ones that you get from Walmart for $29.95. The laser had died. When I checked, it was putting out a nicely regulated 5v. perfect for this.

That's about it. I'm open to questions and suggestions. Good luck.



    • Classroom Science Contest

      Classroom Science Contest
    • DIY Summer Camp Contest

      DIY Summer Camp Contest
    • Games Contest

      Games Contest

    32 Discussions


    7 years ago on Introduction

    radio shack does not carry the cd4026b that i can find


    7 years ago on Introduction

    so i got the 555 part working but when i connect 2-8-15 on the counter to ground all the lights stop blinking. what am i doing wrong?


    8 years ago on Step 3

    hi good work could you post a few more pics of the breadbord layout
    thanks having trouble converting circuit diagram onto bread board ,do have any suggestions


    8 years ago on Introduction

    I built this circuit but I only get a flash if I
    1: Disconnect and re-connect the reset pin on the 555 over and over again.
    2: I Disconnect the output pin from the 555 to the counter then I get a rather fast sequence.
    Do you have any suggestions?

    Jack Place

    10 years ago on Introduction

    so your saying to change the 47k Restore to a 10k and the CAP to a 47uf then each line to have a 1500uf with a range of Restores starting form where?


    10 years ago on Step 2

    I have built a number of the controllers but would like some advice on the in-line cap-restores. this is a first hobby and not sure where to start. the lights all come on with different flashing and could use some help on which cap and restore by lead number W


    11 years ago on Step 4

    that 1500uf cap is sort of pricey if you are going to start geting into dozens of them... any suggestions on how to tweak this to get away with a smaller one? what about some r/c combo with a transistor? R

    2 replies

    Reply 10 years ago on Introduction

    start collecting old junk and stuff - soon youll have a pile of old pcbs and you will be able to get all sorts of stuff off them


    11 years ago on Step 1

    If you want more lights, you could use two 4026s and two 555s (or a 556 dual timer). By using different resistor & capacitor values, one 555/4026 pair would run faster than the other pair, giving more randomness to the LEDs.


    11 years ago on Step 1

    That's Interesting, I'm guessing that the 57K produced by the resistors is doing the current limiting that you need on the LEDs? There isn't an LED in the world that I know can take 9V....but then again, my world of LEDs is limited to 18,000 mcd and lower.

    1 reply

    Reply 11 years ago on Step 1

    nope.. the 57K actually helps regulate the pulse length with the 555. The 4026 has an internal regulator and is designed for driving LED's. It will output a constant voltage to the LED's regardless of the input voltage. For that reason, I usually limit the input to 5-6 volts so the chips don't heat up too much. Some resistors may be necessary depending on what type of LED's you use, but I found with standard red/yellow LED's it's not really necessary.


    theres actually a simpler way to make flashing LEDs you can buy LEDs that flash for a few pennies extra each sp get ones of different times for one big circuit with a single switch or get a set of flashing ones and ten switches, this is one for people that don't like using even simple chips but the 555 one works well as i used it in technology class and my teacher was absolutely lost as to how i created a horse racing game that looked random (relays added and a few random input changers but settled on the microphone as it made the timer completely randomised by the pulses

    2 replies

    Reply 11 years ago on Introduction

    Yes, FLEDs are a cheap solution, but you can't make them fade in and out, and the timing of the flashes is fixed. Using the 555 and other discrete components, you can get a better effect. FLEDs would give more of a computer like blink instead of an organic fade.


    Reply 11 years ago on Introduction

    yeah but a handy option for the less observant person if you have a few real fading ones in the front


    12 years ago on Introduction

    Seeing that cat reminded me of when my cat bit through the xmas lights lead .. mains ones, he came home again after 3 days, after a rapid exit. Sorry, irrelevant comment.

    1 reply