Close

More power savings

A project log for Insulin Minder

Helps keep track of how hot or cold my insulin has gotten and when I last had an injection. Great for the absent minded diabetic!

linus-dillonLinus Dillon 12/21/2014 at 08:260 Comments

As I said in the last log, with the Insulin Minder consuming 3.3mA in when in sleep mode the battery won't last long enough for it to be useful - less than two days. The obvious culprit was the power LED, so today I desoldered it and measured the current again.

Down to 0.25mA, or about 25 days. Much better, but still a lot more than the bare ATmega328. In this configuration, the battery is being fed into the BAT pin on the Trinket, which then takes it through a regulator. Given this will only ever be powered off a single LiPo battery, there is no risk of ever exceeding the 5V, so this is a bit pointless. So I tried feeding it in directly into the 3.3V pin instead:

Even better. Down to 0.15mA or around 41 days. I know it is possible to go even further here. I don't THINK that the display or temperature sensor are responsible (I tried disconnecting them and the power draw remained about the same). I suspect that either there is still power being lost through the regulator (even though I am feeding power in only on the "out" side), I'm missing something with the Trinket Pro's circuitry or I'm loosing power through some of the input or output pins. Still, 40 days is good enough for now.

Towards making this a practical device, I need some way of knowing when the battery needs to be charged. This is actually quite easy now that the Trinket is directly powered off the battery, as I can use the internal voltage reference to get the battery voltage. I found this code at https://code.google.com/p/tinkerit/wiki/SecretVoltmeter.

The final bit of code I worked on today was a small change to keep track of time. When in sleep mode the normal timers are not running. The only source of time available is the watchdog timer, but that has a few issues; (i) it can't be read directly - it only triggers an interrupt when done (ii) it is not perfectly accurate. For my purposes I don't care too much about accuracy - for simplicity of implementation and use the Minder won't keep clock time, but instead just log readings over a 24 or 48 hour period - if that ends up being 10 minutes long or short it doesn't much matter. As for not being able to read it directly, I have addressed that by manually adding the configured watchdog period to a timer variable each time the timer is triggered. This works even if the Trinket has already been woken up by the navigation button.

So, that leaves me with a pretty much complete circuit! Running off battery, monitoring temperature and battery voltage, keeping track of time and able to wake up when the user uses the navigation switch and able to be recharged when plugged into USB. Now I just need to package it up and finish the software.

Discussions