SD-card on Arduino

There are Arduino shields (like the modern Ethernet shield) that allow you to attach an SD card to your arduino. However if you are building a project that just needs a way to store data, then such a shield might be overkill.
It is possible to directly attacht an SD card to an Arduino and even then there is a cheap way and a more expensive elegant way.
The elegant way is to buy an SD card holder to solder on a circuitboard. These however come at a price.
Another way is to use the SD to microSD converter  that comes with most micro SD cards and use that one to solder to the circuitboard. Obviously that has a limitation as one then only can use micro SD cards and not the regular size SD cards.

SD card

The circuit in fact is pretty easy. other than ground and a powersupply line (3.3 V) you only need to connect 4 lines, 3 of which need a simple level adapter.

The Arduino SD library is very easy to use with easy to follow examples and it supports FAT16 and FAT32 file systems but note that it only supports one open file at a time and can only use short 8.3 file names.

For easy connection on a circuitboard consider soldering the pins to an angled header.

The resistors R1 – R7 can also be replaced by a 10k / 15k set and I have seen 1k8 and 3k3.
A better solution ofcourse would be to use a leveladaptor like a HEF4050 or an 74HC125 (such as in Lady Ada’s design)

With regard to Libraries that will work with this setup: There are 3 main libraries withint the Arduino development sphere:’SD’, ‘SDFat’ and ‘SDuFat’. These all should work. Just keep in mind that some of their examples still need the SSI pin (The chipselect) corrected because some boards will use pin 10, others will use pin 8 or pin 4.

If you are building this on breadboard and your connections might be a bit long, you may expect bus problems that will show up by e.g. problems with the initialization of the card. If that is the case. Try the example program of the SDuFat, as this library is one of the slowest. If that works, and the other library programs will still show problems, then at least you know that your card and connections are OK.

Then load the example sketch ‘SDinfo’  and find the line:

if (!card.init(SPI_HALF_SPEED, SdChipSelect)) {

change that to:

if (!card.init(SPI_SIXTEENTH_SPEED, SdChipSelect)) {


if (!card.init(SPI_QUARTER_SPEED, SdChipSelect)) {

and see if that will work. If it does, then your set up is OK but your wires are probably too long.


See also:

RS232 level converter for Arduino

The earlier circuit with an RS232 chip would have my preference  for connecting a self built Arduino to an RS232 port. However, if space is at a premium, a chip with 4 capacitors and a few resistors might just be too much. In that case a levelconverter made from discrete components might be a better choice.


Just to make clear: The TX and RX in the circuit refer to the microcontroller. The Tx signal from the Arduino gets fed to T2 and send to pin 2 of the DB9. That Pin 2 is the receive signal from the PC. The TX signal from the PC is available on Pin 3. This gets fed into T1 who then feeds it to the Rx of the Arduino.

There is a slightly fancier version available:

But the first circuit worked well for me.

Yet another circuit, looks as follows:

With regard to R5 that can be connected to TxD to borrow a negative voltage, but the circuit will only work half duplex then. It can also be connected to ground, which will probably work with most RS232 ports and that will allow Full duplex

One thing you have to keep in mind with these circuits: The RS232 does not trigger an automatic reset of your microcontroller anymore. If you still wish to have that, add another transistor, akin to what is build around T1 and attach that with it’s base side to the CTS and with its collector side to the Reset on the microcontroller, via a 100nF capacitor