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?
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.
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.
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
- Power source diode ORing
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.