Jar of Fireflies

Jar of Fireflies

Here’s an amazing AVR project! Thanks for sending this in Kayobi!

The inspiration for this project comes from having never lived in an area where fireflies were common and being deeply fascinated whenever I encounter them in my travels. The flash patterns have been digitized from firefly behavioral research data found online and were modeled in Mathematica so that variations of speed and intensity could be generated. The final output was transformed by a lightness function and written into header files as 8-bit PWM data.


The software is written in avr-gcc C and source code is provided along with a pre-compiled .hex for convenience. The code has been significantly optimized for efficiency and to minimize power consumption. Crude runtime estimates predict a 600mAh 3V CR2450 battery should last in excess of 3 months — likely *way* in excess of 3 months as my last calculations were based on some rather outdated assumptions and I haven’t yet gotten around to re-running them.

This project involves a fair amount of surface-mount level soldering. However the circuit design is trivial and the fact that we’re able to use an off-the-shelf SMD prototyping board rather than having a custom PCB made greatly saves on cost. It would be very simple to create a non-surface mount version using the PDIP version of the ATTiny45 and through-hole LED’s. The cost of the electronic components comes in at around $10-$15 (after shipping) or so and assembly time is on the order of 2 hours.Link

12 thoughts on “Jar of Fireflies

  1. Ms.Fire says:

    I was the lucky recipient of one of these, and I have to say that the video doesn’t do it justice!

  2. paulsw says:

    Great photography, great documentation and a great project. I also like the inclusion of ‘appendix’ pages that discuss the schematic, supply the source code and explain how some of the photography was done. 10/10

  3. gear_head says:

    This is such a rookie question but please excuse a mechanical guy for asking it. I’m interested in making this project for my son but I know nothing of programming these type of devices. Could anyone recommend a source of instruction so that I learn how to do it? Many thanks.

  4. tms10000 says:

    Mr gear_head,

    You probalby want to ask this question in the make forum, signup is easy and from experience, I can tell you there are a lot of helpful people wanting to help you.


  5. TimThornbrough says:

    Long time reader, first time poster….
    I think that this looks to be a fantastic project. One slight mod I would like to see is a light sensor added so it comes on only at night like fireflies would. I will post the question and get back if there are any results.

  6. electronbeat says:

    I seem to remember this project making the blog rounds once before when it was created by John Schimmel.

Comments are closed.

Discuss this article with the rest of the community on our Discord server!


Maker Faire Bay Area 2023 - Mare Island, CA

Escape to an island of imagination + innovation as Maker Faire Bay Area returns for its 15th iteration!

Buy Tickets today! SAVE 15% and lock-in your preferred date(s).