Synchronizing Fireflies

Posted by on May 11, 2007 in avr, instructable, led, simulation | 21 Comments

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

IMGP1171

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.

IMGP1200

Here is a video. It is a bit dark as my camera is not very suitable for this.



Click To Play

Links

21 Comments

  1. Randy
    11. May 2007

    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)

  2. Chad
    11. June 2007

    The leds are very mesmorizing to watch. Cool project.

  3. SPman
    23. June 2007

    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.

  4. Alex
    24. June 2007

    Thanks for stopping by.
    And your site helped me a lot with my beginner problems ;)

  5. Electronics-Lab.com Blog » Blog Archive » Synchronizing Fireflies
    2. October 2007

    [...] Fireflies – [Link] Tags: Led Filed in [...]

  6. Terry
    9. December 2007

    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?

  7. Dom
    18. January 2008

    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

  8. Daily DIY Network - Science Projects Plans Guides » Blog Archive » Synchronizing fireflies
    28. March 2008

    [...] Check out the Synchronizing fireflies [...]

  9. C. Coffman
    28. March 2008

    I wonder if this has any similar emerging properties to cellular automata. Some of the patterns it produces look similar to that.

  10. Alex
    28. March 2008

    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.

  11. aaron
    28. March 2008

    Awesome. So neat to see them all start to really synch up 2/3 of the way through.

  12. Robert Louis Carpenter
    29. March 2008

    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.

  13. 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 [...]

  14. 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 [...]

  15. 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 [...]

  16. Eric
    12. December 2010

    Probably 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?

  17. Alex
    13. December 2010

    Hi Eric,
    please double check if you burned the fuses correctly.
    Cheers,
    Alex

  18. Eric
    13. December 2010

    Hi Alex, they are alive!! work beautifully

    Thanks for this Instructable, the best…

    Eric

  19. Iva
    11. June 2011

    Thank 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

  20. Samhain_HF
    10. May 2012

    Hi 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?

  21. Alex
    11. May 2012

    Hi 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