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




May 11th, 2007 at 20:02
hey,
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)
June 11th, 2007 at 00:49
The leds are very mesmorizing to watch. Cool project.
June 23rd, 2007 at 19:26
Looks 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.
June 24th, 2007 at 09:07
Thanks for stopping by.
And your site helped me a lot with my beginner problems
October 2nd, 2007 at 21:52
[…] Fireflies - [Link] Tags: Led Filed in […]
December 9th, 2007 at 15:08
Amazing.
I work at radioshack.
Suppose I had to make this completely with Radioshack Parts.
What would I need and what would the connections be?
January 18th, 2008 at 05:05
well, 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
March 28th, 2008 at 11:00
[…] Check out the Synchronizing fireflies […]
March 28th, 2008 at 12:06
I wonder if this has any similar emerging properties to cellular automata. Some of the patterns it produces look similar to that.
March 28th, 2008 at 12:31
Yes, 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.
March 28th, 2008 at 17:33
Awesome. So neat to see them all start to really synch up 2/3 of the way through.
March 29th, 2008 at 06:47
Have 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.
March 29th, 2008 at 10:36
[…] 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 […]