I am having a problem powering up my sd card manually. I have a data-logger circuit that logs the temperature and humidity. It will soon run on batteries (3 AAA's - 4.5V) so i need my circuit to be power efficient enough. Furthermore, I used voltage divider resistors to lower down the voltage supply of the SD card. I did it also to MISO, MOSI, CS, etc pins. I believe that using voltage divider connected directly to battery and sd card consumed a lot of power already so i want power up my card when it is only needed. I will also use SLEEP stuffs to my arduino to reduce the consumption of power but i have to settle this thing first.
I used the sketch of SD in arduino's samples
SCENARIO 1.
I connected my MISO, MOSI, CS, etc of the SD card to their proper pins.
I connected the SD Card's GND and VCC to Arduino's GND and +5v respectively
------- AND IT WORKED------- without any issues.
SCENARIO 2
I connected my MISO, MOSI, CS, etc of the SD card to their proper pins.
I connected the SD Card's GND and VCC to Arduino's GND and Digital Pin 7 respectively
In the Sketch, I also added some lines.
pinMode(10, OUTPUT); // change this to 53 on a mega pinMode(7,OUTPUT);
** delay(1000);**
** digitalWrite(7,HIGH);**
** delay(2000);**
------- IT DIDN'T WORKED AT ALL------
PLEASE HELP. Advance Thank you anyway..
PS: I am having a problem purchasing an SD card shield or module here in the small mountainous province here in the Philippines. That's why i used voltage dividers
I am having a problem powering up my sd card manually. I have a data-logger circuit that logs the temperature and humidity. It will soon run on batteries (3 AAA's - 4.5V) so i need my circuit to be power efficient enough. Furthermore, I used voltage divider resistors to lower down the voltage supply of the SD card. I did it also to MISO, MOSI, CS, etc pins. I believe that using voltage divider connected directly to battery and sd card consumed a lot of power already so i want power up my card when it is only needed. I will also use SLEEP stuffs to my arduino to reduce the consumption of power but i have to settle this thing first.
I used the sketch of SD in arduino's samples
SCENARIO 1.
I connected my MISO, MOSI, CS, etc of the SD card to their proper pins.
I connected the SD Card's GND and VCC to Arduino's GND and +5v respectively
------- AND IT WORKED------- without any issues.
SCENARIO 2
I connected my MISO, MOSI, CS, etc of the SD card to their proper pins.
I connected the SD Card's GND and VCC to Arduino's GND and Digital Pin 7 respectively
In the Sketch, I also added some lines.
pinMode(10, OUTPUT); // change this to 53 on a mega
pinMode(7,OUTPUT);
delay(1000);
digitalWrite(7,HIGH);
delay(2000);
------- IT DIDN'T WORKED AT ALL------
PLEASE HELP. Advance Thank you anyway..
PS: I am having a problem purchasing an SD card shield or module here in the small mountainous province here in the Philippines. That's why i used voltage dividers smiley
Thanks PaulS for the idea. I see, 40mA of current is not enough to power up the card. This is what I did then; I set the pinModes of D2,3,4,5,6 to output and turn them to HIGH. I connected all these pins to +v of the card. (Crazy stuff) And it worked!
I am very carefull with my code because all D2,3,4,5,6 pins are directly connected to each other.
You may have problems if you power the card off with the Arduino SD.h library. You will need to reinitialize the card when you restore power. SD.h has a bug that only allows begin() to be called once. There is a fix for this bug.
SD.h also has a bug that often prevents an SD card from sleeping in low power mode.
SD.h is based on a very old version of SdFat that I wrote four years ago.
With sdfatlib20131225, the Adafruit module and SanDisk card draw 0.44 ma when idle.
With SD.h the idle current is often 26.4 ma.
Modern SD cards are very power efficient when idle so there is little point in powering the card off.
Your voltage divider may draw more current if one of the SPI pins is high. The Adafruit card has an IC level shifter that is more efficient than a resistor voltage divider
Hi, as of now, I am working with this kind of problem regarding sd cards. I've been reading your posts a while ago, but hey! here you are helping me
I see, SD.begin() can only be called once. I've downloaded your sdfat library and I noticed you have a lots of samples that I can referred to. Thank you. About the Adafruit's module for SD, I've been trying to find a store for that here in the Philippines but unfortunately, you know..
Another question please. Since I have a datalogger here and I will put all the readings in a single file, e.g. logs.txt, will the sdfat continue appending new data to that file even if the file is already 1MB or bigger? And also, my idea of downloading the readings is through Serial. Will it still read the logs.txt even if it's already 1MB or bigger? I will create a VB program to read and download the measurements/data from the logger without removing the card.
will the sdfat continue appending new data to that file even if the file is already 1MB or bigger?
The maximum file size for FAT16/FAT32 files is 4 GB so 1MB is no problem.
If you close the file and power off the card, you will need to reopen the file with an option to position the file at the end.
Here is an example:
if (!file.open("FILENAME.TXT", O_WRITE | O_CREAT | O_APPEND)) {
// handle open error here
}
You can also position the file to the end with seekEnd() like this.
file.seekEnd();
The SD.h wrapper always positions files opened for write at the end. SdFat follows Linux and the open group standard of opening files at the beginning unless an option is specified to position the file.
If possible avoid opening and closing large files, the overhead can become large. You can use the SdFat sync() call to insure no data will be lost if the program terminates before closing the file.
// write data here
file.print(firstItem);
// ...
// force cached data to file
if (!file.sync()) {
// handle write error here
}