3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Jar of Fireflies

Jar of Fireflies
«
  • Firefly3.jpg
  • Firefly.jpg
This project uses green surface-mount LED's along with an AVR ATTiny45 microcontroller to simulate the behavior of fireflies in a jar.



(note: the firefly behavior in this video has been greatly sped up in order to be easier to represent in a short film. The default behavior has significantly more variance in its brightness and delay between plays.)

 
Remove these adsRemove these ads by Signing Up
 

Step 1About this Project

About this Project
«
  • Mounted-on-jar-lid.jpg
  • firefly_board.png
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 between 4 to 10 months, depending on the song pattern used. RIght now the source comes with two patterns, song1 and song2, with song2 as default. Song2's estimated runtime is 2 months, song1's is 5 months.

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.
« Previous StepDownload PDFView All StepsNext Step »
173 comments
1-40 of 173next »
May 15, 2012. 12:57 PMAnders730917 says:
Hi!
i'm doing a couple of jars for my balcony, i bought enough components for 10, so I did a trial run, and soldered everything on, programmed the attiny and just going to test it with one led, so i attached the batterypack and the led is lighting up, but its just on and off, no fading at all.

What could be the problem?
Jan 5, 2012. 6:26 AMbgrablin says:
I have a couple of these boards for sale. ATTiny45 is per-programmed with the provided script. Email bgrablin at gmail.com, if anyone is interested.
Dec 22, 2011. 1:58 PMvevolis says:
This project took me WEEKS to figure out (mostly in terms of programming the ATTINY45 & the fact I've barely soldered before, let alone micro LED's and hair-thin wire), in the end I will make eight jars for this holiday season, I've completed three so far. This is an excellent instructable!!!
Mar 15, 2007. 11:57 PMmilokp says:
Awesome project. I intend on building this at some point. Probably using thru-hole chip and resistors, but thats based on my preception of my solder skills. Any way, power! I've been looking for a use for those self charging luminares they sell to line driveways and the like. Basically, it's a solar cell mounted on a pole with an LED and a rechargeable AA or two below. I've seen them for 8.00 USD at wal-mart and the like. Seems you might be able to tap its charger circuit for on/off detection too.
Jun 4, 2007. 10:26 AMmhespenh says:
That is a good idea- the only problem you're going to run into is power (or more specifically, a lack thereof). Those things usually only run on a single 1.5V (or less) "AA" which between the uC and all the LEDs probably won't be quite enough voltage. You certainly could make it work, but you would have to mess around with the circuit some, and might just be better off buying a solar cell and rechargeable battery to run it all. Something on the order of ~3V should be sufficient (that's what mine uses). HTH- Michael
Jun 6, 2010. 10:22 AMpben says:
You will need a simple boot regulator Polou has a 1.5 to 5V assembly for $5.45 http://www.pololu.com/catalog/product/798 It will supply enough current for this project. You could build it up from the NCP1402 for less but the Pololu board is so small and convent. I have used these for some LED projects and am seriously thinking of building a solar version of this project with the Polou board and a salvaged solar cell.
Dec 11, 2011. 11:26 AMscottinnh says:
I realize I'm replying to an ancient thread (and the original questioner is long gone), but this is a very popular instructable.

The Polou boost circuit is a great suggestion. It is small, very efficient, and low cost.

An alternative (lower cost) idea is to use a MAX756. Should be noted though, in QTY 1 a max756 is almost $5, but Maxim is very liberal with free samples (I even put "Hobbyist" in as my company name, though I did use a business email address). An advantage is the 756 can be configured for 3V so you can use smaller resistors and power lasts longer.

But it may be easier to get the solar charger to charge 2 batteries...
Nov 6, 2011. 10:22 PMnshm says:
I had an awesome time making these as a wedding decoration and put together a custom firefly PCB. You can check it out here:

http://www.instructables.com/id/Wedding-Firefly-Fishing-Floats/

Thanks Keso!

-Nick
Oct 20, 2011. 1:34 PMueiservice says:
Great project. Anyone willing to make me 2 and get paid ? I have an upset girlfriend (love of my life) . Sounds silly but little things arem what make her happy. Favorite new song The Band Perry All Your Life refrences catching fireflies. Anyway. I want to do something really special for her and I'm afraid it will take me a couple weeks to get parts and assemble.

Don't want to sound desperate but I am. I relly love her and would like to give her a jar of sand from the edge of the ocean and a jar of firelies : )

I'll pay any fair price if someone has one made or would be willing to make.

Thanks in advance to all
Mike ueiservice@yahoo.com
Sep 14, 2011. 11:45 PMessplode says:
I FINALLY got this to work :)

