Instructables

Geo Data Logger: Arduino+GPS+SD+Accelerometer to log, time-stamp, and geo-tag sensor data

Featured

Step 2: The SD card

LOGGING TO THE SD CARD

The SD card, or Secure Digital card, is a non-volatile solid-state flash memory. Meaning if we disconnect power, it will retain its data.  With an SD card we can expand Arduino's permanent storage by gigabytes.  This is useful for applications that store large amounts of data such as data loggers. A 4GB SD card can be had for only $5. 

POWERING THE SD CARD

The LC STUDIO SD card socket used in this project can be powered with 5V or 3.3V power sources. There is an LM1117 3.3V regulator on board which can handle 800mA of current. The Arduino can provide 3.3V directly but it's limited to 50mA. That's not enough to power the SD card. So I powered the SD card socket from the Arduino Uno's 5V pin which can handle over 500mA of current. The 5V pin on the SD card socket will pass through the LM1117 regulator and come out a 3.3V with a current ceiling of 800mAh. 

Just because this SD card socket can be powered with 5V or 3.3V, we still can't connect 5V Arduino pins to the SD card socket's pins.  We have to level-shift the Arduino's 5V signals to 3.3V before we can connect them to the SD card.

This is where the SN74AHC125 IC comes in handy. This IC can convert (level-shift) a total of 4 signals from 5V to 3.3V.  This is perfect because for this project, I only need to convert 4 Arduino pins from 5V to 3.3V: three to the SD card socket and one to the LGS20031 GPS receiver which is also a 3.3V module. 

ALTERNATIVES TO THE SN74AHC125

You can replace the SN74AHC125 with the more available CD4050. I recently bought 10 of those from Ebay for about $0.40 a piece. The CD4050 is not pin compatible with the SN74AHC125 but it's easy to use. You will find many useful wiring examples for the CD4050 on the web.

THE ARDUINO SD LIBRARY

The Arduino IDE comes bundled with an SD library that's easy to use.  You can include the SD library in your Arduino program by selecting from the main menu: Sketch\Import Library\SD

The library also comes with ready to use example programs to get you up and running. You can open those example programs from main menu: File\Examples\SD then pick any of the 6 example sketches. If you have the SD card socket connected and an SD card inserted, those examples will work on the spot. 

For this prototype, I am using an old XTREME MiniSD 1GB SD1 card with a standard SD adapter simply because I have one available. I did not run into any performance issues with this class and model. Most memory cards sold today are the faster SDHC variety. 

SD CARD I/O STATUS LED

Since the SD card socket has no LED indicators, I have added a status LED wired to Arduino PIN8, via a 1K Ohms resistor in series. This LED stays on so long as the SD card is working properly. I wrote the Arduino code so that when a write or read of the SD card fails, the LED is turned off.  This way we can just look at the prototype and tell if something is wrong, along with other Arduino and GPS receiver LED indicators.

FORMATTING THE SD CARD

Using my Windows 7 computer I fully formatted the SD card as FAT16 once. Then, I quick format the SD card after every trial just to be on the safe side. 
 
Remove these adsRemove these ads by Signing Up
0xKD1 year ago
"We have to level-shift the Arduino's 5V signals to 3.3V before we can connect them to the SD card."  Why?

Can I power the SD card via a 3.3V output of the SN74AHC125? I just have the SD socket and have got all components except the LM1117 to build a circuit like the LC STUDIO.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!