Interface MIC with Speaker using Arduino UNO

Our range of tiny modules are designed to make it easy for you to quickly add functionality to your projects. [Module List]
Post Reply
Posts: 1
Joined: Mon Sep 23, 2013 9:30 am

Interface MIC with Speaker using Arduino UNO

Post by 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):

void loop() {

int sensorReading = (analogRead(A0), DEC);
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?

Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia

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.

- Angus

Post Reply