Hardware Reference
In-Depth Information
Your SD card should now be formatted and ready to go! You're now ready to
start interfacing with the SD card via an SD card shield.
InterfacingtheArduinowithanSDCard
SD cards, like the XBee radios that you used in Chapter 11, “Wireless Communication
with XBee Radios,” are 3.3V devices. Therefore, it's important to connect to SD
cards through a shield that properly handles the logic level shifting and voltage
supply to your SD card. Furthermore, SD communication can be accomplished
using the serial peripheral interface (SPI) bus, something that you should already
be familiar with after having read Chapter 9, “The SPI Bus.” The Arduino language
comes with a handy library (the SD library) that abstracts away the lower-level
SPI communication and allows you to easily read and write files stored on your
SD card. You use this library throughout the chapter.
SDCardShields
You have a tremendous number of options for adding data logging capabilities
to your Arduino. It is impossible to provide documentation for every shield
available, so this discussion keeps the examples general enough to apply to
most shields with SD card connection capabilities. This section identifies some
of the more popular shields and the pros and cons of using each one.
All shields have the following things in common:
They connect to SPI pins via either the 6-pin programming header or via
multiplexed digital pins. These are pins 11, 12, and 13 on the Uno, and
pins 50, 51, and 52 on Mega boards. The Leonardo's SPI pins are located
on the in-circuit serial programming (ICSP) header only.
They designate a chip select (CS) pin, which may or may not be the default
CS pin (10 on non-Mega boards, 53 on Mega boards).
They supply 3.3V to the SD card and will level-shift the logic levels.
Here's a list of the most common shields:
Cooking Hacks Micro SD shield ( www.exploringarduino.com/parts/
cooking-hacks-SD-shield ) : This shield is used to illustrate the examples
in this chapter. This is the smallest shield of those listed here (not a full-
sized shield), and it can be connected to either a row of header pins (8-13
on the Uno), or to your Arduino's ICSP 6-pin header. When connected
to pins 8-13, the default pin 10 is connected to CS. When connected to
the ISP header, the CS pin can be connected to any pin you want. This is
useful if you are utilizing another shield that requires the use of pin 10.
This board ships with a 2GB SD card (see Figure 13-7).
 
Search WWH ::




Custom Search