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.
radio shack does not carry the cd4026b that i can find<br>
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?
hi good work could you post a few more pics of the breadbord layout <br>thanks having trouble converting circuit diagram onto bread board ,do have any suggestions
Hello <br>I built this circuit but I only get a flash if I <br>1: Disconnect and re-connect the reset pin on the 555 over and over again. <br>2: I Disconnect the output pin from the 555 to the counter then I get a rather fast sequence. <br>Do you have any suggestions? <br>Thanks
It doesn't blink. Cap?
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?
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
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
1F caps are quite cheap....
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
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.
Where did you find the counter?
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.
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
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.
yeah but a handy option for the less observant person if you have a few real fading ones in the front
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.
Irrelevant, but very funny nonetheless! LOL >oD
very very cool
So I've been meaning to make some kind of random lighting feature for a while now, but I've had all kinds of trouble (mostly motivational, I admit) getting my ISP dongle built so I can use a microcontroller. I'm a mechatronic engineer, so it could be considered sacrilege to say it, but I love the idea of doing this with prepackaged ICs. Nice and clear instructions, too. (Except for the fact that you never mention why you're using a 5V supply on a circuit rated at 9V. Not that it matters, I know, just might confuse a couple of people when the diagram says 9 and you say 5.) So here's the main reason for my post: Great simple idea, but the random sequence isn't anywhere near long enough for my liking. So my plan is to implement it with two 555s running at different frequencies (even better, have a pot on one or both of them to make it variable), fed into two separate 4026 counters, then combine the results with a pair of 4070s (quad-XOR chips). That way if you have, for example, one path with a cycle time of 10 seconds and one with a cycle time of 13 seconds you'll have a combined cycle time of 130 seconds. That should be nice and long, hopefully long enough that my brain doesn't pick out the pattern easily and see it as an annoyance rather than a soothing distraction. Just thought I'd flag the idea here in case anybody else was interested in a potential extension to this Instructable.
I have two suggestions for you, one minor upgrade, and one nearly complete change of the project. 1) A possibly more efficient way to get apparently random sequences is to build a pseudo-random bit sequence counter. Google it to find out the details, but in short you take a bank of flip-flops as your state register and a bunch of XOR gates to interconnect them in just the right way that the bank will go through every possible binary value but do it in an apparently random order. (It's still clocked by a 555, or half a 556) 2) A somewhat different project that I've always wanted to do but never followed through on is individual 'fireflies' with CdS light sensors that allow them to synchronize. How? The resistive light sensor is used to set the off period of the 555 such that it shortens (hurries to the next blink) when another firefly blinks. You can Google pulse-coupled oscillators, and I also highly recommend the book Sync by Stephen Strogatz, which covers this exact phenomenon happening with real fireflies. I know this circuit has been done before, but I don't have any references off the top of my head. So now you've got these fireflies with batteries all over your room that should synchronize but only if it's dark enough that the ambient light doesn't wash out the coupling... as a last touch, they could be powered by solar cells that charge up a capacitor during the day and have an anti-hysteresis circuit to switch them on when it gets dark. At best, this would probably work out such that for the first 30-45min the circuits can't synchronize because there's still too much ambient light, but eventually they should. A good reference for the charging circuit is the Wikipedia page on solar engines, but don't get sidetracked by BEAM robots. I'd love to hear if anyone successfully implements some or all of these ideas. Maybe I will if I get motivated and have enough free time.
Yeah, sorry about the 5v/9v thing. That's what I get for using other peoples graphics. You can run it off 9v. Both chips are rated for it, but I usually prefer to run at 5v. Less chance of cooking things. If you want to save some space, go with a 556. it's two 555 in one package. You could also have the second 555 circuit triggered off the decade pin on the first counter. This can be configured so many ways its silly.
Fixed the instrucatble to list it as 5 to 9 volt. :)
Nicely done, I particularly like the retro case you found to house them in. Quite classy. Kudos!
Thanks. It's the result of lot's of dumpster diving. :)
great instructable, I think I might try this one out..
Check the roller caption/tag/thingy with the capactor: it can't be 47K. My guess is that you are using 1 uF... but the 47K is for the resistor above it.
Thanks, Fixed. It should have been 47uf. I was typing late at night :)
Great Instructable! I love the animated gif too. <br/><br/>If anyone is curious how to make them, there are two Instructables up about them:<br/><a href="https://www.instructables.com/id/E6V837A9HDEP287PCC">https://www.instructables.com/id/E6V837A9HDEP287PCC</a><br/><a href="https://www.instructables.com/id/EGYVYFWI2EEP286DZL">https://www.instructables.com/id/EGYVYFWI2EEP286DZL</a><br/>

About This Instructable




More by photozz:Staying Warm..On Hoth. Techniques for making a few simple boxes Photozz's Workshop 
Add instructable to: