sdcardio is an SPI interface SD card library in CircuitPython 6.0 that is optimized in C to be much faster than the original adafruit_sdcard library. Some much smaller/older boards don't have enough memory for this module, in which case you will have to use adafruit_sdcard

Ready to do a little wiring?  Almost any Adafruit CircuitPython board will connect to the MicroSD Breakout Board using SPI. The following is an example using the Itsy BItsy M4 express.

  • Board 3V to breakout 3V via supply rail
  • Board GND to breakout GND via supply rail
  • Board MI (or MISO) to breakout SO
  • Board MO (or MOSI) to breakout SI
  • Board SCK to breakout CLK
  • Board D10 to breakout CS

The example below uses D10, but you can use any available digital pin instead. Change the mount_sd.py code below to use the pin you selected instead of board.D10.

The ItsyBitsy and the MicroSD breakout are a great way to have SD card storage in a small footprint, but these instructions will work with just about any Adafruit Feather too. Just follow the fritzing diagram and then put the following in mount_sd.py:

import board
import busio
import sdcardio
import storage

spi = board.SPI()
cs = board.D10     # Use the pin you wired to the breakout CS

sdcard = sdcardio.SDCard(spi, cs)
vfs = storage.VfsFat(sdcard)
storage.mount(vfs, "/sd")

The default communication rate is 8MHz, which works with most SD cards. A higher or lower rate can be supplied with sdcardio.SDCard(spi, cs, baudrate=...) but the limitation depends on

  • the specific microcontroller's SPI interface
  • the specific SD card's operating characteristics
  • the wiring, especially if a breadboard or jumper wires are involved
Angled shot of a Adafruit Micro SD SPI or SDIO Card Breakout Board.
Micro SD cards and microcontrollers go together like micro-peanutbutter-and-jelly: SD cards are inexpensive, durable, easy to find at any shop, come in many sizes and can plug into any...
Adafruit ItsyBitsy M4 Express featuring ATSAMD51 connected to a small breadboard.
What's smaller than a Feather but larger than a Trinket? It's an Adafruit ItsyBitsy M4 Express featuring the Microchip ATSAMD51! Small,...
Hand removing/installing micro SD card from SD adapter
Add mega-storage in a jiffy using this 8 GB class 4 micro-SD card. It comes with a SD adapter so you can use it with any of our shields or adapters. Preformatted to FAT so it works out...

This guide was first published on Jul 31, 2020. It was last updated on Nov 29, 2023.

This page (ItsyBitsy M4 Express + Breakout) was last updated on Jul 24, 2020.

Text editor powered by tinymce.