If you like the emergence of visual patterns, be it natural or man-made, one you’re bound to be impressed by 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 (kind of). The author was triggered to propose this circuit to Elektor following the publication of “Fun with Fireflies” in the April 2010 edition . The version shown here employs an ATtiny13 microcontroller and just one RGB LED and should be cheap and easy to build in large numbers. The RGB firefly does not move around, a doses color to express its mood. If all is in sync, it will flash in relaxed and cool blue.
If it detects flashes that are not in sync, it will get a bit uncomfortable and the color will slightly change to green, yellow and red. Note that ever y firefly acts completely autonomously, i.e. not ‘obeying’ or trying to achieve, a pre-programmed pattern. As you build more fireflies and allow them to interact, they become increasingly a self-organizing system — strength and fun are indeed in numbers! The firmware running in each firefly determines its behavior, based upon light levels measured by an SFH3310 phototransistor. Talking software now, each firefly has a value that represents the power to flash.
This value rises over time. If the power reaches a certain limit, the firefly flashes and the power is reset to zero. If the firefly detects another flash nearby, it increases the power by a small boost value. That way it will flash slightly earlier than last time. Doing so over and over again may lead to all fireflies flashing in sync — and prove the concept of robotic swarming . The main parts in the circuit are the microcontroller, the light sensor and the RGB LED. The sensor and R4 form a potential divider, whose voltage level is read by the ATtiny13 microcontroller through an ADC channel at pin 3. The circuit is designed for a 5 V power supply and has no integrated power regulator. The supply voltage is taken from a ‘rail’ created by plug-ging firefly boards to form a row using plug/socket pairs JP1 and JP2 (i.e. these are not jumper positions).
Various types of photoresistors exist. Two different versions were tried and found to work well. Only resistor R4 has to be adjusted in a way that gives a good range of voltage and still limits the current through the photoresistor. Recent experiments showed that a phototransistor outperforms both photoresistors and LDRs. Compared to the LDR, it does not have a memory effect and reacts faster (~5 ms compared to ~50 ms). Eventually, the SFH3310 was chosen and 100 kΩ for R4. One thing to remember while choosing a light sensor is that the spectral sensitivity of the sensor has to match the human eye sensitivity (~400 nm – ~700 nm). The software developed for the RGB Synchronizing Fireflies may be downloaded free from the Elektor website , compiled and blown into the ATtiny chip via ISP header K1. Readers without access to a suitable programmer may order the ready-programmed ATtiny13(V) chip from Elektor as item # 100358-41.
The construction and use of clusters of these little electronic creatures is copiously illustrated by pictures and a video on the author’s website ,, which also provides leads to obtaining kits for this ‘embedded-in-biology’ project, or is the other way around? www.elektor.com/100014  www.elektor.com/100013  www.elektor.com/100358  http://tinkerlog.com/2009/06/25/64- synchronizing-fireflies/  http://tinkerlog. com/howto/synchronizing-firefly-how-to/