As part of a university design assignment, I’m trying to create an audio player that plays one music file on loop unless a sensor is touched to play a different music file.
Currently I’m at the stage where I’m wanting to load a music file (wav file) to an SD card and get the Arduino Uno to play it, just so I know it works before I move to try get it to respond with sensors.
In trying to work out what is wrong I’ve been running the Example code available in the Arduino software: SD – CardInfo
and each time I run it is says the card won’t initialise:
Make sure you format your card correctly
Follow the instructions from the site above but I usually use the software from the SD association to make sure it’s the right format.
*If you post up a better photo where it’s clear where the wires are going it would help.
Yes all my SD cards are currently in the FAT32 format, but I will try the to format again using the SD Memory card formatter. Honestly not quite sure how to check what the voltage is? Should I be attaching to the 3.3V instead of the 5V?
Yeah wiring always looks confusing, I’ve tried getting a clearer image by removing the breadboard I was using and I’ve changed each wire to a different colour and separated the photos of power/GND wires and the other input wires to make it easier again:
I tested the code with a Uno and it works with the CS pin 4 as in the sample code. It didn’t work first time when I used a Catalex adaptor similar to the one you have but it’s likely the adaptor is faulty. It did work on an Adafruit microSd adaptor.
I was following what the code said and what CS pin was specified (4) but I decided to switch to pin 10 and altered the code accordingly doing that with switching power to 3.3V instead of 5V suddenly I had a response.
I use the Adafruit because it has proper level shifting and a decent size 3V regulator on-board.
For the amplification you need to filter the pulse-width-modulated output before sending it to the amplifier. This can be done with a series resistor and capacitor. There’s an example of doing this in this article (https://simple-circuit.com/arduino-wave-audio-player-sd-card/). A 1k resistor and 10µF capacitor shown are about right.
Hi Georgia,
This project of mine produced reasonable audio from files saved as .wav on an SD card.
You could use just the audio output area.
It uses direct register access and interrupts. The Arduino is rather busy when producing audio.
The power to the audio amplifier is switched because the Arduino produces a lot of digital noise which could be heard through the amplifier when not outputting audio.
I will definitely be using that simple circuit link because the previous article I was using is, I think, far too complicated for me and my skill level.
I managed to get a speaker/sd circuit working last week (with the current SD module I had) but because the sound wasn’t filtered it wasn’t very clear, hence my need to include an amplifier.
However, yesterday when I went to continue working the SD card and SD module again failed to initialise and read. I think I will be purchasing Adafruit module and hopefully it works more reliably.
1 Like
And you can get our latest projects and tips straight away by following us on: