Thursday, August 25, 2016

Arduino_SD_card_module

Tested SD card reading with Arduino
Used for this test Ethernet shield (with SD card)
The programs are copies of the demo programs from the Arduino.cc website
  • Card Info: Get info about your SD card.
  • Datalogger: Log data from three analog sensors to an SD card.
  • Dump File: Read a file from the SD card.
  • Files: Create and destroy an SD card file. (*)
  • List Files: Print out the files in a directory on a SD card.
  • Read Write: Read and write data to and from an SD card.
The default Arduino library for SD card is huge! With the example read/write sketch, when compiled it’s 13690 Bytes which is half of the available flash space on an Arduino pro mini!
So if you are tight in sketch space, it’s a good idea to find a smaller library.

For the programs below you need the ( codebender ) Serial Monitor as interface.

Card Info

Get info about your SD card.

Datalogger

Log data from three analog sensors to an SD card.

Dump File

Read a file from the SD card.

Files

Create and destroy an SD card file.
This demo program on  https://www.arduino.cc/en/Tutorial/Files did not work.

List Files

Print out the files in a directory on a SD card.

Read Write

Read and write data to and from an SD card.




MCUFRIEND SD card

I also have a "mcufriend" TFT LCD shield with SD card reader and hoped the SD card program would

work also direct out of the box. I tried it and  ... not working.
On this shield near the connector is some text and found the corresponding Arduino pins for the SD
SD_SS      - Arduino  digital 10
SD_DI       - Arduino  digital 11
SD_DO     - Arduino  digital 12
SD_SCK   - Arduino  digital 13

Expect the chip select pin for the SD card in on this LCD shield is 10 ( not 4 as on the Ethernet shield).
Tested this with changing this in one of the scripts above ( ReadWrite ) and it worked !

More info

SD Library
https://www.arduino.cc/en/Reference/SD

Using the SD library to create and remove files on a SD card
>   https://www.arduino.cc/en/Tutorial/Files

Using the SD library to retrieve information over a serial port

Some things to keep in mind when using the SD Library
>  https://www.arduino.cc/en/Reference/SDCardNotes

Library options as the default lib is huge!
http://blog.oscarliang.net/sd-card-arduino/

Adafruit
https://learn.adafruit.com/adafruit-micro-sd-breakout-board-card-tutorial/library




No comments: