12/16/2014 at 16:11 •
To make a ring, I needed to minimize everything. Of course, if you've seen the picture, you already know I didn't actually minimize much.
Still, batteries in wearables are a pain. For this wearable with my "you have to take it apart to charge it" methodology, well, longer battery life means this hack will exist longer. The more I take it apart, the more like it is that I'll repurpose the parts to do something else. (I have this idea for a different ring…)
Minimizing power in Arduino is a topic that has been taken on by plenty of other people. And I happily reused their code and methods (Thank, you Nick Gammon!).
However, when planning a device, it is helpful to determine the size of battery you need. To that end, I made an Excel sheet (sorry, I default there) which I've put into a Google spreadsheet so you can see it with the math. The first sheet (words) describes the process in words. The second sheet (numbers) reflects the same information but with numbers. You fill in the orange boxes, it generates the green one.
The first step is to determine the different power states of the device. For Wordy, it is either on (display showing) or sleeping (Arduino asleep, accelerometer configured to wake and interrupt it).
My next step was to figure out how much time the system would spend in each of these states. My goal is for the ring to be on for about five seconds every five minutes. Sometimes it will be on more, as I play with it a lot. More often it will be sleeping, such as left on a table overnight. (Note: if you build a Wordy, I strongly recommend setting the ring so it will lose at Pong. Sometimes if you leave it on the X side with no Y tilt, the ring will play Pong by itself indefinitely.) Starting with the idea of five seconds per five minutes means I'll probably be on the conservative side (unless it plays a Pong marathon without me).
Next, I measured how much current each state. I used my shiny new DVM-with-current-sensing (my old one didn't have that (though it did have a more melodious beep in resistance mode)). You can use a resistor if you feel like doing it old school style.
(This pic is from my book. If you were unaware I wrote a book, well, yes, I did and it is full of jokes. And dinosaurs. But mostly embedded systems.)
Finally, I calculated how long the device would last given a 40mAh battery (the largest I was willing to use due to size constraints). The result turned out to be much greater than I expected.
This does not have to be the order of events: you might start with the idea of how long you want the device to last and choose the battery accordingly. Or you may have a fixed battery and a predetermined life and need to determine how much time you can spend in each state. Happily, the math works in all the different ways.
Note that this value I got was greatly in excess of my self-imposed goal (which was a puny two hours). It is also greatly in excess of what I said in the build instructions (which was 48 hours). My wear-time was even greater than the estimated value: I charged on Tuesday afternoon and it died on Saturday night.
Though, I'm pretty sure I can do better than these power numbers.
When I measured the MicroView without the accelerometer, the on-state power fluctuated between 10mA and 14mA, depending on how much of the screen was lit. (All current measurements were taken around 3.7V.) If I modify numbers on the spreadsheet, the on-state power of 10mA to 14mA, it changes from 3.5 days to 3.1 days. I switched it back to 12mA as reasonable middle ground.
The accelerometer doesn't add much to this on-state value. On the other hand, for the sleep-state power, it is a very different situation. The MicroView alone took 0.14mA. The MicroView and accelerometer together take 0.31mA. If I change the sleep-state power from 0.31mA to 0.14mA, the amount of battery life expected changes from 3.2 days to 4.9 days.
The accelerometer datasheet says the accelerometer's current consumption is 6uA to 165uA. Looking at the numbers above (0.31mA-0.14mA = 0.17mA ~= 165uA), it is clear I should be able to reduce the sleep-state power by reading over the accelerometer datasheet again. (There is also an application note about wake/sleep features.)
Skimming through the app note, I don't care too much about the precision of the data (though I might in Pong mode but that is an active mode so it is ok to use more power there). It would be no problem to turn the system from 14-bit mode to 8-bit mode.
Sleep mode is limited to 50Hz sampling but that is what I'm sampling at anyway. Why am I still seeing the max current?
Ahh, according to the oversampling chart, I may see 165uA due to high resolution sampling. I can go to 24uA with normal sampling or 14uA with low power. However, I want some filtering either through oversampling or via the low noise setting. The combination of low noise + low power is back to 24uA.
Making only one change (from high resolution to normal sampling) should be enough to increase my battery life from 3.3 days to 4.6 days. That's exciting. Excuse me, I need to go see if that'll work and what else I need to change.
12/09/2014 at 23:31 •
Part of making a wearable device is making it look nice. That was a more difficult proposition than I expected.
I had this fantasy of putting my battery in the ring body using a bendy polymer battery. While they do exist, I couldn't find any with the power rating I need that was also rechargeable and had the safety circuit.
I ended up with the battery under the MicroView and on top of the accelerometer.
Now I needed a ring to fit it on. I started out with Amaco's cloud clay because that's what my local hobby shop had when I was considering the idea (I <heart> D&J Hobby). It is strange stuff, very light. It is flexible when cured so it works well as a ring.
Once a ring dried, I could put connector pieces on with hot glue, then essentially plug the MicroView assembly into the ring base.
This worked pretty well but looked pretty awful, especially from the front and back.
The cloud clay dries in 24 hours so I was able to leave it attached to electronics while it was drying. I tried lots of different blanks, getting ideas and making new ones pretty quickly. I used fingernail polish on some of them to give a glossy, finished surface. That worked fairly well given my fairly messy painting skills. However, the paint needs two coats (at least) and takes a really long time to dry so I went back to D&J to get the black version of the clay.
This whole time, I was trying to put the ring on my right hand ring finger. That is where the the MicroView "fits":
However, Pong is really, really hard to play from that angle. Also, after wearing the assembled one for 3-4 hours, I found it itched a bit. I think that was battery edges scraping into my skin.
I decided to try Sculpey. I have a lot of it. It's faster turn around time meant I could build something the day I wanted it. (Ahem, ok, maybe I switched to Sculpey because the nail polish took too long to dry and the white looked shabby and the black wasn't done yet and I wanted to wear it to a party.)
The first Sculpey ring broke right away, probably I didn't do it right but it also indicated the rigidity was going to work against me. It wasn't that comfortable either.
I went to Michael's to look for ring blanks in the jewelry section. I came home with the blanks I was looking for (though I wanted the good version, they only had the cheap version which are scratchy and uncomfortable). Amazon has a much better selection but I was not in the order and wait patiently mode. I also found a "chain making kit" with a number of large-ish silver rings. Some of the rings fit my right hand index finger. When 4-5 were combined together, they were a sturdy, nice looking ring.
Atop that, I put a box made of Sculpey. This wouldn't see the stresses associated with moving my hands so it was less likely to break.
As noted in the instructions, I put the connectors on the MicroView, add a bead of hot glue, then put the electronics in the box. Getting it out hasn't been bad. Someday it will leave all of the connectors behind (and that will be a good thing).
I like this ring because it is very sturdy, it feels stable. The ring stays powered. And I can tap the top (screen) or the metal band. It is functional.
However, it is huge. The box is bigger than it needs to be which means the whole thing is bigger, clunkier than necessary.
I either need to make another, smaller version or I need to sand this one a bit, then cover it in clear nail polish to make it look a bit nicer.
With any project, the thing that takes the longest isn't the part I expected. I suspect making this look nice could take infinite time, something I don't have. So excuse me while I got put the connectors on the pins, heat the hot glue gun, and put this on so I can wear it to dinner tonight.
Oh, I want to say that the ring is turning out to be amusing. Geeks like it, normal people ask about it. I think the "I love vocabulary" is a harder feature to grok than "my ring plays Pong". It helps with my sit-in-a-corner-during-a-party shyness. Of course, I do also sit in the corner and play with sometimes. But then Wordy will put up a word that makes me think that I need to share it...