This module is an SPI interface with an SD Card Slot. Hook up SPI pins from a microcontroller to the corresponding pins on the module. This module allows for easy implementation of storage to a microcontroller project.

sd card


  • Powered from 5V or 3.3V
  • Simple SPI communication


Quick Start with Teensy 2.0

  1. Wiring: The wiring diagram below shows how to connect the Teensy 2.0 to the SD Card module to a potentiometer. The SPI pins on the Teensy 2.0 connect directly to the corresponding labels on the SD card module. The center pin of the potentiometer is connected to ADC0 on the Teensy 2.0. The outer two pins on the potentiometer are connected to VCC and Ground.
  2. After wiring the unit, you can download the C example code below. This code is tested to compile via avr-gcc under Windows. You may need to install the avr-gcc compiler prior to using these files. A pre-compiled .hex file is included for rapid use. There are multiple included files for this example: diskio.c, diskio.h, ff.c, ff.h, ffconf.h, and integer.h. These are all necessary to use the SD card. The sample code initializes SPI and ADC on the Teensy 2.0 and writes values from ADC0 50 times to the SD card in a text file, SAMPLE.txt. The LED on the Teensy 2.0 lets the user know how things are going in the code. A solid light means that the microcontroller is starting up. A short on followed by a long off period means that values are being written to the SD card. Short on, followed by short off, means that an error has occurred. Long on, followed by long off, means that the program has successfully finished running. 

    SD Card Module Teensy 2.0 Sample Code
  3. The sample code can be compiled from the command-line via the command 'make all' and downloaded to a Teensy 2.0. Download the loader from the PJRC website to program the hex file onto the Teensy 2.0.

    Teensy Loader
  4. After the program has successfully run, the SD card can be read on a computer. There will be a file called SAMPLE.txt. That can be opened in Microsoft Excel and all numbers should be in column A. From there a line graph can be created showing the ADC values collected.