2

I'm working on a project that uses an Atmega328p as the primary controller. I am using the Arduino libraries for programming.

I currently have an SD card in the project. I've done quite a bit of studying on current consumption of SD card and it turns out they're quite power hungry during read/write operations. However, when an SD card is not being interacted with, I believe it should go into an idle mode in which the power consumption is much less.

Now I've noticed that when I start using the Arduino SD library, specifically SD.begin(), the current consumed is approximately 20mA. This is a continuous 20mA without any read/write operations being used. Simply selecting SD.begin().

So I've got a few questions: - Does this seem high for an SD card that is essentially doing nothing? - What exactly does SD.begin do? I assume it configures some pins but does it do anything else? If it's just set up, shouldn't it 'set up' and be done? Why the continuous high current?

  • 1
    Current consumption depends entirely on the card used. Some (e.g., sandisk) will enter a sleep mode automatically. Some need to be placed into sleep mode. The SD library isn't clever enough to do that sort of thing. – Majenko Apr 7 '17 at 19:27
  • So I'm really try to narrow down this high current draw between two things: the SD card or bad wiring/configuration of the Atmega328p. Given the fact that high current is only drawn after SD.begin() is called seems fishy to me. If were truly the SD card being power hungry in idle state, shouldn't it be pulling high current even without an SD.begin() call? – Izzo Apr 7 '17 at 20:17
  • 1
    Not if the card starts in a low power state. SD.begin() would configure it ready for use. Personally I always have a P-channel FET arrangement controlling the power to the SD card so I can turn it on and off at will. – Majenko Apr 7 '17 at 20:18
  • 2
    It doesn't just set up some pins. It initializes the SD card with a series of command/response transactions where it determines stuff like the card supply voltage, block size, etc. Then, assuming there's a FAT file system, it must read the boot record and get stuff like the location of the root directory, sector size, etc. Only after this, and the method returns true, is it then ready to serve up files. That said, it should go to sleep when idle, i.e. no reads/writes. I doubt the SD library does any stuff in the background, so is the current draw consistent even after begin() returns? – TisteAndii Apr 7 '17 at 20:19
  • @TisteAndii Correct. I've completely stripped the project down to the barebones: #include <SD.h> void setup() {SD.begin(8);} void loop() {} and the 20mA draw still persists. It seems rather odd that this is happening. I had used the adafruit SD breakout board and did not experience this issue (adafruit.com/products/…). I don't believe there is any fancy power down circuit in the breakout board either. – Izzo Apr 7 '17 at 21:27
1

You should look here and see if it helps. Basically:

  • Ensure that SD.begin() returns true because the card won't sleep if not properly initialized.
  • I don't know if it's been fixed but the SD library may still have a bug that prevents it from letting SD cards sleep. So try the SdFat library instead.
  • Try another SD card, from a reliable source.
  • Connect external pullups or use the Arduino's internal pull-ups with the MOSI, SCK and SS pins so they don't float.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.