Interface MIC with Speaker using Arduino UNO

Interface MIC with Speaker using Arduino UNO -


–> Postby Sara » Mon Sep 23, 2013 9:41 am

Hi all

I would like to input an audio signal to Arduino board using “Microphone Sound Input Module” and send this audio signal to an 8-ohms speaker which is connected to pin 9 from the arduino output pins and also connected to 100-ohms resistor. This is the code i wrote:

—————————————————————————————-
void setup() {
// initialize serial communications (for debugging only):
Serial.begin(38400);
}
void loop() {
int sensorReading = (analogRead(A0), DEC);
Serial.println(sensorReading);
int thisPitch = map(sensorReading, 0, 1023, 60, 15000);
// play the pitch:
tone(9, thisPitch);
delay(1); // delay in between reads for stability
}
—————————————————————————————-

My problem is the speaker gives a noisy output and doesn’t send my voice from the MIC.
Can you give me your suggestions? Is there any mistakes in my code?
Sara

–> Re: Interface MIC with Speaker using Arduino UNO
Post by angusgr » Mon Sep 23, 2013 10:25 pm

Hi Sara,

Unfortunately the Arduino is a poor choice for directly amplifying voice through a microphone, it’s just not powerful enough.

Each time you take an analogRead() input from the MIC module you’re reading a single digital sample, like the individual dots shown on the diagram on this Wikipedia page.

This isn’t directly convertable to a frequency in Hz that you can pass to the tone() function. In the case of voice the sound can’t be represented by a single pure tone, so even if the Arduino had enough processing power to record lots of samples and infer the frequency, it wouldn’t be able to reproduce voice by playing individual tones.

What’s the goal that you want to make? There may be a way to accomplish it by using some different electronics.

source from http://forum.freetronics.com/viewtopic.php?f=15&t=5515,
Back To Top