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

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

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

Comments are closed.