loading

This is a fun, beautiful and inexpensive project that makes a great gift! I first started making these over a year ago and my original prototype (and many others) are still running strong.

Building a firefly jar only requires an hour or two of your time, and ever the fan of creative re-use, many of the parts can be recycled from old electronics and things around the house.

To do this project it's helpful to have some Arduino and soldering experience.


Hardware:

* an ATTiny85 (ATTiny85-20PU, or tiny-based board, like Trinket)
* Some addressable LED pixels (I'm using these, but there are

many possibilities.

)
* 1 .10uF capacitor

* low value resistor (100, 220, 470 Ohm worked fine)
* a piece of perf board or a PCB
* a 5V wall wart (old cell phone power supplies!)
* a mason jar (used pickle / spaghetti sauce / mason jars)
* diffusive material (Used shipping materials: bubble wrap, tissue paper. Paint, glass frosting, possibilities are endless)
* An AVR programmer (like the USP Tiny ISP)
* breadboard and soldering supplies are helpful!

Software:

* Arduino
* Tiny core
* Adafruit NeoPixel (or FastLED) library

This Instructable shares some things in common with my other one written about ATtiny -- if you want a more in-depth primer on using this small microcontroller with addressable LEDs read that one first!

If programming an ATtiny seems like too much you could make this project happen with something small like (ATtiny85-based) DigiSpark or Trinket.

Update: I created a repository for firefly jar code and schematics.

Step 1: Setup Your Software

1. Download and Install Arduino

2. Download and install the Tiny Core (instructions), you need ATTiny85 8Mhz or 16Mhz support!

3. Download and install the NeoPixel library (Copy it to your Arduino sketches folder /libraries/)

Step 2: Program and Test Your ATTiny

Setup your ATTiny on a breadboard.

Wire your ATTiny to the programmer as shown in the schematic. Note the dot on the IC, this is pin 1!

In Arduino choose the example sketch from the NeoPixel library > standtest.

Change the initialization

Determine the number of pixels you are using and change the data pin to 4

Adafruit_NeoPixel strip = Adafruit_NeoPixel(5, 4, NEO_GRB + NEO_KHZ800);

Upload and test

With ATTiny85 8Mhz or 16Mhz (Internal Osc) selected in Tools -> Board, test and upload your sketch! If it doesn't work immediately you most likely need to set the fuses on the ATtiny. You'll only have to do this once per microcontroler, with the 8 or 16MHz option set, choose 'Burn Bootloader' option in Tools, then try uploading your sketch again.

Create patterns

Create your own patterns to run on your firefly jar!

Schematic from Fritzing via harizanov

Step 3: Prepare the Jar & Adapter

Cut off the connector end of your old power adapter, separate and strip the red and black wires. Test the voltage and polarity with your multimeter.

Poke a hole in your jar lid with a nail or sharp object (careful!) and thread the cord through.

For strain-relief you can tie the cord in a knot.

Step 4: Solder Your ATTiny and Components

Solder your ATTiny to a piece of perfboard. Include a decoupling capacitor across the power supply and a small value resistor. If you want your install to be more flexible install a 8-pin DIP socket so you can remove and reprogram the microcontroller later.

Attach the your power and ground lines you threaded through the jar lid to this circuit.

Step 5: Assemble Your Jar

Assemble your jar and distribute your LED pixels evenly.

I've found filling it with packing peanuts, bubble wrap, tissue and scrap paper works very nicely and creates some interesting effects. Reflective plastics and broken glass can also be fun.

If you're feeling very ambitious you can glaze the jar or buy some paint and use that to give it a more translucent look.

Plug your jar in and enjoy the beautiful patterns!

Step 6: Bonus: Make It a Touch Lamp!

And that's not all... bonus round :)

Using the Capacitive Sensor library and two pins on your microcontroller you can make your jar a touch lamp.

There are a few extra requirements to do this, mainly your jar will need a metal lid (or a piece of metal underneath your lid), and you'll need to connect two wires to either side of that lid (screws work well as an attachment point).

Getting this to work may involve a little trial and error on your part, some lids are coated, so you may have to do some sanding to get a good electrical connection, but it's an awesome effect.

