Post Image
By Matt GaidicaFebruary 3, 2020In Uncategorized

Low Power Showdown: uSD Card Sleep and Write Current Draw

Environmental sensors and animal-borne “bio-loggers” are usually constrained by power (Gaidica & Dantzer, 2020). For example, recording neural activity requires roughly 7 milliamps (mA) of current which will consume a 200 mAh LiPo battery in about a day. It turns out writing to SD cards (micro-SD, or “uSD” cards, in this case) is a major power hog in addition to active sensors. The topic has been wonderfully exhausted over at The Cave Pearl Project and on forums, but we wanted to do our own bench testing to make sure we were choosing the right card for our application.

Figure 1. Hardware schematic (left) and software routine (right).

Figure 1. Hardware schematic (left) and software routine (right).

We used the hardware and software configuration shown in Figure 1. At the core were an Adafruit Adalogger (3.3v logic) and the Ardunio SdFat library, which has some notable optimizations over the standard Ardunio SD library. Tagging alongside the Adalogger was a custom circuit that allowed us to measure the current of the uSD card as an isolated component communicating over the SPI bus with a dedicated chip select (CS) line. We identified 3 uSD modes:

  1. Initialization: when the uSD card is first inserted (i.e. power-up)

  2. Sleep: after initializing, but not writing to the uSD card

  3. Write: writing a single ascii character “X” to a file, looped for 10 seconds

Following (1) sd.begin() is called and the uSD card enters (2) sleep mode, after which we cue the (3) write cycle using a button press (see Bhargavi’s code on GitHub). We tested the following uSD cards you can find on Amazon:

We aimed to select a range of cards of the same capacity that were accessible and economical. These cards could be counterfeit, as some people claim, but the datasheets from a vendor like Digi-Key made us no less certain about performance expectations.

uSD cards in their original packaging.

uSD cards in their original packaging.

Adalogger and custom uSD circuit (left) attached to an ammeter with mA and uA resolution (right).

Adalogger and custom uSD circuit (left) attached to an ammeter with mA and uA resolution (right).

Results

Our results show that Kootion card has superior performance in both initialization and sleep modes, while the Samsung wins without question for writing. We highlight sleep mode performance below because it is likely the most important (see also, “Alternative Strategies”). We are not sure how important the initialization mode is in practice, because it appears that it can be quickly subverted by sd.begin(). Altogether, it was surprising that a well-known brand performed the worst, and a relatively unknown brand performed the best. In the future, we may want to expand this research to obtaining cards from other vendors to rule out counterfeiting or to point out differences in production runs (i.e. changes over time).

Alternative Strategies

If your application doesn’t use more than ~4GB you can get away with something like NAND flash that doesn’t necessarily draw less current draw during writes but does have a lower sleep current. A strategy we are currently deploying is writing ~1Mb chunks to FRAM (which draws ~1mA during writes) and then dumping that to the uSD card intermittently. Using this strategy, we compress about 5-minutes of recording to FRAM into a 7-second write to the uSD. A strategy often talked about is powering down the uSD card during non-writing periods using a high-side FET, and despite some claims that this is dangerous, our overall takeaway is that it’s a strategy worth pursuing if you have a device that requires incredibly long sleep periods (months-to-years).

The application-specific question in choosing the right uSD card might come down to the ratio of time spent in sleep vs. write mode. A heavy sleep would benefit from the Kootion, whereas a heavy writer would benefit from the Samsung.

Other Considerations

We didn’t characterize power transients or “spikes” that occur transitioning between modes which might impact power consumption and should be considered in the context of brown-out protection (these currents can exceed 100 mA).

LiPo Discharge Curve from Learning RC

LiPo Discharge Curve from Learning RC

The power curve for a standard LiPo battery is non-linear and might depend on the C-rating of the battery as well as factors like ambient temperature. Given that failing to complete a write cycle can brick a card (i.e. corrupt all data), it’s highly recommended to turn off data logging before it is susceptible to dipping below the circuit-wide operating voltage (~3.6 volts) in the presence of a current transient.


by Matt Gaidica and Bhargavi RavishankarDantzer Lab, University of Michigan

svgIncluding INO Files in Arduino Compilation as a Library
svg
svgThreading a Narrative Using Knowledge Engineering

3 Comments

  • spec

    April 23, 2020 at 11:34 am

    This is gold! Thank you!

  • Bill

    January 25, 2021 at 11:45 pm

    This is great, thank you! The high endurance SD cards are supposed to be the lowest current draw if you want to test those cards next.

    • Matt Gaidica

      January 25, 2021 at 11:57 pm

      Oh, that’s interesting! I’ve since switched to SPI NAND—it still has enough storage, but a smaller footprint and lower sleep/write power. The uSD route always had me worried that a brownout would corrupt the data if it were mid-write, or in some transient state.