Things in nature tend to synchronise. At the heart of synchronisation are individuals following simple rules with localised responses to their nearest neighbour. What emerges can be complex and beautiful. This project prototypes some LED fireflies that flash with their own frequency but will try to flash in unison with other fireflies, if they can see them.
produced by: Claire Fleischmann
Synchronisation is one of the most pervasive drives in nature, examples include flocking birds, schools of swimming fish and male fireflies flashing. Sometimes synchrony is about defence, sometimes it’s about communication and in the case of fireflies it is about finding a mate.
Fireflies are one of the species where we are starting understand and can model mathematically the mechanism by which synchrony takes place – see https://www.rlocman.ru/i/File/2007/10/24/2006_WSL_Firefly_Synchronization_Ad_Hoc_Networks.pdf. Fireflies are modelled as pulse coupled oscillators which are described by a phase function. The phase function grows linearly over time until a threshold is reached – at that point the firefly will flash and reset its own phase. The oscillator also responds to flashes that it ‘sees’ by ‘boosting’ it’s phase by an amount dependent on its current phase value. The result is that fireflies will start out of synch but will come into synchrony with each other.
I wanted to prototype an experience using this phenomenon. I wanted the end result to be something located in an outdoor space and operated in relative darkness. I also wanted to create each individual firefly such that it would only react to fireflies close by and that it could be switched on, switched off or moved so that as users switch on new fireflies or move existing fireflies to new locations the whole system would change.
As I was keen to create something simple and scalable I wanted to use the ATTiny to create a number of simple firefly units. These would be a proof of concept for an experience involving a larger number of fireflies.
- Each individual firefly needs to
- Track its own phase and emit a flash of light
- Sense the flashes of other fireflies
- Synchronise to those flashes using the pulse coupled oscillator approach
- Have a means to allow users to switch the firefly on and off
- Be portable
I started by looking online for others who had used Arduino to create fireflies.
- SYNCHRONIZING FIREFLIES by alex_weber uses the ATTiny to create a matrix of LED fireflies whose position is fixed in relation to other fireflies. This link was a great place to start.
- JAR OF FIREFLIES by Keso also uses the ATTiny to create fireflies in a jar – however the fireflies are not responding to eachother
I knew that my firefly would need to flash and so needed an LED. I also wanted the fireflies to communicate with each other. I looked at two methods for doing this. The first was an IR emitter and receiver, the second was a simple phototransistor which could pick up the flashes of nearby fireflies.
My first prototype used a single LED, but this did not produce a bright enough flash
I therefore chose to use a NeoPixel ring. I had not worked with addressable LEDs before the module and so there was some attraction to exploring them further. The schematic of the circuit is shown below. The program was loaded onto an ATTiny using the Arduino as ISP this was relatively straightforward but as the circuits required a bit of tweaking in terms of thresholds, and it was difficult to know how they would interact until they were complete, there was a lot of programming the chips, checking how they interacted and then reprogramming. I would like to incorporate a potentiometer in any future version – this would allow me to tweak the phase boost value without having to reprogram the chip – it would also mean that users could actively select how much or how quickly they wanted to synchronise.
This is the prototype of the final circuit
This is the final circuit soldered on to protoboard – time constraints and lack of access to the HatchLab meant I was unable to transfer this to PCB
I chose to house the circuit in a laser cut Corex cube. Partly this was about experimenting with the laser cutter as I had not managed to do that in the previous term. I chose the Corex after experimenting with other materials (see images for results with laser engraved Perspex, sanded Perspex and clear Perspex). I was looking for a simple housing that would diffuse the LED light. The design for the cube was made at www.MakerCase.com with a mounting hole for the switch added later.
This project would be very suited to a PCB approach. To scale the project I would like to reduce the size of the units, which would mean looking at an alternative to the NeoPixel ring. I would also like to look into making the fireflies wearable (perhaps in the form of a badge) so that users would be affecting behaviour as they naturally move around a space.