Playing .wav files through Arduino Mega 2560

We are using an Elegoo Mega 2560 Arduino.

We are having issues playing .wav files through our arduino. I have attached our wiring diagram. I found instructions slightly modifying the pin locations - this recommendation was made for the board we have.

We followed this video (https://www.youtube.com/watch?v=6DRayPCqK04&t=12s) (How to Play audio with Arduino | Audio in Arduino | How connect Speaker with Arduino | Fair Electro) and had no success, we combined what we saw in the video with the instructions from adafruit which is where we got our breakout board (Adafruit Mini SD breakout). Here is our code
<#include <pcmRF.h>
#include <pcmConfig.h>
#include <TMRpcm.h>

#include <SD.h>

#include "SD.h"
#define SD_ChipSelectPin 53
#include "TMRpcm.h"
#include "SPI.h"

TMRpcm tmrpcm;

void setup(){
tmrpcm.speakerPin = 9;
Serial.begin(9600);
if (!SD.begin(SD_ChipSelectPin)) {
Serial.println("SD fail");
return;
}
tmrpcm.setVolume(5);
tmrpcm.play("1.wav");

}

void loop(){

}

I would also note that when creating the .wav file we found instructions to convert to 8 bit, 11.025 kHz and mono.

Any help would be appreciated!

We are using an Elegoo Mega 2560 Arduino.

Then why does your diagram show a Uno. I know because that pile of crap called fritzing doesn’t have a Mega. This is why you should not use it but sketch a schematic and post a picture of it.

Ok so there is potentially a lot wrong with that circuit. You feed 5V into an SD card and feed the 5V signals from the Arduino into it as well. Now does the SD card board have an built in voltage regulator and level shifters? If not you may have screwed it already.

Now that transistor, there is no base resistor, that over strains the Arduino pin. There is no AC coupling, that is connecting the speaker through a capacitor. Thus means you get DC in the speaker which can push out the cone, and the cone only goes from centre to fully out, it never goes in. Is the pinout of the transistor correct?

You have obviously ignored the page you were directed to because your code is not posted correctly. Have you checked if the library you are using can cope with the different timer structure of the Mega?

I am sure you have not produced that circuit, but who ever did want a severe telling off.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.