Synchronizing Fireflies
I was always fascinated by the emergence of patterns. One I like most is the synchronization of hundreds or thousands of fireflies. First they flash randomly but after some time and influencing each other, they flash in sync.
The rule behind this is very simple. All fireflies have nearly the same frequency for their flashing, but their phase is shifted. If a firefly receives a flash of a neighbour firefly, it flashes slightly earlier.
This circuit simulates fireflies with small microcontrollers.
A single Firefly
The board consists of 25 fireflies. Every single firefly is self contained, there is no over-all controller. A single firefly consists of:
- ATtiny13 microcontroller, 1k SRAM, 64 bytes RAM
- Light Dependant Resistor (LDR)
- LED
- 2 resistors
The circuit is the same as for the Programmable LED.
The complete Board
Assembling 25 fireflies on a prototype board is easy. Harder is to get the right distance between all fireflies. It has to be close enough to let one firefly influence another, but not the whole group.
The LEDs I used emit the light mostly straight up. So a kind of reflector is needed. I used a piece of paper which is located 5 mm above the LEDs. For the next version I would take LEDs with a wider light emitting angle and use a kind of diffuser, as proposed by Tod for his Smart LED Prototypes.
Here is a video. It is a bit dark as my camera is not very suitable for this.
- Synchronizing Fireflies on Instructables. That is a more detailed step-by-step instruction with more pictures, sourcecode, etc.
- More on the algorithm can be found here:
Firefly Synchronization Ad Hoc Networks




21 Comments
Randy
11. May 2007hey,
I cam across your blog and take it that you’re the person that posted the Firefly Synchronization Instructable. I just want to let you know that its one my all-time favorites (and I’ve seen a lot of Instructables in my time).
Sincerely,
Randy
(on behalf of the Instructables team)
Chad
11. June 2007The leds are very mesmorizing to watch. Cool project.
SPman
23. June 2007Looks really nice. And you can add as many fireflies as you want – it’s just time consuming process. I wander how nice it would look in sphere shape as world map
P.S. Nice site – I enjoy reading it.
Alex
24. June 2007Thanks for stopping by.
And your site helped me a lot with my beginner problems
Electronics-Lab.com Blog » Blog Archive » Synchronizing Fireflies
2. October 2007[...] Fireflies – [Link] Tags: Led Filed in [...]
Terry
9. December 2007Amazing.
I work at radioshack.
Suppose I had to make this completely with Radioshack Parts.
What would I need and what would the connections be?
Dom
18. January 2008well, you would need a soldering iron, solder, photo sensitive resistors, prototype boards, leds, and a slew of atTiny13s, which you would have to order somewhere else, such as Digikey or a place that sells microcontrollers
Daily DIY Network - Science Projects Plans Guides » Blog Archive » Synchronizing fireflies
28. March 2008[...] Check out the Synchronizing fireflies [...]
C. Coffman
28. March 2008I wonder if this has any similar emerging properties to cellular automata. Some of the patterns it produces look similar to that.
Alex
28. March 2008Yes, I think so. Cellular automata use simple rules where every pixel is related to its direct neighbours and that is the same as with my fireflies.
Even a “Game Of Live” should be possible.
aaron
28. March 2008Awesome. So neat to see them all start to really synch up 2/3 of the way through.
Robert Louis Carpenter
29. March 2008Have you tried introducing error into the system once it has synchronized? Maybe something like shooting a laser pointer at the paper briefly….just a flash to introduce error into the system. I also wonder what would happen if you reprogrammed one of them to blink regularly (ie. no sync programming) but started much later. I would assume that they would all re-sync to the phase of the source that doesn’t shift.
It also makes me wonder what would happen if a corrupt wave was introduced…a light that doesn’t blink at the same speed. If it were the correct speed you might be able to get some cool patterns once it stabilized….I am thinking something like a ripple effect might appear.
Heraclitean Fire — Links
29. March 2008[...] Tinkerlog » Blog Archive » Synchronizing Fireflies via MAKE ‘… the synchronization of hundreds or thousands of fireflies. First they flash randomly but after some time and influencing each other, they flash in sync. This circuit simulates fireflies with small microcontrollers.’ (tags: LEDs fireflies electronics ingenious) daily links | 29 March 2008 at 9:34 am | RSS « ‘Breaking the Rules’ at the British Library [...]
Electronics-Lab.com Blog » Blog Archive » Synchronizing Fireflies NG
5. September 2008[...] is a remake of the fireflies which I did a year ago. I was always fascinated by the emergence of patterns. One I like most is [...]
Synchronizing Fireflies NG | electronic circuit project
27. December 2008[...] is a remake of the fireflies which I did a year ago. I was always fascinated by the emergence of patterns. One I like most is [...]
Eric
12. December 2010Probably stupid for every sharp minded people here but the 4 fire flies i have made seems to be
on low speed, they synch all right but even the 5 HELLO WORLD seem to be clocked at 1000ms(1s) so can I speed up the cycle?
Any help from however would be greatly apreciated
DO I mess with Make fike, c file then hex? and reburn the chip?
Alex
13. December 2010Hi Eric,
please double check if you burned the fuses correctly.
Cheers,
Alex
Eric
13. December 2010Hi Alex, they are alive!! work beautifully
Thanks for this Instructable, the best…
Eric
Iva
11. June 2011Thank you, thank you for opening my eyes on this! I just saw the actual synchronized fireflies and then spent days pondering how they do it. It seems to be much simpler than one would think. To me, beautiful simple things make life even more amazing. Iva
Samhain_HF
10. May 2012Hi Alex,
I’m going to make a SMD version, Is this necessary
to place sfh3310 (or LDR in previous) under LED?
also SMD LEDs are strongly bright, whats you opinion about it?
Alex
11. May 2012Hi Samhain,
I thought of an SMD version too, but there is one problem to solve.
You need the light to go from the LED to the photo transistor. If you are using standard LEDs (120° or 160°) soldered to the board and the photo transistor soldered to the board as well, then you will need some kind of reflective cover over all fireflies. Otherwise one firefly will not be able to “see” others.
Maybe soldering the photo transistor with long leads (1cm-1.5cm) and then bent it over, so it’s facing down.
If you are not placing the receiver beneath the LED, you will have a preferred direction, e.g. if you place the LED left of the receiver, the receiver will always see the firefly to it’s right easier than the one on it’s left.
If you build some, I would be great it you share some pictures.
Cheers,
Alex