SD card Challanges

I am making an escape room prop using an UNO. Part of my project will play various sound files from an SD card depending on the code entered.

My project works most of the time but the SD module I purchased seems wonky, works 50-60% of the time depending on the SD card I use. The card I used all day yesterday won't work today, and the card I am using today doesn't work all the time. If I remove the card and re-insert it the problem is usual fixed.

The card reader I am using is an inexpensive one I purchased from Ebay.

I am using the SD, SPI, TMRpcm libraries and testing the card with the following code:

  if (!SD.begin(SD_ChipSelectPin)) {  // see if SD card is present and can be initialized:
    Serial.println("SD fail");  
    return;   // don't do anything more if not
  }
  else{   
    Serial.println("SD ok");   
  }

Thoughts? Did I just get a bad SD module? I need for this prop to be rock solid, is there a better way to play wav files?

Did I just get a bad SD module?

Who knows, with so little real information.

The card reader I am using is an inexpensive one I purchased from Ebay.

Care to let us into this secret? How about a link to what you have and a diagram of how you have wired it up?

Please read this:-
How to use this forum

Grumpy_Mike,

Thank you for responding to my question. This is the device I purchased:

I will try and post a copy of the circuit. I used the CardInfo example from the SD library and it fails at about the same rate. It’s hooked to my Arduino as follows, as taken from CardInfo:

The circuit:

  • SD card attached to SPI bus as follows:
    ** MOSI - pin 11 on Arduino Uno
    ** MISO - pin 12 on Arduino Uno
    ** CLK - pin 13 on Arduino Uno
    ** CS - pin 4

I understand that you can’t tell me if my unit is bad, what I really need to know is in general if this method of playing sound files is robust or is there a better way? Have others found specific SD modules highly reliable?

I am making an escape room prop using an UNO.

But that link says that card is for:-

Arduino ARM MCU

A Uno is NOT and ARM MCU!
So it looks like this is your problem.

All ARM MCUs run at 3V3 as does an SD card.

While that card reader says:-

Supports 5V/3.3V input

That is only the input voltage, and you can see the regulator that does that. There appears to be no signal level conversion, there is only a series resistor as any sort of protection for the card from 5V signals. So yes I can say this is an appalling bad design, and I would expect the sort of problems you are seeing with that design.

I should ask for your money back and get a proper card with signal level conversion circuit.

what I really need to know is in general if this method of playing sound files is robust

Yes the method is fine, but your card interface is not.

If you will have other devices on the SPI bus, be sure that the module that you get does not run the MISO line through the level shifter. If the MISO line goes through the level shifter the MISO line willnot be released properly and other devices on the bus cannot comminicate. Consult the schematic of the candidate module to be sure.

Thank you both, I did try connecting it from the 3.3v pin on the module to the 3.3v on the UNO. It didn’t seem to make a difference.

groundFungus, I am a newbie at Arduino (not programming) I am not sure what your saying. I have no other modules connected, just reading a digital pin, using the Tone function and operating relay modules with HIGH signals.

Any recommendations for a good SD or MicroSD module for the UNO?

One that i know is wired right and will play nice on the SPI bus is the Adafruit micro SD module. Other modules (that are not right) should work OK by themselves (alone on the bus).

Again, thank you both. I went to the Adafruit page and read about the Adafruit micro SD module. They have pages of information on their device and SD cards in general and now I understand the 5V issue and why resistors are a poor solution and also I understand better the concern with the SPI bus.

My initial concern with the Adafruit was it showed pin 10 for CS. The TRMpcm library reserves pin 10 for a second speaker. After reading more of their info, CS can be moved to another pin!

This is the challenge of using inexpensive components. Lesson learned.

I did try connecting it from the 3.3v pin on the module to the 3.3v on the UNO. It didn't seem to make a difference.

Correct it won’t. The voltage into the SD card reader is irrelevant as there is a 3V3 regulator on the card. What doing this does not do, is to change the voltages of the signals being produced by the Uno it is still too high for the SD card.

Thank you, I purchased the SparkFun Micro SD and it is rock solid, works every time!