Building and testing the charger
So the charger circuit came together pretty well. Just for fun, I decided to assemble the whole board with solder paste and heat it in a frying pan rather than solder each component individually. This turned out to be much faster, and you can’t argue with results!
I might be doing this again in the future.
Powering the board up, I first tested the short circuit current to the battery. If everything was working correctly, it should have been no higher than 9mA:
Boom! Next up, I connected a 2k load which is large enough to push the device into constant voltage mode. The verdict?
Allllrighty!
You might be wondering why the board has such an odd shape.
One of the goals of this project was to make something that would be highly technical, but also stylish. Rather than just making a charging circuit, I wanted to make a storage box that also charges.
For my box, I headed to the GoodWill and came back with three fewer dollars and this:
Although I was happy to take anything remotely close to what I needed, this box turned out to be the perfect size, and the two moons sort of represent the two earrings inside.
Now the challenge with something like this is to make it look good and not hacked together like most of my projects. I wanted everything to fit together just right. With the numerous large components on the PCB (inductor, capacitors) and the AAA battery enclosure all vying for space in my box, I needed to be certain that everything would fit before I started drilling holes.
That’s when I did this:
I found an Eagle/Google Sketchup plugin online called EagleUp. These scripts allow you to export a file from Eagle that can be imported into Google Sketchup. All you have to do is point it to a directory housing Sketchup models for all of your package varieties. Standard packages like 0603 resistors and some ICs already have models provided on the EagleUp warehouse page, but to use them, I had to rename them to match the names of my package types in Eagle. I also had to rename some of my Eagle packages because the OSX filesystem doesn’t allow slashes in filenames while Eagle allows them in package names.
Some of the packages I had to create myself such as the large capacitors, inductor, Schottky diodes, TQFP micro controller, PCB standoffs, and USB connector pictured here:
I also did the switch and buttons on the other side:
As you can imagine, this was a very time consuming process. Since I was only looking to see if everything would fit, I could have easily just used a cube for every component to represent its extreme dimensions, but the parts that EagleUp came with were so pretty that I didn’t want to ruin the aesthetic. I’ll be providing the parts I made in the download package for this project.
As I worked on the layout, I continuously exported the results to Sketchup to see how it would fit into a model representing my enclosure. After numerous tweaks, I came up with this:
With a few small cuts to my box for the USB port, it looked like everything fit. It was a pretty tight squeeze too! Take a look at the AAA battery holder represented by the white box here:
I measured 0.6mm of clearance! Or is it 0.6m? One odd thing about the EagleUp plugin results from the fact that Sketchup is designed for architectural drawings of large structures. Its precision deteriorates as you enter the sub-milimeter range. To get around this, EagleUp just multiplies everything by 1,000, so my PCB model is actually 80 meters long or roughly the length of a Manhattan city block.
I can dream.
With the 3D all worked out, I set to work hacking up my box. A dremel tool made quick work of the wood, and some superglue combined with counter-sunk screw heads held two of the four PCB standoffs in place. This was necessary to keep the PCB from sliding around due to insertion force from the USB jack:
The PCB helped me align the standoffs, but once the glue dried, I removed it and added my magnets:
These magnets serve the purpose of shutting down the earrings as well as providing the negative terminal for charging. Electrically connecting them to the circuit proved difficult as my soldering iron’s tip is ferromagnetic and kept getting stuck. I ended up using ferromagnetic resistor leads which were attracted to the magnets and sandwiched them in the stack:
It’s not the greatest hold, but it works. If it comes undone often, I’ll have to come up with a better solution.
Now it was time to add something to hold the earrings in place and connect the positive terminal. I carved a harness out of a block of styrofoam and punched holes in the bottom to allow for the magnets to make good contact with the earrings. The positive terminals were soldered to a pair of alligator clips, and the wire was reinforced with some liquid electrical tape:
You can’t see the AAA battery enclosure because it’s located under the PCB. Removing the two screws on the left makes it pretty easy to access.
The alligator clips are meant to be clipped to the wire loop on the top of the earrings, but I found that connecting them to the ear hooks themselves works most of the time. With everything connected, it looks like this:
Although I really wasn’t thinking about it during the design phase, the two alligator clips connect to the same part of the circuit, so if they short together, it’s no big deal.
The best part is that the box still closes!
A few more issues
I ended up having to remove the PCBs from their earring enclosures a second time to reprogram the firmware. I found that the voltage measurement can be flakey sometimes and cause my circuits to prematurely shut off. This happened especially when recovering from sleep with a low battery. I think the sudden load on the battery from turning on the LEDs was enough to temporarily dip the voltage below 3V.
I solved this by requiring two consecutive low voltage measurements before shutting off.
Likewise, I added a similar delay on the battery charger low current shutoff. This was a response to observing the unit shutting off while the batteries were still charging at 3mA. While this prevented the odd bit of noise from shutting the circuit down prematurely, I found that the circuit still never made it close to the expected 1.4mA.
I think this may be due to the lack of precision of my chip’s ADC. The difference between 3mA and 1.4mA is just 0.05V which isn’t a whole lot. I’m not super concerned about it though. 3mA is still pretty close to 1.4mA, and cutting it off there probably saves me an hour of charging for just a few percent of additional battery life.
Performance
The earrings are brilliantly bright. This is mostly due to the 3,000mcd LEDs I used for the front face. They certainly aren’t cheap, but they give off a nice glow for how little power I’m giving them.
I clocked the board at a little above 6mA during active use. Discharging two fully charged earrings side by side showed a 2:25 battery life for the first and the second died just 7 minutes after. This seems about on par with what I’d expect. 16mAh is close enough to 19mAh for a battery that I’m not charging up all the way. I was glad to see that the two earrings had similar battery lives as I was afraid one might die substantially sooner than the other and cause a major fashion faux pas.
Charging actually takes a lot longer; I measured around a 4:15. This makes the device a little difficult to use. When in standby mode, the earrings will still die in under two days; The charger will keep them in standby, but it will do nothing else to maintain their charge. This means that the user has to remember to start the charger 4ish hours before they hit the dance floor. Starting it too soon will cause the earrings to start to die before they’re even used, and starting it too late will now allow enough time for them to charge.
I showed them to a few friends who really liked the aesthetic. Those who tried them on said that their ears would probably be sore after a long night of wearing them, but they weren’t too heavy.
I consider this all to be pretty decent for a first attempt.
Looking forward
Although these earrings are maybe not as “cool” as some of my other projects (especially when you can buy some light up earrings online for fairly cheap), they’re probably one of my most ambitious projects to date. I’ve been a little bummed recently about my lack of blog updates, but I think this post more than makes up for it. I’ve covered a ton of new ground!
- Lithium polymer battery charging
- Lithium polymer battery protection
- Constant current sinks
- 0.01″ trace thickness PCBs
- 0402 resistors and capacitors
- Better use of solder paste
- 3D modeling of circuits and enclosures
- Idle mode on the ATTiny24
- Charlieplexing
- Power source diode ORing
- Sculpey
I probably should have split this one up into multiple pieces like I did my windshield wipers, but I honestly didn’t think it was going to be this complicated when I set out.
I’m reasonably happy with the final result, though there are a few things I would definitely change if I did this again:
- Include a small low-frequency crystal to reduce the standby current by two orders of magnitude.
- Either that, or create some method for killing power to the earrings while the batteries are still charged and then a separate operation to turn them on.
- FINALIZE AND TEST THE FIRMWARE BEFORE CUTTING OFF THE PROGRAMMING HEADER!
- Use the single FET solution for the battery shutoff.
- Find a way to use magnets for the positive trace as well. The alligator clips are a little clumsy.
- Add a gas gauge for the charger so the user knows how far along it is.
- Add an indicator to show which power source is being used (USB or AAA)
- Use machined plastic instead of Sculpey.
That last point is certainly a sticking one. As it is, the earrings are pretty fragile. The only thing connecting them to the wearer’s ears are thin pieces of wire. I’ve already had one break off which I fixed with a dab of solder. These will be a Christmas present for a family member, and if I have time before the holidays, I’d like to remake them out of something a little more robust.
Hrm… I wonder how hard it would be to get them to react to music? I should also consider putting a bird on them.
Continue the story and download project files here.
Really nice project! Now get these 3D printed and start selling them on Tindie 🙂
I still shy away from using LiPos for the reasons you mentioned. Maybe I should give them a try as well.
A few comments regarding your circuit:
– when measuring the current draw from your circuit, did you account for the voltage divider (I calculated about 8.5 uA)?
– you don’t actually need a voltage divider at all! Using the ADC mux connect VCC as reference and the 1.1 V bandgap as input. From that measurement you can calculate VCC.
– almost did not see this: so you pull low PB0, right? What about the current flowing through R12?
– when in power-down mode you can still wake up the device with the Watchdog interrupt (see http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=135288). That way you can configure your MCU to only wake up every 8 s.
Great comments!
-The voltage divider certainly contributed to the 0.45mA draw. Also that measurement was taken before I added R12 (I added a note to make this clear).
-That ADC mux trick is brilliant. I’ll definitely use that next time.
-Someone else suggested the WDT as well. I’ve never used one before. I always assumed it ran off the same clock as the application processor (or at least that it drew more current than that). I’ll definitely try that out next time.
Your break off programmer has inspired me to use that design in a wearable project idea that I have. Awesome and Thank You!
Nice project 🙂
One idea that could help storing the earrings in a charged state would be to use a small reed switch between the battery and the rest of the circuit (while keeping the connection to the charger).
I think you could use it to simply cut the power mechanically instead of having a sensor+code to manage the case.
For over-discharge protection when it’s in its box, you would only have the self-discharge effect to worry about, and that would not be a problem as long as the earrings are used at least once every few month.
Yeah, using the 1.1vref for voltage detection works out all right – it’s not 100% accurate, but if you set your threshold high enough, you don’t risk getting near the bottom end of the discharge curve for the LiPo cell. I’ve been fiddling around with adding navigation lights to my RC helicopters now that the sun is setting so early in the evening, and having the lights warn me before the low voltage cutout in the model kicks in is a design goal, and it’s within a few dozen mV of my goal voltage.
(viz: http://jeelabs.org/2012/05/12/improved-vcc-measurement/ although I’m using a different method.)
And white Sculpey is translucent, huh? I’ll have to give my blinkenlights a shot with it. Right now I’m using some HDPE medicine bottles to diffuse the LEDs a bit, but it’s a bit weird looking. Pressing them into Sculpey and baking it up might look a _bit_ nicer…
It’s actually marked as “translucent” Sculpey. I think the white stuff is different.
Neat project. I really like the coulomb graph.
Pingback: LED Earrings #WearableWednesday | electronics-trade blog
Pingback: Community Corner: RGB Stick Man Costumes and Ten More Great Projects from the Past Week in Adafruit’s Community « adafruit industries blog
Pingback: Community Corner: RGB Stick Man Costumes and Ten More Great Projects from the Past Week in Adafruit’s Community | electronics-trade blog
Pingback: Light Up Earrings
do you have a schematic for the charging circuit? Been throwing around an idea that this battery would work well in.
– K-tWizel
Page 4 has the schematic for the charger. You can also download the .zip file at the bottom of page 5 which contains the Eagle schematic files for the earrings and the charger.
Have some master models of the parts 3D printed. Smooth up the surfaces as needed with some primer and sanding. Then make RTV silicone molds for casting in urethane resin.
Smooth-On has a fairly quick setting white that when cast thin enough, light can shine through.
You could make a multiple cavity mold with only one set of 3D printed parts by first making a small mold to cast one set, then cast several sets from that mold to make one or more multi-cavity molds.
Shrinkage of the resin, especially with small sized items like these, is next thing to zero.
This is an awesome project. I’m also doing really small circuits as well. I’m sure you get this a lot but I need help finding a component. I need something that will detect voltage on a battery to about 2.5 volts. Then after hitting 2.5 volts it will direct the power somewhere until the voltage drops back down to about 1.7 volts. Or something similar to that. I just need to find out what kind of component that would be so I can see what there is to offer. thank you
I don’t know of a specific part that can do that. There may be a number of battery management ICs that can be configured to do something like that though. What kind of battery are you dealing with? What’s your application?
Well I’m actually dealing with a capacitor but treating it like a battery, just for energy storage. The application is a small energy harvester that takes in small amounts of energy over a period of about a minute and then dumps that collected energy into a motor or an LED. I found a part that could do the job but I’m going to test it in a few days to see if it’ll work. The LM8364 seems like it’ll work. What do you think? http://www.ti.com/general/docs/lit/getliterature.tsp?literatureNumber=snvs232b&fileType=pdf
Well, that part will certainly detect when the voltage drops below a threshold, but I still don’t quite understand your application. Will this connect to your charging circuit?
Sorry for the long reply. Basically the circuit has a small solar panel* made up of photo diodes. I’m getting a little over 3 volts in normal room light from the solar panel. In parallel with the solar panel I have a 1200uF capacitor as a battery to store the electrical energy made from the solar panel. I want that stored energy dumped into an LED or a small motor once the voltage in the capacitor gets to around 2 volts. I just finished building the circuit just now and it doesn’t work with the LM8364. But the circuit did show that the small solar panel and the capacitor could power an LED for a few msec. Then, i could have also heated the LM8364 to high when I was soldering it. I’ll test the component now to see if it actually functions.
So after testing the LM8364 I figured out the problem. The component basically detects whether there is enough power to run a processor or not. And in return tells the processor to shut down or turn on. For every failure I learn more about what I’m doing.
Look up Microchip TC54 series chips for battery protection, SOT23 package low-voltage detectors basically. Also, using a RGB LED might be an idea.
Pingback: CNC machine, Christmas gifts, and I’m a dope | ch00ftech Industries
Really good design work, unfortunately the Chinese have unlimited “research” funds
and dirt cheap parts and labor. They are selling beautiful LED earrings on the web for 99 cents a pair. Including shipping!!! Sorry Guys!!!
Pingback: CNC machine, Christmas gifts, and I’m a dope » Geko Geek