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

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.

Links

21 Comments

  1. 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)

    Like

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

    Like

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

    Like

  4. 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?

    Like

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

    Like

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

    Like

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

    Like

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

    Like

  9. 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?

    Like

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

    Like

  11. Hi Alex, they are alive!! work beautifully

    Thanks for this Instructable, the best…

    Eric

    Like

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

    Like

  13. 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?

    Like

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

    Like

Comments are closed.