Author Topic: Take a reading from a microphone  (Read 7515 times)

0 Members and 1 Guest are viewing this topic.

Offline airman00Topic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Take a reading from a microphone
« on: February 27, 2008, 10:25:56 PM »
How can you take a reading of a microphone and interface it to a microcontroller? Would it be ADC or something else?

I found this schematic online


But are all those capacitors necessary , and also what would be the form of that signal( aka how do I interface it to a microcontroller)

Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline hazzer123

  • Supreme Robot
  • *****
  • Posts: 460
  • Helpful? 3
Re: Take a reading from a microphone
« Reply #1 on: February 28, 2008, 01:39:51 AM »
Im guessing the microphone's output is proportional to the pressure of the air at its sensor. So the output would be a sound wavel.

To record sound using a MCU, you would have a loop in which you sample the ADC and store it as an element of an array.

This would record 2 seconds of sound.
Code: [Select]

counter =0;
for(2 seconds) {
     soundRecordArray[counter] = Reading from ADC;
     counter++;
}


Say the human voice has a maximum of 4000 Hz when talking. You would have to sample at aout 4 x4000Hz to ensure each wave can be accurately recorded. If you sample at a lower frequency, you may find your recorder sampling only the peaks of a wave, which would then look like DC.

To play it back you would need a DAC.
Imperial College Robotics Society
www.icrobotics.co.uk

Offline airman00Topic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: Take a reading from a microphone
« Reply #2 on: February 28, 2008, 05:17:56 AM »
I see....

I want to compare the inputs of two microphones, to detect where the voice is coming from. So I would ADC on both and compare the readings, correct?
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

paulstreats

  • Guest
Re: Take a reading from a microphone
« Reply #3 on: February 28, 2008, 06:22:50 AM »
Wouldnt you have to do something else such as convert it to a changeing voltage rather than a changeing amp for the adc to read it properly. Usually microphones emit an wave which is interpreted electronically as a change in the amps, the voltage level remains the same. When you amplify you usually increase the voltage level and the amps wave increases in proportion.

Offline benji

  • Supreme Robot
  • *****
  • Posts: 830
  • Helpful? 0
Re: Take a reading from a microphone
« Reply #4 on: February 28, 2008, 06:41:37 AM »
u gorra check mic output voltage levels and turn it to 0 >> 5 volts to get the best of you adc
mics give a very weak signal unless its attached to an amp
good ol' BeNNy

Offline Asellith

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 648
  • Helpful? 9
  • "I'm a leaf on the wind. Watch how I soar"
    • CorSec Engineering
Re: Take a reading from a microphone
« Reply #5 on: February 28, 2008, 02:09:08 PM »
If you don't care about the sound only the sound level you might be able to feed it into a capacitor and read the overall voltage stored there. I'm doing this on the fly at work so it might sound crazy after I think about it some more  ;D  But the louder the sound into the mic the larger the RMS voltage will be if you filter that with a cap it might give you a rough estimate of the volume. If you sample from 2 different mics you might get a false positive because the second mic will read the voltage at a different time and might get the falling edge of the signal even though it had a larger peak. Ok now back to making wiring adapters for clocks. I can't wait till I grow up to be a real engineer. 5 more months!
Jonathan Bowen
CorSec Engineering
www.corseceng.com

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Take a reading from a microphone
« Reply #6 on: February 28, 2008, 02:53:38 PM »
Hi,

Say the human voice has a maximum of 4000 Hz when talking. You would have to sample at aout 4 x4000Hz to ensure each wave can be accurately recorded. If you sample at a lower frequency, you may find your recorder sampling only the peaks of a wave, which would then look like DC.
The human voice contains formants important for distinguishing certain sounds of up to slightly above 6kHz.

To sample a frequency reliable, you need to sample at least twice that frequency (Nyquists theorem).
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline hazzer123

  • Supreme Robot
  • *****
  • Posts: 460
  • Helpful? 3
Re: Take a reading from a microphone
« Reply #7 on: February 28, 2008, 03:57:36 PM »
Hmm thats what i got taught - (the Nyquist theorem) - but when i think about it, 2x doesn't seem enough. I might be wrong though ...

Heres why i think it's wrong



This is sampling at 2xf, yet the output is not what the input was.
Imperial College Robotics Society
www.icrobotics.co.uk

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Take a reading from a microphone
« Reply #8 on: February 28, 2008, 09:52:17 PM »
Hi,

Hmm thats what i got taught - (the Nyquist theorem) - but when i think about it, 2x doesn't seem enough. I might be wrong though ...
Either you are. or the entire world of engineers working in some way with sampling digital signals (including me) are  ;D


Heres why i think it's wrong



This is sampling at 2xf, yet the output is not what the input was.
That is what could happen at the Nyquist frequency (highly theoretical though, since no circuit has a frequency deviation of exactly zero.
If your sample speed is a bit too low, you would get false readings (the input would appear to be of a lower frequency), but as long as your sample speed is just a wee bit higher than twice your signal frequency, you're in the green.
CD audio sample speed is 44.1 kHz and the signal can go to 20kHz - does your CD's sound bad? (Not talking music taste here of course :))
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Take a reading from a microphone
« Reply #9 on: March 01, 2008, 10:40:48 PM »
Quote
I want to compare the inputs of two microphones, to detect where the voice is coming from.
http://www.societyofrobots.com/robotforum/index.php?topic=1125.0

Offline airman00Topic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: Take a reading from a microphone
« Reply #10 on: March 01, 2008, 10:42:42 PM »
Quote
I want to compare the inputs of two microphones, to detect where the voice is coming from.
http://www.societyofrobots.com/robotforum/index.php?topic=1125.0

I saw that,  :P

I just wanted to know how to take the actual reading
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

 


Get Your Ad Here

data_list