Hardware:

* two screws or something metal to attach wires to a jar lid

* two more pins on your ATtiny

* 1 high value resistor -- 1M Ohm or greater to place on the output pin

* 1 resistor with a value of 1000Ohm or so to help protect the input pin from static electricity.

Software:

* Capacitive Sensor Library (learn more about how it works)

* Adafruit Neopixel

Here is one example sketch for touch. Some tweaking of TOUCH_THRESH and TOUCH_DELAY may need to be done to work with the particulars of your jar.

Step 7: Bonus: Use a Printed PCB!

I wanted to make these as holiday gifts for friends and family and did not want to do all of that soldering to perf-board. So I made a simple PCB to ease my construction process.

I added a diode to prevent reverse power hookups and programming headers so you can change the ATtiny code right on the board.

I have a prototype using this PCB that has been running every day for nearly a year now and these jars have survived falls, kids, animals, burning man ---- and keep on running!

If you would like to use my PCB, you can order sets of 3 via OSH Park. I welcome collaborations and improvements to this board. If you're looking for a single board or kits, get in touch, if there's enough interest I'll do a run of them! If you hold a workshop to build these or make a cool variation on this design I'd love to hear about it.

<p>This project was so much fun and I learned much about electronics and programming (particularly through troubleshooting). Thank you for all of the resources. </p><p> I made a gift for someone special and I am very proud of this piece.</p>
<p>Aw, yay! Thanks for sharing and great build pictures!</p>
<p>I'm having a little trouble with this and was wondering if someone can help me out. My LED's came in a strip of about 50. Would i simply just cut them in 4 or 5 to fit into the Jar? Also, Each LED has two ends to it (6 wires). I understand 1 goes to VCC, 1 to GND, and another to pin 4. Where do the other 3 go to? Same place? Can someone draw up a little bit of a detailed schematic to help me out? Thank you. I appreciate it. </p>
<p>Yes, you can cut them at whatever length you'd like! <br><br>Look for the arrow on your led pixels or strip, it should point AWAY from your microcontroller. The three 'outgoing' wires at the end will remain unconnected (you can cap them or just clip them so they're sheathed).</p><p>Let me know if you have any other questions!</p>
<p>Thank you so much! I'll give it a try soon. </p>
<p>Would it be possible to build this on an Arduino. or a small Arduino like the Digistump? That would be a lot easier for a lot of us. No need for an extra programming device. It would get a lot bigger and wouldn't fit into a jar anymore.</p>
Absolutely! Trinket, Gemma, Digispark are all ATtiny based and will work. Arduino &amp; variants are fine too.
<p>Instead of a wall wart can I run this off of a DC power source? Say a 9 Volt battery? With a 4 Volt ? Watt resister??? </p>
<p>You can totally run it off of a battery. You could use a 9v with a step-down or voltage regulator, I'd recommend hiding some AAs or lithium ion or a USB battery pack inside.<br><br>If you're using the touch sensor function on a battery read the notes on grounding here: http://playground.arduino.cc/Main/CapacitiveSensor</p>
<p>Fantastic!!! I'm on a tight budget. If I used AAs would 3 at 4.5 volt total work? would I need to adjust anything on the curcit board? or 2 3v hearing aid batteries at a 6v total? </p>
<p>One last question. Thanks so much for the help. This is my first project of this type. I ordered the PCB chips, and I was wondering what specific diode you used. <br>Thanks!</p>
<p>I used a Schottky Diode (1N5819) as it has a lower voltage drop, but a 1N4001 would work fine too. My jars only use 5 lights, if yours use more you'll probably want to find a diode rated for more current. You can also bridge the diode area with a wire, but only do that if it's going to be used somewhere where folks won't accidentally reverse polarity.</p>
<p>The lights and micro-control should work fine at 4.5V -- I think I've run them as low as 3.3V. 6V is probably a tad too much. </p><p>With batteries, one thing to watch for: when you program your ATtiny, choose an 8Mhz board/fuse settings, the 16Mhz setting has <a href="http://www.insidegadgets.com/2011/02/01/building-a-standalone-temperature-logger-part-5/" rel="nofollow">brown-out detection</a> that's set at 4.3v!</p>
<p>was wondering if there is a way to 'string' them together and hang them in trees in the yard for outdoor evening lighting?</p>
<p>That's a great idea, I think there are a bunch of different ways you might do this:</p><p>Have a single controller somewhere and connect your jars in a series --- you'd string non-lighted power, gnd and signal lines between each. Or if you don't have too many jars you could run multiple signal lines in parallel from your controller.</p><p>Or you could make each jar independent and use some kind of sensor to vary the output, maybe based upon movement, or light, or the environment.</p><p>If you build something like this please share it!</p>
<p>Any thoughts on integrating this project with Keso's Jar of Fireflies:</p><p><a href="https://www.instructables.com/id/Jar-of-Fireflies/" rel="nofollow">https://www.instructables.com/id/Jar-of-Fireflies/</a></p><p>This one certainly seems easier to construct, taking advantage of more modern components than from when that instructable was authored.</p>
<p>Hey, thank you for sharing this, very cool, and I love how it uses ATtiny as well! I was just starting to experiment with LEDs at the time this was written, it's neat to see how components have evolved. </p><p>This makes me want to make a pattern modeled on firefly behavior, or create a collection of jar lamps here on Instructables (I know this has a long tradition in electronics)!</p>
<p>Interesting one...got to try it !</p>
Man, this is really cool!
<p>How much did the PCBs cost?</p>
<p>I shared the design on <a href="http://oshpark.com/shared_projects/p76iCXLt" rel="nofollow">OSH Park</a>, they charge $7.85 for a set of 3. If there's interest I'll do a larger run, I'm also working on a surface mount version!</p>
<p>I like this idea for a gift. Thanks for sharing</p><p>sunshiine</p>
<p>Thank you! Everyone I've given one to has really loved it. And I have some other fun variations for the future :)</p>
<p>These are awesome!!! They look very bright, and for some reason I imagined how cool these would look if you made them waterproof and dropped a few in a pool at night!</p>
<p>Thank you, they are surprisingly bright for so few LEDs. If you build a version for the pool I'd love to see some pictures!</p><p>A few friends who do sculpture have cast or embedded these lights, a version of this circuit, into their projects -- it really fun stuff.</p>
<p>These are gorgeous!</p>
<p>Thank you!</p>
<p>They look awesome! great work :)</p>
<p>Thanks!</p>
<p>Nicely done! Thats a good looking PCB you have there.</p>
<p>Thank you! This is the third PCB I've tried to design, all things considered it turned out pretty well :)</p>
<p>If you want people to etch their board by themselft you might want to try to do a single sided layout, which should be possible due the wide spacing between all THD components. The other layer can then be a ground layer which should reduce emitted noise (EMI). </p><p>Furthermore you might want to shrink the board a bit so it fits into the jar even better. I personally dislike vertical resistors as they tend to bend over if you're not careful. A horizontal of the resistors can also slim also the degisn down a bit.</p><p>When routing you generally want to keep the tracks as wide as possible but as small as needed. Wider tracks lower the resistance proportionally and therefore reduce power loss. For simple signal lines, which carry often less than 1mA, this is totally ignorable, but at least the supply lines should be a bit wider. Wider traces are also benificial for manufacture (only if you do it yourself) because less copper needs less valueable solution to etch it away. A nice touch is routing all traces in 45&deg;, your board will not only lokk tidier and more professional in an instant, but also the tracks will be shorter resulting in a lower resistance.</p><p>It would be realy cool if you'd like to try out a smd version of that circuit. Soldering isn't that hard with a bit practice and could shrink down the whole ciruit to a thumbnail sized board.</p><p>Anyway great instructable, the RGB LEDs and the touch feature are a nice addition to a rather classic design. I just hope that were enough ideas to improve the board ;) </p>
<p>Thank you, these are great suggestions, and I really appreciate the constructive PCB design feedback!</p>

About This Instructable

42,620views

457favorites

License:

Bio: Sharing knowledge and ideas. Constantly learning!
More by danasf:Intel Edison and Addressable LEDs Internet of Ducks Lighting In A Bottle 
Add instructable to: