So i uploaded the serialOutput sketch and hooked up the sensor to my Arduino.
Until this point everything works fine. So i open up the serial monitor and im surprised of the output.
It doesnt do very much, it outputs something between 490 and 520. Even in total sillence it outputs this. I have to make real loud noise to get it to change the value, but its not what i had expected...
So i was wondering if this was normal behavior for this sensor?
So i was wondering if this was normal behavior for this sensor?
Yes. It depends on how you wire it up but the 512 level on silence suggests it is biased correctly. No sound mid -> voltage.
When there is a sound the waveform will be AC so you will get readings above and below that point.
The variations are not very big because the output from the microphone is small. To make it bigger you need more gain. If you change R5 you will get more gain. If you have too much gain it will amplify the DC offset on the front off the amplifier and just sit against a rail. That is just stay either high or low.
Well it's designed to pick up loud knocks etc. I would expect the high value in 'silence' due to the massive aplification which will provide quite a bit of noise when you can't hear anything.
ok so it works in reverse, 0 is very loud and 500+ is sillence?
Well 512 is silence but 0 is loud and 1023 is loud, you have an AC waveform. What you don't have is an envelope follower which I suspect is what you thought this interface was. http://www.andregoncalves.info/ag_blog/?page_id=61
R5 is the negative resistor for the operational amplifier on the PCB that contains the amplifier.
An audio signal is an AC waveform, the volume is in the peak to peak amplitude. When you measure the straight audio signal you are taking a sample of this waveform. To find the volume you keep sampling and find the maximum and minimum sample levels over a certain amount of time. Then the difference between the maximum and minimum reading is proportional to the volume level. You can then take this value and use it to light a bunch of LEDs.
This is a bit hit and miss because you can't sample fast enough to ensure you find the peak value. So one way round this is to have a circuit between the audio output you have from the microphone and the analogue input. This circuit is called an "envelope follower" and in effect gives you a peak or average DC value for the audio input. This is a simple circuit and consists of a series diode going into the analogue input with a capacitor in parallel with a resistor going from the analogue input to ground. The value of the resistor determines how fast a loud signal persists before it's effects fade away.
I suspect this is a bit of a surprise to you but you must appreciate the difference between the audio signal and the over all amplitude of the sound.
Damn thats quit a shock to me, i never thought this would be this advanced haha.
So ok, my guess is to buy the Shifty VU Shield? This seems like a easy way out of this issue, right?
[edit after googleing and thinking about it]
Well i remember a kit for a simple VU meter, so if i put a Arduino in it that would be a waste of an Arduino. Arduino is way smarter then a simple VU meter.
So tell me, what can i do with the hardware i have? I will make it a bit harder, because i want the arduino to work standalone and output on leds.
Im asking this because i now dont really know what to do with the mic i bought...