Instructables
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 1: About this Project

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.
1-40 of 181Next »
krummrey3 months ago

Has anyone tried to make this with an Arduino?

I have digispark (http://digistump.com/products/1) and a LED Charlieplex Shield (http://digistump.com/products/13) lying around. driving 20 fireflies with one board would make an impressive lightshow.

Or are there more PWM ports needed?

djsfantasi8 months ago
Do you randomly select the wires to be joined into two wire bundles? Or do you want one wire from the three wire bundle connected to Pin A and one from the three wire bundle connected to Pin B? Or is there some other scheme?

No, it cannot be random. This caught me up also, you really have to wire it exactly as the schematic describes or it won't work. You can read the specifics above, but basically:

PIN_A and PIN_B must each have three LEDs attached to them on the anode/positive side, so you have 2 "bundles" of LEDs, each with 3 LEDs.

PIN_C, PIN_D, and PIN_E must each have one LED from the PIN_A bundle, and one LED from the PIN_B bundle attached to them on the cathode/negative side.

vevolis2 years ago
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!!!
jcrews5 vevolis11 months ago
I feel like we may have jumped into the same boat. I was wondering if you could tell me what you used to program the chip? I am looking at the Pomona 5250 clip but I'm not sure what I'm supposed to be plugging that into?
Hi, Could you perhaps furnish your Mathematica notebook that you used for formulating the lookup tables?
l2jc1 year ago
I've tried using ten strings and the 4 LEDs on pins E and D stay on constantly until the main ones driven from A and B are turned on. Any ideas on the issue?
frollard1 year ago
Fantastic ible -- I'm just now soldering some 0603 leds to magnet wire myself - its a nightmare!
My method of choice is based on this ible - mount led in tweezers, mount tweezers in clamping helping hands, but I hand-hold the magnet wire. by resting my hand mid-knuckle on the brace of the clamp, I can use just one knuckle of articulation to adjust the wire. I found it easier than manipulating a helping hand clamp with the wire mounted in it. Loosely free-handing the wire is near impossible while also wielding the soldering iron.

Do you do anything special to insulate the bare ends of the leds? I'm thinking clear enamel or conformal coating to add some robustness.
amillen1 year ago
I'm having the same troubles as Anders, I would like to reduce the time between each pause. Can anyone help? I'm comfortable making changes to the source code and making a new .hex file, I'm just not sure what needs to be changed. If someone would please help me out I would be willing to share the source and .hex files for everyone else.
Horrible late :)

But i have done one now and it seems like its a big pause, about 30 seconds sometimes, can i shorten that? or can anyone good with codes send me a update?

otherwise it works perfectly.. after that intense soldering, my god, it was a job for the hubble.. tel... microscope :)
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?
bgrablin2 years ago
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.
milokp7 years ago
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.
mhespenh milokp7 years ago
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
pben mhespenh4 years ago
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.
scottinnh pben2 years ago
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...
nshm2 years ago
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
ueiservice2 years ago
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
essplode3 years ago
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
rainger7 years ago
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!
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/
Most everywhere is backordered on ATTINY45V-10SU-ND. Would any of the ATTiny45V's work?
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.
tsteward3 years ago
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!
Yay! I got it to work!
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
akcam20064 years ago
This thing works great, one silly question. How do I make it use song one instead of song 2?
brennendaly4 years ago
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
I was gonna use a cheap solar light, take out the solar cell, photo cell, and accompanying circuitry.
 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! :)
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
Keso (author)  fireninjahokage4 years ago
 Yes, that chip should work fine
Mycroft21527 years ago
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.
i was thinking the same thing, i know this is an older post, but did you ever end up trying this out?
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
Are you still offering the programmed chip kit? If you are I'd be interested in probably 4 preprogrammed chips. Thanks ~Corry
nshm4 years ago
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
seraphima nshm4 years ago
This is a great idea, but how do you get the floats open? Do you drill the top of them? What kind of bit?
nshm seraphima4 years ago
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
seraphima nshm4 years ago
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.
1-40 of 181Next »