CircuitPython board. This guide focuses on the ESP8266 and Feather M0/SAMD21-based boards, but any CircuitPython board that supports I2C should work. You'll find a board with a SD card holder built-in, like the Feather M0 Adalogger, the most simple and direct way to use an SD card.
If your board doesn't come with CircuitPython running on it already then check out your board's guide for how to load CircuitPython firmware. For example the Feather M0 express guide is a good reference.
MicroSD card holder. If your board doesn't have one already you'll need to get a microSD card holder that exposes the card as a SPI device. For Feathers the Adalogger FeatherWing is an easy plug-in adapter that adds microSD card (and more) to your board. For other boards a microSD breakout is what you want.
MicroSD card. You'll need a card to use to store data. Any microSD card should work, but be aware the very cheap / generic cards can sometimes be more unreliable or cause problems compared to known-good cards. If a card works well for Raspberry Pi and other boards it should work well for CircuitPython and MicroPython.
Be careful to avoid extremely large (128+ gigabyte) cards as they require special filesystems and block sizes that might not be compatible with the code in this guide. Stick with a typical 4 - 16 gigabyte card.
If you're using a Feather and FeatherWing just plug the FeatherWing into your board and be sure to note which pin on the FeatherWing is used for the microSD card chip select line (for the Adalogger FeatherWing this is GPIO 10 on M0 boards and GPIO 15 on the ESP8266).
If you're wiring up a microSD card breakout you'll need to connect it to your board's hardware SPI bus, for example with the ESP8266 you might wire it as follows:
- Board ground (GND) to microSD breakout ground (GND).
- Board 3.3V power to microSD breakout 3.3V power.
- Board SPI CLK (ESP8266 GPIO 14) to microSD breakout clock (CLK).
- Board SPI MOSI (ESP8266 GPIO 13) to microSD breakout data input (DI).
- Board SPI MISO (ESP8266 GPIO 12) to microSD breakout data output (DO).
- Board GPIO 15 (or any other free digital IO pin) to microSD breakout chip select (CS).
Finally make sure your microSD card is formatted with the FAT or FAT32 filesystem. Most cards come pre-formatted with this filesystem, but if yours does not or you'd like to erase it look for a disk utility in your operating system. On macOS the Disk Utility program can format cards, and on Windows right-click the drive and select Format.