Hi everyone,
I'm using an Arduino Mega and I'm trying to read a wav file from the SD card.
I have connected the SD card adapter as follow:
CS --> Pin 53
SCK --> Pin 52
MOSI --> Pin 51
MISO --> Pin 50
My speaker is connected to the Pin 10.
So right now i can not here anything.
Could you please help. THANKS!
b707
March 19, 2024, 1:28pm
2
Please show the code that you using to play WAV file to pin10?
Unless you post a schematic of your project and your sketch there is no chance of helping you
#include "SD.h"
#define SD_ChipSelectPin 53
#include "TMRpcm.h"
#include "SPI.h"
TMRpcm tmrpcm;
void setup()
{
tmrpcm.speakerPin=10;
Serial.begin(9600);
if(!SD.begin(SD_ChipSelectPin))
{
Serial.println("SD fail");
return;
}
Serial.println("SD ok");
return;
tmrpcm.setVolume(4);
tmrpcm.play("test.wav");
}
void loop() {
// put your main code here, to run repeatedly:
}
xfpd
March 19, 2024, 1:32pm
5
Is your SD card adapter connected to the correct Vcc (3v3 or 5v)?
Do you also have GND connected?
Show the sketch you are using.
I
SD card adapter is connected to 5V
GND is connected
Sketch is below.
#include "SD.h"
#define SD_ChipSelectPin 53
#include "TMRpcm.h"
#include "SPI.h"
TMRpcm tmrpcm;
void setup()
{
tmrpcm.speakerPin=10;
Serial.begin(9600);
if(!SD.begin(SD_ChipSelectPin))
{
Serial.println("SD fail");
return;
}
Serial.println("SD ok");
return;
tmrpcm.setVolume(4);
tmrpcm.play("test.wav");
}
void loop() {
}
[quote="hosninfogate, post:6, topic:1237420"]
SD card adapter is connected to 5V
GND is connected
Sketch is below.
#include "SD.h"
#define SD_ChipSelectPin 53
#include "TMRpcm.h"
#include "SPI.h"
TMRpcm tmrpcm;
void setup()
{
tmrpcm.speakerPin=10;
Serial.begin(9600);
if(!SD.begin(SD_ChipSelectPin))
{
Serial.println("SD fail");
return;
}
Serial.println("SD ok");
return;
tmrpcm.setVolume(4);
tmrpcm.play("test.wav");
}
void loop() {
}
I have no schematic but i have done the circuit.
xfpd
March 19, 2024, 2:38pm
9
Is your SD card adapter made for 3v3 or 5v?
Is your SD card formatted?
Are the files in the right format/bitrate/extension?
normally 3.3V
but i tried all of them
Vin
5V
3.3V
nothing
(Iknow it's wise to use any voltage..)
xfpd
March 19, 2024, 2:40pm
11
What does the SD card Vcc pin say?
(Iknow it's NOT wise to use any voltage.
Forget the NOT(of course...)
Is tmrpcm Mega compatible?
Can any, arbitrary 'pin' be used?
(Not with a Uno, my only experience of it.)
for the tmrpcm library ifound some codes that are sued for Mega.
for the pins i tried many pins
5- 6 - 11 - 46
nothing
Why is everything "hidden"?
Oh. I remember - you're on my list.
Your code returns from the setup() function before setting the volume let alone playing the file. No wonder you never hear anything
The code works fine with the UNO i can here the sound
For the MEGA with new wiring no sound
Nothing to hide
what do you need as information