Pages: [1]   Go Down
Author Topic: Adafruit microSD card breakout board and narcoleptic sleep library  (Read 1180 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am making an environmental logger that will log temperature, RH%, light levels etc. every 15 mins. I need it to run for 6 weeks off a set of AA rechargable batteries. To achieve this I need to get to sub 1 mA when the 328 is asleep.

Data are collected and written to an adafruit microSD break out board - along with some progress LED's this uses about 25 mA. I can initialise the SD card, write some data and then sleep the 328 with the narcoleptic.delay command but even when everything is off the SD card is still drawing 4 mA and then the logger only runs for 7 - 10 days. [I know it is the SD breakout because when I pull it out current drain drops to 0.4 mA]

To shut down the SD card I have tried switching off the ground line from the card using a switching transistor but the microSD card still draws current. I have tried file.close and then setting pins 10,11 and 13 to input to stop any current drains. This works in that current drain drops to 0.4 mA but .....

I cannot re-awaken the SD card. sd.begin does not work - returns FALSE.  SD.open is accepted but file.print does not add anything to the file.

Any one else had experience using SDCard breakout boards and the narcoleptic library?
 
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello Tom,

I am running into a similar problem with an Arduino based board I'm working on currently.

Through trial and errors and previous experience, I have determined that the SD card can stay powered through all input pins (MOSI, SCK, VCC, CS). By switching low all these pins and turning them into inputs, the card finally turns off and I measure 0V on VCC pin (otherwise ~2.9V when in sleep).

In my case, doing SD.init on it will "fail", i.e. return false, but further print to file will typically work.

That might have to do with the internal state of the SD library (also init on already initialized SD card will fail, even before turning power off). I will try to look into the SD library.

Cheers,
Robin
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Okay, by digging through the codes, I have pin pointed the failed initialization (after one SD power down and sleep) to this line in SDFile.openRoot :

https://github.com/arduino/Arduino/blob/master/libraries/SD/utility/SdFile.cpp#L550

This can probably be fixed by implementing some new method that resets the state of the SDClass object that can be called in init, or before doing a new init, or before (or after) turning the SD card off and before sleeping.

What do you think would be the best way of action ?

Cheers,
Robin
Logged

Pages: [1]   Go Up
Jump to: