TinyCircuits Forum

TinyCircuits Products => TinyDuino => Topic started by: ParticleViolin on June 16, 2015, 07:27:30 AM

Title: Short battery life despite low-power software -- any ideas why?
Post by: ParticleViolin on June 16, 2015, 07:27:30 AM
I'm producing a datalogger that needs to stay alive for at least a month between battery swaps (hardware and software detailed below). My multimeter (connected at the battery) tells me that I'm draining <1 mA on average while the logger is in Power Down sleep mode, and it spends the vast majority of time asleep. When the logger is writing to SD (once a minute), usage shoots up to ~20 mA for maybe <50 ms.

The problem is that no matter what battery setup I use, the logger only stays alive for less than 3 days. I've tried 2x AAs, a 1200mAh Duracell USB power bank, as well as several quadcopter Li-ion batteries. My most recent test was with a 3.7V 860mAh Li-ion battery, and it lasted almost 3 days (71.79 hours, really). That's basically 12 mA drain to get that sort of battery life, which is way beyond what the multimeter is indicating to me.

Does anyone have any ideas as to why this is happening?

This is an on-going problem I've been having, so here's some troubleshooting that I'm working on:




Here's the hardware setup:


Testing gets done at 19–25 C, 32–58% relative humidity.

Here's some pseudo-code representing the logger's function:

Code: [Select]
Setup {
    minuteValueFromLastWakeup = RTC.getMinutes
}

Loop {
    Go to sleep for 8s. (Rocket Scream's Low Power Library, 'Power Down' mode, ADC and BOD off.)
   
    if (RTC.getMinutes != minuteValueFromLastWakeup) {
        if (batteryVoltage >= 2800 mV) {
            Open logfile.csv on microSD card.
            Write <100 bytes to the card.
            Close the file.
        }
        minuteValueFromLastWakeup = RTC.getMinutes
    } else {
        Do nothing.
    }
}
Title: Re: Short battery life despite low-power software -- any ideas why?
Post by: Ben Rose on June 18, 2015, 06:37:29 PM
Looks like you have your bases covered. Are you able to post your actual code and libraries used? 72 hours makes me want to think of a millis()/micros() rollover, but it doesn't correspond to either- maybe some of the related math?
Title: Re: Short battery life despite low-power software -- any ideas why?
Post by: zet23t on June 27, 2015, 02:03:27 PM
Not having much of an idea what is going on, but maybe it would help you to log data to the eeprom first and flush it to flash only every nth log entry... though a tenfold increase of runtime is probably difficult.