Thanks so much for this instructable. It was a lot of fun to build and very rewarding once I got it to work.

If anyone needs help with the programming feel free to contact me
Mar 9, 2007. 9:53 PMrainger says:
I guess I am more novice than I thought... How do you insert this source code? I've never worked with programmable ICs before. Great project! It will make for a great gift, and maybe start an interest in tech for my kids/nephews!
Apr 5, 2011. 10:39 AMcailtin_1 says:
you need a programmer (for example avr dragon)

http://www.instructables.com/id/Help%3a-An-Absolute-Beginner-s-Guide-to-8-Bit-AVR-Pr/
Nov 22, 2010. 5:43 AMscottconnerly says:
Most everywhere is backordered on ATTINY45V-10SU-ND. Would any of the ATTiny45V's work?
Dec 2, 2010. 1:13 PMkjordahl says:
Any ATtiny45 should work, but if you want to use the same proto board it needs to be SOIC form factor. You can also use an ATtiny85, there is no difference except it has double the flash memory.
Oct 13, 2010. 9:43 AMWINTER14 says:
Awesome instructable! I can't wait to build it! I also have an idea for another project based on this one, but it will require different code. I'm an engineering student taking C/C++ right now, but after reading your code I'm at a loss. I understand the basic if/else, structure, etc, but I don't think I could write something quite that complex yet. Is there a website you could recommend on programming microcontrollers for LED's? Preferably in C or C++? Thanks
Oct 1, 2010. 11:36 PMtsteward says:
This is by far the best instructable I've had the pleasure read. I built one based on your excellent and detailed instructions however, I've got several days spent on crash course researching how to program! I think I've installed just about every programming software available and yet I still can't figure out how to transfer the program code you supplied into any of the programs I have installed! Is Vista the issue or am I just not understanding something?!! I'd love it if someone could shine some light on this for me!
Oct 3, 2010. 6:26 PMtsteward says:
Yay! I got it to work!
Oct 10, 2010. 6:19 PMRabbidSquirrle says:
HOW!?!?!?!?! I still can't get it to work. What program did you used and what Programmer? My computers are running XP Pro, and I've got the Pocket AVR Programmer (http://www.sparkfun.com/commerce/product_info.php?products_id=9825) from Sparkfun.com Thanks ~Corry
Sep 5, 2010. 8:18 PMakcam2006 says:
This thing works great, one silly question. How do I make it use song one instead of song 2?
Jul 23, 2010. 7:04 AMbrennendaly says:
could one easily switch out the battery with a solar panel? if so, could you recommend any parts? i just think it'd be great if it we could leave it on a window sill and have it turn on and faded out every evening
Aug 5, 2010. 11:31 AMRabbidSquirrle says:
I was gonna use a cheap solar light, take out the solar cell, photo cell, and accompanying circuitry.
Dec 1, 2009. 8:20 PMfireninjahokage says:
 hey I'm looking to make one of these, but Digikey is out of the Microcontrollers you suggest. Would this one work instead of the ATTINY45V-10SU-ND? Could someone get back to me asap? I wanna make some of these for Christmas presents. Thanks! :)
Jul 29, 2010. 4:42 AMMouseZA says:
Hi, Im not in the US and an unable to get the chip you have in your parts list. Would this work as a replacement ? http://www.mantech.co.za/ProductInfo.aspx?Item=128-8352 I have no programming or electronics experience so any help will be greatly appreciated Thanks
Mar 2, 2007. 11:40 AMMycroft2152 says:
Great project. I can see building a few as gifts. For a solar powered version, why not hack one of the cheap ~$5 solar garden lamps? They have the solar cell, battery and circuitry inside. You could use that to power the Fireflies and sense light levels too. The guts should all fit nicely under the mason jar cap. The output of the solar lamp is usually pulsed, there is a circuit on the web to make it into a 5 volt supply.
Jul 23, 2010. 1:17 PMbrennendaly says:
i was thinking the same thing, i know this is an older post, but did you ever end up trying this out?
Jun 26, 2010. 10:27 AMRabbidSquirrle says:
I'm trying to program the chip with the usbtiny from sparkfun and using programmers notepad, but it keeps coming up with " > "make.exe" program makefile:227: warning: overriding commands for target `.c.o' makefile:222: warning: ignoring old commands for target `.c.o' make.exe: *** No rule to make target `program'. Stop. > Process Exit Code: 2 > Time Taken: 00:01 " I am new to programming and would appreciate any help, tryin to make this as a birthday present for my wife, if I get it working I'm gonna make three more for my nieces. Thanks ~Corry
Jun 29, 2010. 9:55 AMRabbidSquirrle says:
Are you still offering the programmed chip kit? If you are I'd be interested in probably 4 preprogrammed chips. Thanks ~Corry
Apr 14, 2010. 9:49 AMnshm says:
My favorite instructable so far! For our wedding, my Fiancée and I purchased glass floats (see here, did not pay that much though!) and I have 20 of them. I'd like to make 20 firefly glass floats as decorations, and I have a few questions.

First, digikey does not have any tiny45s in a 9081 footprint, are there other similar chips I can use (I know I'd have to modify the code slightly). A second option that I'm seriously considering is to use expressPCB and make a custom board. 

Second, I only have a 1" hole to insert my firefly leads through. I need to find a way to distribute them throughout the sphere. Anyone have any ideas besides using double sided tape?

Thanks!
Nick
Jun 3, 2010. 4:44 PMseraphima says:
This is a great idea, but how do you get the floats open? Do you drill the top of them? What kind of bit?
Jun 9, 2010. 3:02 PMnshm says:
Great question, fortunately the floats come with a hole pre-drilled! It's actually an artifact of the glass-blowing process I think. There's probably a way to do it with a masonry or other abrasive bit. I've completed my first float, and have decided to custom print a pcb that will solder directly to the battery holders I've ordered. If anyone is interested I think I will have enough parts left over to offer a few "kits" with programmed chips (it will be a couple months before it's all said and done though). I'll also provide photos and video when I'm finished. Nick
Jun 9, 2010. 5:14 PMseraphima says:
I am thinking of doing this with the teen youth group. I will want some kits, if you are not asking to much for them. I am not ready to go teach myself basic programming yet, so this will be a big help in that direction.
Apr 15, 2010. 9:08 AMkjordahl says:
1. Use an ATtiny85.  It is pretty much identical, with twice the flash and only costs about 10% more ($2.15 instead of $1.94 in small quantities from digikey).  You won't have to modify the code at all.

Jun 8, 2010. 10:37 AMdaniel2008 says:
very nice instructable, well explained and phgotographed
Jun 6, 2010. 7:42 PM3tones says:
In my latest jar, I used a CR123 3V lithium battery. I wasn't too pleased with the life of the CR2450, and had AA's strapped to the top of my first jar. The CR123 fits nicely at the top of the jar.
Jun 6, 2010. 7:33 PM3tones says:
I found it easier to attach the wire to the top side of the LED. I put the wire perpendicular to the LED, and rest it in the corner (see the picture for a close up of the LED.)
Jun 6, 2010. 8:02 AMbdauterive says:
Too bad there is not a kit available for this...Any thoughts on putting one together and selling them?
Jun 6, 2010. 7:20 AMjolshefsky says:
Great project and amazing photographs. Thanks for taking the time to make non-blurry, well-composed, and detailed pictures!
Dec 29, 2009. 9:02 PMkjordahl says:
Great instructable!  I finally built it, and wrote my own firmware for it to exhibit more complex behavior, with male and female fireflies flashing and responding to each other.  I have posted more details in a new Instructable, and also documented it on my web page.  Thanks for the detailed instructions here to make it possible.
Mar 31, 2010. 8:52 PMpmcall221 says:
Thank you so much for posting your own firmware.  I can't tell you how long I have scoured the net looking for something that mimics the fireflies around here in the Midwest.  Almost everyone I have found is a basic blinky.  This was my first with avr programming and the build instructable could not go easier.  Thank you keso and kjordahl.
1-40 of 173next »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
21
Followers
1
Author:Keso(Synoptic Labs)