# Adafruit microSD Card BFF

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/120/468/medium800/adafruit_products_5683-10.jpg?1682432443)

Adafruit QT Py boards are a great way to make very small microcontroller projects that pack a ton of power - and now there is a way for you to add a ton of storage, for reading and writing, with a micro SD card slot that can fit on the back of your miniature dev board. It uses the three SPI pins plus one chip select pin to access megs or gigs of data.

![](https://cdn-learn.adafruit.com/assets/assets/000/123/269/medium800/adafruit_products_5683-05.jpg?1691028995)

We call this the **Adafruit microSD BFF** - a "Best Friend Forever". When you were a kid you may have learned about the "buddy" system, well this product is kinda like that! A board that will watch your QT Py's back and give it more capabilities.

![](https://cdn-learn.adafruit.com/assets/assets/000/120/469/medium800/adafruit_products_5683-08.jpg?1682432474)

This PCB is designed to fit onto the back of any QT Py or Xiao board, it can be soldered into place or use pin and socket headers to make it removable. Onboard is a slim, high quality Molex push-pull micro SD card socket. Since the QT Py is already 3V, no level shifter or regulator is required. We're using SPI mode to interface, use the **MOSI/MISO/SCK** pins plus one other chip select pin. The default is **TX** but there are some solder jumpers you can use to select **RX** , **A0** or **A1**.

![](https://cdn-learn.adafruit.com/assets/assets/000/120/470/medium800/adafruit_products_5683-09.jpg?1682432485)

We include some header that you can solder to your QT Py. [You can also pick up an Itsy Bitsy short female header kit to make it removable but compact](https://www.adafruit.com/product/4174), you'll just need to trim down the headers to 7 pins long.

- Comes as an assembled and tested PCB
- For any QT Py or Xiao boards
- Use any micro SD card that supports SPI mode with one CS pin.
- Any Arduino / CircuitPython / MicroPython library can be used to talk to the card just like a normal SD card breakout!

**microSD card and QT Py are not included**.

# Adafruit microSD Card BFF

## Pinouts

![](https://cdn-learn.adafruit.com/assets/assets/000/118/453/medium800/adafruit_products_double.jpg?1676319331)

The default **c** hip **s** elect pin ( **CS** ) is **TX**.

## TX Jumper

- **TX jumper** - This jumper is located on the front of the board, towards the center directly above the MicroSD board text and is labeled **TX**. If cut, the **chip select** pin ( **CS** ) for the SD card is no longer connected to **TX** and you can solder one of the solder-jumpers closed to change the CS pin.  
  
One of the pins must be used as **CS** for the microSD card to work

## Pin Select Solder-jumpers

- Three solder-jumpers are available to change the **CS** pin for the microSD BFF. They are located on the front of the board, directly below the microSD card slot. Their corresponding pin names can be found directly below the jumpers. You can choose to solder one of the solder-jumpers for one of the following pins:
  - **RX**
  - **A0**
  - **A1**

## CS Pad

- **CS** - The CS pad is a single square pad, located on the right side of the board between the microSD slot and the Adafruit logo on the silk. You can use this pad to connect the chip select pin to another digital pin.

# Adafruit microSD Card BFF

## CircuitPython

Warning: 

[Follow these steps to create the /sd directory](https://learn.adafruit.com/adafruit-memento-camera-board/circuitpython-memento-starter-projects)
It's easy to use the **microSD Card BFF** with CircuitPython and the [Adafruit\_CircuitPython\_SD](https://github.com/adafruit/Adafruit_CircuitPython_SD) module. This module allows you to easily write Python code that lets you read and write to an attached SD card.

## CircuitPython Microcontroller Wiring

Plug a microSD Card BFF into your QT Py or Xiao form factor board exactly as shown below. Here's an example of connecting a QT Py RP2040 to the BFF.

Connect the QT Py RP2040 with plug headers into the microSD Card BFF with socket headers. They should be plugged in with the backs of the boards facing each other.

For more information on soldering socket headers,&nbsp;[check out this Learn Guide](https://learn.adafruit.com/how-to-solder-headers/female-headers).

![adafruit_products_5683-05.jpg](https://cdn-learn.adafruit.com/assets/assets/000/118/456/medium640/adafruit_products_5683-05.jpg?1676320857)

[How to Solder Headers Learn Guide](https://learn.adafruit.com/how-to-solder-headers/female-headers)
## CircuitPython Usage

To use with CircuitPython, you need to first install the adafruit\_sdcard library, and its dependencies, into the **lib** folder on your **CIRCUITPY** drive. Then you need to update **code.py** with the example script.

Thankfully, we can do this in one go. In the example below, click the **Download Project Bundle** button below to download the necessary libraries and the **code.py** file in a zip file. Extract the contents of the zip file, and copy the **entire lib folder** and the **code.py** file to your **CIRCUITPY** drive.

Your **CIRCUITPY/lib** folder should contain the following folders and files:

- **/adafruit\_bus\_device**
- **adafruit\_sdcard.mpy**

![CIRCUITPY](https://adafruit.github.io/Adafruit_Learning_System_Guides/microSD_BFF_Examples_write_to_sd.png )

## SD Card Read Test
Once everything is saved to the **CIRCUITPY** drive, [connect to the serial console](https://learn.adafruit.com/welcome-to-circuitpython/kattni-connecting-to-the-serial-console) to see the data printed out!

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/microSD_BFF_Examples/read_sd/code.py

![](https://cdn-learn.adafruit.com/assets/assets/000/118/466/medium800/adafruit_products_readRepl.jpg?1676384933)

In this read test for the SD card, the filesystem on the SD card is mounted and read. Then, the contents of the filesystem are printed to the REPL.

## SD Card Write Test
https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/microSD_BFF_Examples/write_to_sd/code.py

![](https://cdn-learn.adafruit.com/assets/assets/000/118/467/medium800/adafruit_products_tempFinal.jpg?1676386081)

In this example, the code is writing data to the SD card. The microcontroller CPU temperature is printed to the REPL and logged to a text file on the SD card. After running the code, you can read the text file from the SD card. You'll see that the text file matches what was printed to the REPL.&nbsp;

# Adafruit microSD Card BFF

## Python Docs

# Adafruit microSD Card BFF

## Arduino

Using the microSD Card BFF with Arduino involves plugging the breakout into your Arduino-compatible QT Py or Xiao form factor board, installing the [Adafruit Fork of the SdFat library](https://github.com/adafruit/SdFat), and running the provided example code.

Warning: 

## Wiring

Plug a microSD Card BFF into your QT Py or Xiao form factor board exactly as shown below. Here's an example of connecting a QT Py ESP32-S2 to the BFF.

Connect the QT Py ESP32-S2 with pin headers into the microSD Card BFF with socket headers. They should be plugged in with the backs of the boards facing each other.

For more information on soldering socket headers,&nbsp;[check out this Learn Guide](https://learn.adafruit.com/how-to-solder-headers/female-headers).

![adafruit_products_5683-06.jpg](https://cdn-learn.adafruit.com/assets/assets/000/118/472/medium640/adafruit_products_5683-06.jpg?1676391338)

[How to Solder Headers Learn Guide](https://learn.adafruit.com/how-to-solder-headers/female-headers)
## Library Installation

You can install the **Adafruit Fork of the SDFat**** &nbsp;**library for Arduino using the Library Manager in the Arduino IDE.

![](https://cdn-learn.adafruit.com/assets/assets/000/118/469/medium800/adafruit_products_Arduino_Open_Library_Manager.png?1676390483)

Click the&nbsp; **Manage Libraries ...** &nbsp;menu item, search for&nbsp; **Adafruit SDFat** &nbsp;and select the&nbsp; **SDFat - Adafruit Fork** &nbsp;library:

![](https://cdn-learn.adafruit.com/assets/assets/000/118/470/medium800/adafruit_products_sdFat.jpg?1676390515)

Info: 

## Read/Write Example
https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/microSD_BFF_Examples/ReadWriteQT/ReadWriteQT.ino

![](https://cdn-learn.adafruit.com/assets/assets/000/118/471/medium800/adafruit_products_arduinoSerial.jpg?1676390663)

Upload the sketch to your board and open up the Serial Monitor ( **Tools -\> Serial Monitor** ) at 115200 baud. A test text file will be created and written to on the SD card. Then, the text file will be read back with its contents printed to the Serial Monitor.

# Adafruit microSD Card BFF

## Arduino Docs

# Adafruit microSD Card BFF

## Downloads

## Files

- [EagleCAD PCB files on GitHub](https://github.com/adafruit/Adafruit-microSD-Card-BFF-PCB)
- [Fritzing object in the Adafruit Fritzing Library](https://github.com/adafruit/Fritzing-Library/blob/master/parts/Adafruit%20microSD%20Card%20BFF.fzpz)

## Schematic and Fab Print
![](https://cdn-learn.adafruit.com/assets/assets/000/118/454/medium800/adafruit_products_schem.png?1676320181)

![](https://cdn-learn.adafruit.com/assets/assets/000/118/455/medium800/adafruit_products_fab.png?1676320188)


## Primary Products

### Adafruit microSD Card BFF Add-On for QT Py and Xiao

[Adafruit microSD Card BFF Add-On for QT Py and Xiao](https://www.adafruit.com/product/5683)
Our QT Py boards are a great way to make very small microcontroller projects that pack a ton of power - and now we have a way for you to add a ton of storage, for reading and writing, with a micro SD card slot that can fit on the back of your miniature dev board. It uses the three&nbsp;SPI...

In Stock
[Buy Now](https://www.adafruit.com/product/5683)
[Related Guides to the Product](https://learn.adafruit.com/products/5683/guides)

## Featured Products

### 20-pin 0.1" Female Headers - Rainbow Color Mix - 5 pack

[20-pin 0.1" Female Headers - Rainbow Color Mix - 5 pack](https://www.adafruit.com/product/4160)
Female header is like the duct tape of electronics. It's great for connecting things together, soldering to perf-boards, sockets for wires or break-away header, etc. We go through these real fast, and thought that given how handy they are, we'd offer them in a pack of five!

Each...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4160)
[Related Guides to the Product](https://learn.adafruit.com/products/4160/guides)
### Break-away 0.1" 36-pin strip male headers in Various Colors

[Break-away 0.1" 36-pin strip male headers in Various Colors](https://www.adafruit.com/product/4235)
In this world nothing can be said to be certain, except we need headers, headers, and&nbsp;_more headers_!

Each pack contains ten **36-pin&nbsp;0.1" pitch break-away male headers.**

We gave these in bags of 10, in **classic black** as well as...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4235)
[Related Guides to the Product](https://learn.adafruit.com/products/4235/guides)
### SD/MicroSD Memory Card (8 GB SDHC)

[SD/MicroSD Memory Card (8 GB SDHC)](https://www.adafruit.com/product/1294)
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 of the box with our projects. Tested and works great with our <a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/1294)
[Related Guides to the Product](https://learn.adafruit.com/products/1294/guides)
### SD/MicroSD Memory Card - 16GB Class 10 - Adapter Included

[SD/MicroSD Memory Card - 16GB Class 10 - Adapter Included](https://www.adafruit.com/product/2693)
Add speedy mega-storage in a jiffy using this 16 GB Class 10 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 of the box with our projects. Works great with any device in the Adafruit shop that uses micro-SD...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/2693)
[Related Guides to the Product](https://learn.adafruit.com/products/2693/guides)

## Related Guides

- [No-Code Offline Data Logger with WipperSnapper](https://learn.adafruit.com/no-code-offline-data-logging-with-wippersnapper.md)
- [Plotting Offline Data - JSONL to CSV files, filters and graphs](https://learn.adafruit.com/plotting-offline-data-jsonl-to-csv-files-filters-and-graphs.md)
- [Adafruit LM73100 Ideal Diode Breakout](https://learn.adafruit.com/adafruit-lm73100-ideal-diode-breakout.md)
- [Adafruit TMP117 High Accuracy I2C Temperature Monitor](https://learn.adafruit.com/adafruit-tmp117-high-accuracy-i2c-temperature-monitor.md)
- [A colorful CLUE slideshow purse with Bright Wearables](https://learn.adafruit.com/a-colorful-clue-slideshow-purse.md)
- [ItsyBitsy ESP32 wFL case](https://learn.adafruit.com/itsybitsy-esp32-wfl-case.md)
- [PyPortal IoT Plant Monitor with AWS IoT and CircuitPython](https://learn.adafruit.com/pyportal-iot-plant-monitor-with-aws-iot-and-circuitpython.md)
- [Adafruit SEN54 or SEN55 Adapter Breakout](https://learn.adafruit.com/adafruit-sen54-or-sen55-adapter-breakout.md)
- [CircuitPython Day 2024 Countdown Clock](https://learn.adafruit.com/circuitpython-day-2024-countdown-clock.md)
- [Adafruit MAX98357 I2S Class-D Mono Amp](https://learn.adafruit.com/adafruit-max98357-i2s-class-d-mono-amp.md)
- [Big Key Switches Macro Pad](https://learn.adafruit.com/big-key-switch.md)
- [Your Very First Circuit Sculpture](https://learn.adafruit.com/first-simple-circuit-sculpture.md)
- [AR1100 Resistive Touch Screen Controller Guide](https://learn.adafruit.com/ar1100-resistive-touch-screen-controller-guide.md)
- [Debugging the SAMD21 with GDB](https://learn.adafruit.com/debugging-the-samd21-with-gdb.md)
- [Adafruit 1.3" Color TFT Bonnet for Raspberry Pi](https://learn.adafruit.com/adafruit-1-3-color-tft-bonnet-for-raspberry-pi.md)
