Revised Open Wave Height Logger battery tests

The Open Wave Height Logger is meant to be a submersible pressure logger that will record absolute pressure at 4Hz for several months to give a record of wave height, and ideally do this on a single set of 3 D-cell batteries. I have recently made a few changes to the OWHL software, and discovered a major flaw in my original battery test. As a result, I have begun a new round of battery tests. The hardware and software changes are described here, and new battery test results are shown at the bottom of the page.

I was using a micro SD card from ~2008 in my first battery test. It turned out that this card, along with every other old card from that same era I had on hand, was a massive power hog.

In the figure below, I’ve set up the oscilloscope to read show current draw by sticking a 1 ohm resistor in series with the battery supply wire, and measuring the voltage drop across it. As a result, the lower trace shows the approximate current draw, with one major division = 10mA. The upper trace is hooked to a digital pin on the OWHL that simply goes high whenever the microcontroller is awake and processing.

Oscilloscope trace showing the current draw of an old micro SD card.

Oscilloscope trace showing the current draw of an old micro SD card.

The upper trace shows what I expected the unit to be doing, waking up every 0.25 seconds, briefly taking data, and writing the data to the microSD card once per second (those are the longer high periods in the upper trace). However, the current draw trace on the lower half shows that the unit was drawing a bunch of power when writing to the SD card for about 60ms, as expected, but then the power draw was staying high for another 250-300 ms when the OWHL was supposed to be in a low power sleep mode. As a result, all of the effort spent putting the unit to sleep to save power was for naught, since the micro SD card decided it was going to impersonate a space heater for 300ms of every second of the day (equivalent to consuming roughly 10mA constantly for 7 hours a day).  Compare that to the same exact hardware, but using a modern 2014 SanDisk 32GB micro SD card shown below:

Oscilloscope trace using a 2014 SanDisk 32GB micro SD card.

Oscilloscope trace using a 2014 SanDisk 32GB micro SD card.

Merely by changing the micro SD card to a modern card, that 300ms of power wasting is gone, since the SanDisk card is very good about going into its own low-power sleep mode as soon as a read/write is finished. So instead of the OWHL using a ton of power for about 350ms of every second, it now is only using significant power for about 40-50ms (a 40ms write cycle plus the brief wake-ups for taking new pressure readings).

The 2nd significant change was software-related, but also involves the SD card (the code is in this GitHub repository). Up to this point, I had a function (writeToSD) in the OWHL software that spit out one second’s worth of data to the SD card. At the conclusion of that, it did a sync() operation and close() to close the file on the SD card. Both of those operations force all of the waiting data to be written to the card, so you don’t lose any data if the power is lost. On the other hand, both of those operations added about 20ms to the write operation. This forum thread outlines the issue with using those two commands. The main downside to leaving out the sync() and close() operations is that if power is lost, the OWHL may lose a few seconds worth of data. It won’t lose all of the file, just the last few bytes or kilobytes. I’m willing to risk losing a few seconds of the tail end of a deployment, when the unit is probably already up on board a boat, in order to shorten every single write cycle by 33% and thus save that much more power.


With those two changes made, I initiated a new set of battery tests. Along the way I also made a 2nd revision of the OWHL circuit boards (Rev B on GitHub, edit 2016: revision C is released now). The Rev B boards move a few parts around for clearance, and add space for an external 32.768kHz clock crystal. This external crystal is an experiment to save more power, but that may end up failing since it creates its own timing sync problems. (Edit 2016: The external crystal proved to be a problem, and has been eliminated in revision C of the hardware) The Rev B board also marks the change to specifying a 3.0V regulator instead of the original 3.3V regulator. The Rev B boards are not physically compatible with Rev A boards since I moved the header pins further apart.

The new battery test uses 3 OWHL loggers, one Rev A board and two Rev B boards. All are using 3.0V regulators and brand new 8GB SanDisk class 4 micro SD cards (that I’ve verified actually go to sleep quickly after write operations). The Rev A board is set up to only record data for 30 minutes of each hour in order to illustrate what kind of power savings are possible with that approach. The two Rev B boards differ in their timing component. One board uses the real time clock DS3231’s 32.768kHz signal to time the 0.25 second wake/sleep cycle just like the Rev A board, while the other Rev B board has an external 32.768kHz crystal to provide the timing while the DS3231 has its 32.768kHz signal disabled to save power. Both Rev B boards are set up to log data continuously like the original battery test. All three units are housed in a freezer to create a worst-case scenario in terms of battery life. All three of the current OWHL units are powered by separate sets of 3 D-cell batteries taken from the same brand new package and checked with a voltmeter to ensure that they had similar starting voltages (~1.623V).

Three OWHL units powered by 3 D cell batteries, prepared to go into the freezer.

Three OWHL units powered by 3 D cell batteries, prepared to go into the freezer. Each one has a separate power plug wired in to allow easy measurement of the battery voltage with a voltmeter.

The figure below shows the power consumption for the three boards (black, red, blue lines). The fourth line in dark green that descends quickly at the start is showing the data from the original battery test with the old power-hogging SD cards.