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.
Links
- 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