SD Card - AlexanderTonn/MyArduinoSnippets GitHub Wiki
My repository: https://github.com/AlexanderTonn/MyArduinoSnippets/tree/main/SecureDigitalMemoryCard
Offical pepository: https://github.com/arduino-libraries/SD/tree/master
I'm currently using an SD Module in normal size (no micro SD) because i have more normal sized SDHC Cards. I bought this modules on amazon in germany ( Link to AmazonDE ).

Power supply Basically it's recommandable to use a external power supply because the SD Module can generate a consumption up to 200mA which is to high for the internal power supply of the board. In addition to that i prefer using the 5V Pin of the SD module (if existing).
Pin notation In the following table i add the pins which have to be connect on side of arduino with the pins of the SD Module. For the SD Pins are often used two different notations. I added both in each column starting with column 2 but at the end both notations meaning the same pin.
| Arduino \ SD Module | CS / SS | SCK / CLK | MOSI / COPI | MISO / CIPO |
|---|---|---|---|---|
| Uno | 10 | 13 | 11 | 12 |
| Mega | 53 | 52 | 51 | 50 |
| MKR WiFi 1010 | 7 | 9 | 8 | 10 |


- TODO: Inserting Picture of Pinout
- check your wiring
- SD Card inserted and formatted with FAT16 or FAT32?
- if you use the 5V power supply, don't use the 3.3V Pin and play safe that the Voltage is >=5V. In my case it was helpful to increase the Voltage (of my LM317 power supply Circuit) up to 5.1V to prevent voltage drops (for the case that you have more modules connect on 5V the power supply)
- If you use DC Power Connector for power supply of Arduino: Disconnect the plug while you debugging over USB Interface
- check your init routine. Did you forget
SD.begin(ChipSelect)?
- TODO: Inserting content
Please consider that the following Chapter only contains pseudo code for explaining the functionalty. Please go to my repository if you need working examples.
While naming files and directorys you have to play safe that the file names are matching with the 8.3 Format convention.
This means that the filename can only have 8 characters and additionally the fileextension can have maximal 3 characters. In addition to that you have to prevent the using of following special characters: ? : *
- Open File
File file = SD.open(<Filename>,FILE_WRITE);
- The file will create if the file dosen't exist.
- Check in a if loop whether file is present
if (file) - Inside of the if loop you can write data
file.println(<data>); - After writing you have to close
file.close();
- UNO & MEGA Pinout graphic was created with https://wokwi.com/