HELP!!! Sound Level Meter
picky200
Posts: 2
Hello. I'm attempting to build a project in which a traffic light changes colors based on the sound around it. It is for a classroom environment to help deal with·noise management. When there is a lot of noise the light will turn red, with medium amounts of noise it will turn yellow, and with·ideal noise, it will be green. I have attempted connecting·a kit·microphone circuit, called the·super snooper microphone,to an A-D converter to a basic stamp. The microphone is working, but the results I'm getting from the A-D converter are too broad and fluctuate randomly. The microphone has to be able to capture ambient noise from the room in order to work successfully. Has anyone tried anything like this? I'm open to new suggestions as well!
Here's what my code looks like so far:
' {$STAMP BS2}
' {$PBASIC 2.5}
'
[noparse][[/noparse] I/O Definitions ]
Adc0831········ PIN 15················· ' ADC0831 Chip Select (ADC0831.1)
AdcClock······· PIN 14···················· ' ADC0831 Clock (ADC0831.7)
AdcData········ PIN 13·················· ' ADC0831 Data (ADC0831.6)
'
[noparse][[/noparse] Variables ]
result········· VAR···· Word
'
[noparse][[/noparse] Initialization ]
HIGH Adc0831
'
[noparse][[/noparse] Program Code ]
HIGH 10
PAUSE 1000
LOW 10
Read_GP2D12:
··· LOW Adc0831
··· SHIFTIN AdcData, AdcClock, MSBPOST, [noparse][[/noparse]result\9]
··· HIGH Adc0831
· DEBUG· HOME, CLS, ? result
· SEROUT 1, 84, [noparse][[/noparse]12,129, DEC RESULT]
· IF RESULT >160 AND RESULT<170 THEN HIGH 11
· IF RESULT<160 THEN HIGH 10
· IF RESULT >170 THEN HIGH 12
· PAUSE 100
··· LOW 11
··· LOW 12
··· LOW 10
· GOTO Read_GP2D12
Here's what my code looks like so far:
' {$STAMP BS2}
' {$PBASIC 2.5}
'
[noparse][[/noparse] I/O Definitions ]
Adc0831········ PIN 15················· ' ADC0831 Chip Select (ADC0831.1)
AdcClock······· PIN 14···················· ' ADC0831 Clock (ADC0831.7)
AdcData········ PIN 13·················· ' ADC0831 Data (ADC0831.6)
'
[noparse][[/noparse] Variables ]
result········· VAR···· Word
'
[noparse][[/noparse] Initialization ]
HIGH Adc0831
'
[noparse][[/noparse] Program Code ]
HIGH 10
PAUSE 1000
LOW 10
Read_GP2D12:
··· LOW Adc0831
··· SHIFTIN AdcData, AdcClock, MSBPOST, [noparse][[/noparse]result\9]
··· HIGH Adc0831
· DEBUG· HOME, CLS, ? result
· SEROUT 1, 84, [noparse][[/noparse]12,129, DEC RESULT]
· IF RESULT >160 AND RESULT<170 THEN HIGH 11
· IF RESULT<160 THEN HIGH 10
· IF RESULT >170 THEN HIGH 12
· PAUSE 100
··· LOW 11
··· LOW 12
··· LOW 10
· GOTO Read_GP2D12
Comments
Does anyone have an example they can post for this person?
I would think that you might be able to accomplish this via a microphone/transistor circuit tied into a RCTIME circuit.. varying your capacitor to get the response fine tuned.
Good luck!
Rick
http://hyperphysics.phy-astr.gsu.edu/hbase/electronic/opampvar4.html
The charge is integrated onto the capacitor, R1 determines how quickly the charge will build on the capacitor in the presence of a signal. R2 determines how quickly the charge will dissipate when the signal tapers off.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
1. DC restoration: This can be as simple as a large series cap connected to the integrator's input resistor, followed by a diode with its anode end grounded, as seen here. This circuit will shift your input level upward, keeping the bottoms near ground and the tops near the peak-to-peak level of your input signal.
2. Clipping: Same as the DC restorer, but replacing the cap with a resistor. The negative swings will get clipped off by the diode, and the integrator will see only positive pulses equal to one-half the input signals' peak-to-peak voltage swing.
3. Rectification: By swapping the cap and diode in the DC restorer circuit, you form a half-wave rectifier. This will pass only the positive swings and filter them. The DC voltage level on the cap will roughly equal one-half the peak-to-peak voltage of your input signal. You may not even need the integrator after rectification if the cap is big enough.
-Phil
To Phil, I'm not familiar with the circuits you mentioned. Is it possible for you to provide a link to a scematic with specific parts?
Thank you everybody for your help and I'm really looking forward to finishing the project.
His circuit is a two-channel sensor (stereo) -- obviously you only need one channel so I'm thinking you may already have your parts on hand.
I will also echo rixter's suggestion that you also accommodate the "real world" in your code. It may be as simple as a counter -- if the sound level is in "zone 2" for 5 samples or more, declare it "really at zone 2"; etc. This will help throw away any "spikes" you see in your data due to someone coughing, dropping a book, whatever. You could also consider averaging the samples over time in your code, which will help get you closer to "ambient" levels, rather than one-shot levels.
http://forums.parallax.com/showthread.php?p=572182
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
Post Edited (Zoot) : 3/14/2007 9:39:08 PM GMT