This firefly jar is rechargeable, runs on a lithium battery, and turns itself on or off at an adjustable threshold of darkness.
BUILD TIME: 2 HOURS
DIFFICULTY RATING: Intermediate
Having covered the LM311 voltage comparator in a recent Classroom, we decided to give it a practical but decorative application. With an LDR as a sensor, the design has a degree of flexibility, both in power source, light source, and the decorative aspects as well.
Everything in this project is available over the counter, and while the electronics can come from any of the main retailers, the other parts of this project came from Kmart. Note that we have no affiliation with Kmart. We chose them on the basis of accessibility, and of course the fact they stocked what we wanted. Few people can’t access a Kmart store either in person or online. Having said that, stock can be an issue for many retailers at the moment, due to the COVID-19 pandemic’s effects on supply chains and manufacturers.
While we have discussed the specific items we used, you can find similar parts in other places. Dollar shops usually stock the same kind of jars, but when selecting one, check carefully that the lid is big enough and the neck wide enough to fit the electronic parts. The lid may fit the electronics but sometimes the thickness of the glass means the lid will not go on with the battery back installed. We also built one into a tealight lantern from Ikea. The LED strings are also available at some dollar shops and some mainstream retailers such as Target, but details differ. Some of the shelved items we saw had mains power supplies, for example. Others have much thicker wiring, resulting in a very different appearance in the finished product.
ABOUT THE DESIGN
The light jar is based on existing ideas. You can find images of firefly jars, which go by a variety of other names too, all over sites like Pinterest. However, all are simple combinations of battery powered light strings and jars. The batteries are usually disposable, and may be AA or AAA rechargeables at best. Switching on and off is accomplished by a switch on the battery housing. This works just fine for many situations, and the author recently spent a term teaching in a primary classroom decorating three such lights. For home use, however, the DIYODE team came up with some improvements.
We decided to make our light rechargeable via a plug-in, rather than removing batteries to recharge them. The 1.5V alkaline vs 1.2V rechargeable (NiCd and NiMH) voltage difference is enough to render the lights noticeably dimmer when using AA or AAA rechargeable batteries. Instead, we have used a USB power bank as the basis for our design. This enables easy sourcing of the appropriate combined Li-ion battery charger and 3.7V to 5V DC-DC converter. Without this avenue, both modules would have to be separate as few suppliers offer a combined version to the retail market.
Additionally, the whole power bank retails for less than most of the DC-DC converter modules we found, even before you add the battery charger module.
This happens to add flexibility, because you can use as big or small a power bank as you can fit in your design. It also provides a great recycling opportunity. As our devices demand more and more power, power banks are getting bigger. Many of us have smaller 18650-based 2000-3000mAh units lying around unused. Some are even promotional items, such was the prevalence of these units. They can still be bought new if you don’t have one.
To this, we added a light sensor based on the LM311 IC and constructed on prototyping board. The existing switch in the battery box from the light strings serves as the master power switch, and a trimpot provides sensitivity adjustment. Maybe you want your light on as soon as the sun goes down, and less-bright artificial light takes over. Unless your modern LED downlights are brighter than the sun, of course. You may instead want your light to turn on only when all the room lighting is off. You can also configure this circuit so that the lights turn off in the dark. Let’s say you want the lights on while entertaining but then want to watch a movie or sport on your TV. The lights can actually be distracting, so sometimes it is better to have lights that are turned on manually before your guests and turn themselves off when the lighting is reduced to watch the screen. The same can be said of the classroom situation. Quite a few times the AA batteries in these original lights needed changing because someone forgot to turn them off when leaving for the night. And yes, that somebody was the author, not a designated student.
Finally, the light source itself. We have used a string of small surface-mount LEDs that have been soldered to fine enamelled copper wire. The LEDs are all in parallel, and the Kmart options are available in 3-metre and 10-metre lengths. We measured the 10m version as drawing 133mA with fresh batteries. Other suppliers have similar lights but as above, be careful, because not all are equal. You could, of course, use something like Jaycar’s XC4468 3W LED module meant for Arduino as a light source for a very different kind of jar light. These work best when decorated inside. We won’t deal with that too much yet. We’ll see what you think of this one and may cover the other style later if it is wanted.
Build Option 1:
Turns ON When Dark
|ELECTRONICS PARTS Required:||Jaycar||Altronics||Core Electronics|
|1 x LM311 Voltage Comparator IC||ZL3311||Z2516||COM-13950|
|1 x BC328 or BC327 PNP Transistor*||ZT2112||Z1030||FIT0322|
|1 x 1kΩ Resistor*||RR0572||R7558||COM-05092|
|1 x 2.4kΩ Resistor*||RR0581||R7567||COM-05092|
|1 x Light Dependent Resistor^||RD3485||Z1621A||SEN-09088|
|1 x 10kΩ 25-turn Trimpot*||RT4650||R2382A||CE07309|
|1 x Doughnut Prototyping Board||HP9550||H0701||FIT0099|
|1 x USB Power Bank||MB3792||-||-|
|CRAFT MATERIALS Required:|
|LED light string|
|Hot Melt Glue Gun|
CRAFT MATERIALS Required:
* Quantity shown, may be sold in packs. You’ll also need a breadboard and prototyping hardware. ^ Different LDRs have different resistances even when they look the same. This may mean the 2.4kΩ resistor needs to change (our LDR from Jaycar was about 500Ω in full brightness).
Start by assembling the circuit board. We based ours on a doughnut type perfboard, but used cut-off component legs to help make the solder tracks. We find these tracks get very bulky with plain solder and can be hard to string along in runs longer than two or three pads.
Follow the schematic, wiring diagram (top view) and solder diagram. The photo of the doughnut board shows our hand-drawn overlay, something we find useful to keep things in order and place. Green is the component outlines, blue is connecting tracks, red and black are power rail tracks.
All components mount on the board, but the LDR mounts with its legs inserted only far enough to solder. The length is needed later. Add heatshrink to stop the legs shorting when it is bent.
Disassemble your battery bank. Do this very carefully as these battery banks rarely use protected cells. A short circuit here should be difficult to achieve but could be quite brutal if it happens. The one we used for development simply unscrewed, and the assembly was held in place by double-sided tape at one end. The battery was a tag type with one end soldered to the PSU module, and the other to a metal strap to connect to the PSU. However, the one we used for the build, from the same brand, same store, had a slide-out caddy with battery tray, terminals, and a removable battery. If you have a soldered version, desolder the battery connections for now, and carefully put the battery aside. You may be keeping the 18650 or using a 14550 instead. The 18650s are usually 2200mAh, whereas our 14550 sample was 800mAh. The choice is up to you, but the 18650 will fit in the 3xAA battery box with enough surgery. The lid, however, will not go on.
Now comes the tricky part. The USB socket needs to be removed from the PSU circuit board. We found we had to cut the side posts first, then we were able to desolder the pins one at a time. Trying to desolder the posts proved too hard because the chassis of the socket acted as a heatsink. Clean off these pads and the battery connection pads. Starting with fresh solder later on makes life a whole lot easier, as the alloys are often different. Gone are the days when everything was 60/40 Tin/Lead. Identify which connections are which by either going off the USB pin-out, or temporarily connecting the battery and using a multimeter to identify polarity. We found the polarity of the battery and USB socket did not stay on the same side of the board on our development version but did on our build version.
The next step is to decide whether to mount your electronics in the existing battery box or not. For one of our prototypes, we stripped out the internals of the battery compartment, and replaced the 18650 battery from the battery bank with a 14550 version, the same size as an AA battery. For a different prototype, we had a jar that could not quite fit the 3AA battery box. For this jar, we glued all the parts to the inside of the lid instead.
Note: This version is a very early development before we decided to use a battery bank. The photo, therefore, shows a separate battery charger, step-up converter, and battery all bought off the shelf.
If you do use the battery box, strip the internals and hollow out the relevant sections using pliers. The battery terminals should pull out with pliers but the switch and LED connections will need to be desoldered. The plastic generally snaps with pliers but starting it off with side cutters can help. Be careful to leave enough material in place to later glue on the battery charger/DC-DC board, which mounts level with the lid, but the LM311 board will need more depth. Also, make a cut-out for the charging port of the battery circuit board where the lid goes on, and another two small channels for the leads of the LDR.
The LED string has a resistor at its positive end and a PTC polyfuse. Tape or heatshrink this to avoid shorting if this is laid down over the circuit board later. We are not changing the resistor value as the 0.5V decrease has little effect on the life of the LEDs in this case.
They will still last much longer than interest in the light will. Solder the end of the resistor to the LM311 board so that it connects to the collector of the BC328 transistor. Use hook-up wire or breadboard jumper leads cut up to connect the USB pad negative to the negative rail of the LM311 board. Also, solder the LED string negative to the same rail. Solder a wire from the positive rail of the LM311 board to the switch. Solder a wire from the switch to the USB pad positive of the battery board. Lastly, solder a wire between the battery’s negative terminal and the battery negative pad of the battery board. Solder a wire onto the positive pad but do not connect it yet.
Now it is time to bring it all together. Use hot melt glue to mount the battery box to the inside of the lid of the jar. Glue the battery circuit board in position, then the battery, then the LM311 circuit board. Arrange the LED string so that it exits the battery box neatly, and glue it in place. Now you can make the final solder connection to the positive terminal of the battery. The battery is left unswitched so it can still be charged, hence placing the switch on the USB-side of the system. Before sliding the lid on to the battery box, mark where the trimpot will be and drill an access hole in the lid for adjusting the sensitivity of the LDR. Also, fold the LDR over so it protrudes from the side of the box through the small channels cut earlier.
If you are mounting all your electronics freely inside the lid with no battery box, your assembly steps are largely the same, but without the cutting and snapping of the box. Things to note here are: be careful to leave clearance for the jar thickness inside the lid. Make sure the lid is plastic-coated if it is metal, or else the circuit boards will short. Most metal lids have a plastic coating on the inside but it may not be thick enough. If not, you’ll need to place a lot more glue under the circuit boards.
Mount everything to the lid under-surface with hot melt glue, but pay particular attention to the Micro-B (usually) USB socket on the battery board, as it will need to be accessible for charging and the board will need to be glued firmly enough to take the plug being inserted here repeatedly. This may mean you will need to glue it on an angle. The last thing to do is straighten out the length of the LED string, and feed it loose-end-first into the jar so it coils and folds randomly.
Be sure to bend your LDR so that it faces the side of the jar, but if it is still being affected by light from inside the jar, consider painting the back and sides of the LDR black.
Now your project is assembled and ready to place somewhere attention-catching. Probably not right beside the TV, as we found that it’s rather distracting to turn the room lights off only for this bright light to appear right beside where you want to focus your vision. For that reason, we have a modification that you may make so that the light turns off in darkness.
Build Option 2:
Turns OFF When Dark
BETTER IN THE DARK
All that is required if you want your light to turn off in the dark is to swap the inputs to the LM311. The reference voltage divider goes to the non-inverting input and the LDR voltage divider goes to the inverting input.
Closely look at the modified schematic, wiring, and solder diagrams here and compare them with those in build option 1.