One of the things that has been bugging me recently is the power consumption of the SD card that I now have in the Tiny Sensor v1.2 design. I intend to power the sensor either via an external source (2xAA batteries for example) or a CR2032 coin cell battery (I have a battery holder on the bottom of the PCB). What had me worried is the capacity of that battery is only 220mAh, so I had to research further. I am not so worried with the RFM12B module as it has sleep mode and I have excellent battery results so far with the early prototype versions, the stripboard version has been running for a month now with no signs of battery wear, I also track battery level with every temperature measurement. The SD card on the other side may be a battery eater, so I focused my research there. I have a SanDisk SD card and the datasheet reveals this:
1.10 Automatic Sleep Mode
A unique feature of the SanDisk SD Card is automatic entrance and exit from sleep mode. Upon completion of an operation, the card enters the sleep mode to conserve power if no further commands are received in less than five milliseconds (ms). The host does not have to take any action for this to occur. However, in order to achieve the lowest sleep current, the host needs to shut down its clock to the card. In most systems, the SD card is in sleep mode except when the host is accessing it, thus conserving power.
When the host is ready to access the card in sleep mode, any command issued to it will cause it to exit sleep, and respond.
2.4 Typical Card Power Requirements
Sleep: 250 uA Max
Read: 65 mA Max
Write: 75 mA Max
2.5 System Performance
Sleep to Ready: 1 ms (typ), 2 ms (max)
That is excellent news, my SanDisk SD card does have automatic sleep mode. I wrote a small test sketch to read a file from the SD card then put the MCU to sleep so that I can measure the power consumption of the SD card only. I was most worried about the datasheet saying that the clock should be shut for maximum power savings, but I can’t do that on the shared SPI bus. Still, power saving mode seems to work anyway, maybe not optimal but still working. The results are that I get 0.3mA when the Attiny is sleeping, and that agrees with what SanDisk had to say in the datasheet. With the SD card removed from the slot, power consumption goes below the scale of my multimer, the datasheet says 0.1uA @ 1.8V, so I expect something slightly higher for my system running on 3V.
While the MCU was awake and reading from the SD card the consumption was varying in the 9-7mA range with SD inserted and steady 4.5mA without it. So the SD card when active eats up roughly as much as the MCU itself.
So is that bad or good news? I had to calculate power usage estimates to tell.. I used this site to calculate the estimate battery usage time for the following parameters:
Capacity rating of battery (mAh) 220mAh (CR2032)
Current consumption of device during sleep (mA) 0.3
Current consumption of device during wake (mA) 8
Number of wakeups per hour 10 (every 6 minutes)
Duration of wake time (ms) 1000ms (one second, may be too much, but I am interested in worst case scenario)
and that gives me 24 days of battery usage with the CR2032 coin cell. I was not happy. These batteries aren’t that cheap so that I can replace them 15 times a year per sensor. I could of course power the TinySensor from couple AA batteries and forget worrying, but where is the challenge I also think the Tiny Sensor looks more aesthetic with the CR2032 battery on the back, so here is a challenge to tackle.
Doing research on the subject revealed more bad news: SanDisk’s automatic power saving mode may not be so popular among other SD card makers. I bumped into a post where a guy experienced 6mA constant draw from his SD card.. wow. That got me thinking that if I am to sell these sensor at some point in the future, I can’t know what SD card will be used. A 6 mA energy vampire SD card will drain the battery in a day with the other conditions same as the above calculation. So fortunately there is a solution, though not as obvious as one may think. The typial approach that I also use for powering the DS18B20 sensor on the board, is to put a pin HIGH and use that for powering the sensor. No so with the SD card, where parasitic voltage sneaks thru the SS pin if Vcc is not powered, well explained in this post. There is always the option to revert all pins to inputs, put the internal pull up resistor on, but this is not elegant neither fool-proof. Luckily the guy thought of a smart solution: use a MOSFET to disconnect the GND of the SD card and effectively shut it down:
Schematic courtesy of the Futurologist
With this approach even SanDisk cards can benefit: I can basically eliminate the 0.250mA standby drain. That will also mean I have to re-initialize the SD card upon waking up, but that will still be better solution. I can accumulate a number of readings in an array in RAM and only when that array is full activate the SD card to write them down. So I ran the calculations again, this time using 0.02mA in standby and I got half year run-time on a single CR2032 battery. Sweet.
So I plan to add this power control to the TinySensor design files and the sketch will decide when to activate the SD card. There will be a solder jumper for those cases when power usage is not important and that will bypass the need for the extra MOSFET and resistor.
Comments are welcome.
Page views: 4315