I'm following a tutorial on how to play sound/music using a SD card module and a 8-ohm speaker.
I've followed the tutorial, but my speaker won't play music.
I think I converted the file correctly and have all the pins plugged into the correct place.
I can't think of anything else to make it work, so I thought I should ask for help on a forum.
Here's the code:
#include <pcmConfig.h>
#include <pcmRF.h>
#include <TMRpcm.h>
//TMRpcm library is needed
#include "SD.h"
#define SD_ChipSelectPin 10
#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(20);
tmrpcm.play("prt.wav");
}
void loop() {
// put your main code here, to run repeatedly:
}
I don't know if this is your problem but you can't connect an 8-Ohm speaker directly to the Arduino. The minimum resistance/impedance is 125 Ohms. That's for the "absolute maximum current of 40mA (5V/40mA = 125 Ohms).
If you have powered computer speakers you can use those.
Or, you can put a 120 Ohm (or higher) resistor in series with the speaker. (That will lower the volume.)
Or, you can directly drive a piezo transducer.
... I don't recommend connecting to your home stereo because it puts-out PWM, not true-analog, and "bad things" could happen.
Thanks for that but you know we can only know what you tell us.
I'm following a mix of these two tutorials:
So what we need to know is how you did the mix. In other words we need to know what schematic you are working to.
Also the SD card, have you a link to that. There are SD cards on the market that do not have a regulator on it and more importantly level shifters for the interface signals.
Sorry I might be sounding picky but you are my eyes I only know what you tell me and so far I haven't seen enough to begin to know what you might have got wrong.
Thanks again for helping!
I've tried tried using a 470 ohm resistor in series with the speaker, but it didn't work. Still coudn't hear any sound.
As for the mix of tutorials, I mainly used this one.
So the schematic looks like this, but I am not using a sound amplifier.
Thanks. My heart sinks when ever I see the word Instructables, they are often so much crap and this is too.
So I set up what you had and I did get out some recognisable music out of it, but it was very noisy and distorted.
I downloaded the software and programmed it into a Uno. I downloaded that zip file and extracted the test.wav out of it and put it on an SD card, formatted in the FAT16 system.
I noticed that you did not do this, but converted your own file. I would try the test one first to see if that is the problem. Don't forget to change the file name in the program as well.
Do you get any sound out of it at all?
The authors statement is
i believe to help people and share my knowledge i always want to build creative thing some of them for learning and some of them is very useful.
Well I would say before you start sharing knowledge, just make sure you have some to shair.