Problem with initialization of SD card

Hello everybody,

I am trying to save some data from Arduino to a SD card to transfer later on the PC. So I decided to follow this:
My setup is

-Arduino UNO
-LCstudio SD card reader (I know, it’s cheap… :grinning: )
-protoboard for connection
-Texas Instruments’ CD74HC4050E level shifter chip for the 5->3.3 volt conversion (http://www.ti.com/lit/ds/symlink/cd54hc4049.pdf)

The schematic of the connection is in the photo that I have attached. The sketch that I am using is the CardInfo example in the SD library, changing the CS pin to 10. I have verified that all pins are connected properly as the wiring scheme requires (http://www.instructables.com/file/FGX1BX7H5ECMZWK) by setting high each single pin and checking that the voltage at the interface with the SD card reader is 3.3v.

I tried both using a 2GB card or a 8GB card (SanDisk) but the error is always the same, the card fails to initialize.

Is there a problem with my schematic? What is wrong with what I am doing? I tried everything I could find in this forum and I just run out of ideas… :frowning:

Remove the 'level-shifter'. Its taken care of (sort of) on the LC-studio board.. I've also seen theese cards fed both 3v3 and 5v (then with the level-shifter)

knut_ny: Remove the 'level-shifter'. Its taken care of (sort of) on the LC-studio board.. I've also seen theese cards fed both 3v3 and 5v (then with the level-shifter)

Sorry, I did not understand what you are saying... Is the level shifter required to make it work properly or should i connect the pins directly without level shifter?

Some updates.

I tried with SDfatlib and it does not work either (using the SDinfo sketch and SS port as CS).

Then I tried to change CS port and use the pin 9 instead of pin 10, imposing in the sketch

pinMode(10, OUTPUT);
digitalWrite(10, HIGH);

I did not have any change... :(

That SD card does not have any logic level converter. Without a converter, it will have problems.

I didn't examine the schematic in detail, but I don't see a ground connection to the 4049.

@SurferTim I just forgot to draw it in the schematic but it is well grounded...

EDIT: I corrected the original schematic adding the Ground that SurferTim noticed that it was missing. In the real circuit it is present, I just forgot to draw it..

You should run MISO directly from the SD card to pin 12. You only need level shifters on the SD input pins. MISO should be high Z when the SD is not selected so a 4050 buffer can cause SPI problems.

If you want to level shift MISO you need a buffer with an enable on chip select.

See attached diagram.

This probably won’r fix your problem. The LCStudio module causes lots of problems. Some modules even have breaks in traces so good luck. See the attached photo with a wire I added to fix a big break in the trace.

MISO connects directly from SD to MCU Your drawing shows inverters .. and 4050 !? (if inverting, use two ports serial)

There are no inverters for a 4050 buffer. The datasheet in the above link has both the 4049 and 4050. The 4049 inverts.

Using the LC Studio module without inverters works for some SD cards. The problem is that this only works for SD cards with good input protection. These cards draw enough current to pull the Arduino SPI outputs to less than 5V. Other cards fail or may be damaged.

You can buy modules with level shifters for less than a dollar more on ebay. This module has the MISO problem so should not be used with other SPI devices. See the attached diagram for this module.

I like this SD shield. It has the proper MISO level shifter. See the SdShield diagram.