
Micro-SD Card
Micro-SD card slot for local storage and data logging
Micro-SD card module for reading and writing files over SPI. Adds gigabytes of local storage for data logging, media, and configuration, with no cloud required.
For ages 14 and up. Not a toy. Contains small parts: choking hazard. Keep away from children under 3. Adult supervision recommended.
Made by Atech ApS, Lille Strandstræde 6A, st. th., 1254 København K, Denmark.
Technical specifications
- Part
- microSD Card (SPI)
- Interface
- Digital
- Ports
- 2 neighbouring ports
- Current
- ~100 mA
- Size
- 39.5 x 19.7 x 9.5 mm
Pins
- 3.3V (first port)
- supply
- GND (first port)
- ground
- Data A (first port)
- CS, chip select
- Data B (first port)
- SCLK, serial clock
- 3.3V (second port)
- supply
- GND (second port)
- ground
- Data A (second port)
- MOSI
- Data B (second port)
- MISO
Key features
- Standard FAT filesystem support
- Reads and writes files over SPI
- Supports high-capacity micro-SD cards
- Hot-swappable card slot
Common applications
Technical
microSD Card
microSD Card (SPI)Removable microSD storage on an SPI bus. Gigabytes of FAT16/FAT32 space for data logging, audio, images, or anything that must be readable on a computer afterwards. Double module spanning two adjacent ports: CS on Line A1, SCLK on Line B1, MOSI on Line A2, MISO on Line B2.
write_fileWrite text or bytes to a path, replacing the fileappend_lineAppend a line to a fileread_fileRead a file backlist_dirList a directoryfindSearch for files by globgrepSearch inside a file for textmake_dirCreate a directorydelete_fileDelete a filecard_infoCard type, capacity, used and free spaceremountMount a card that was inserted after bootlogQueue lines to a file from a background writer, without blocking
microSD CARD (SPI): - begin() returns false when no card is inserted. Not fatal: keep running and offer remount(). isMounted() is the mount state. - ONE card per board: the ESP32 core has a single global SD object, so a second MicroSDCard refuses to mount (micro_sd_card.h). - Needs a HARDWARE SPI host. With a camera and a screen on the board too, call atech::reserveSpiHosts(n) first in setup(), before any begin(), with n = the number of microSD cards + cameras (atech_spi_hosts.h). Do not call setSpiHost(). - Writes BLOCK for tens of milliseconds, occasionally far longer. Never call writeFile()/appendLine() on a periodic path. For anything recurring call beginLogger(path) once in setup(), then logLine() in the loop: it queues and returns while a background task on core 0 writes. droppedLines() > 0 means the rate is too high. - readFile(path) loads the whole file into RAM. Use readBytes(path, offset, buf, len) or readLine(path, index) for anything large. - Directories: mkdir(path) (parents are not created). listDir(path, names, sizes, isDir, max) fills a bool per entry; sizes is -1 for a directory. Build paths with MicroSDCard::pathJoin(base, name, out, outSize) and go up with MicroSDCard::pathUp(path). - Card info: cardType(), cardSizeBytes(), usedBytes(), freeBytes(). - FAT16 or FAT32 only. exFAT is not supported, and a 64 GB+ card from the factory is usually exFAT: it will not mount until reformatted.
A file browser pane fed by sd_list events, with a path breadcrumb and per-row Read and Delete buttons. Add a text editor panel that sends sd_write, and a card-status strip showing type, free and used space from sd_status.
| Pin | Line | Dir | Function |
|---|---|---|---|
| 1 | HV | – | not connected |
| 2 | 5V | – | not connected |
| 3 | 3.3V | input | supply |
| 4 | GND | – | ground |
| 5 | Data A | input | CS, chip select |
| 6 | Data B | input | SCLK, serial clock |
| Pin | Line | Dir | Function |
|---|---|---|---|
| 7 | HV | – | not connected |
| 8 | 5V | – | not connected |
| 9 | 3.3V | input | supply |
| 10 | GND | – | ground |
| 11 | Data A | input | MOSI |
| 12 | Data B | **output** | MISO |
from p2p/ground_truth/hardware/prototyping_line/modules/micro_sd_card.md
The doc for this module names no separate part. It is passive or discrete hardware, so there is no chip datasheet to read.
