Teaching a robot to hear
Ill post Code and pics later...
Right now·I have two sound sensors with an analog output of·"0-5v", they are·connected to two separate ADC's, which gives me a volume reading from 0-255 "8-Bit"
MY CODE Functions! with no errors!!
Now·I'm trying to teach it how to hear direction, My first attempt was:
[/code][/size]
Problems? No straight, wasn't very accurate
My second attempt was:
[/code][/size]
··The idea is how would you make sound detection code from two values ranging from 0-255?
· How should·I write code to tell what mic hears sound first?
My exact code will be uploaded later, if you help me with my problem that would be awesome!
Im going to sleep on it.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
···· -Devin
"I can only ask every question once."
Right now·I have two sound sensors with an analog output of·"0-5v", they are·connected to two separate ADC's, which gives me a volume reading from 0-255 "8-Bit"
MY CODE Functions! with no errors!!
Now·I'm trying to teach it how to hear direction, My first attempt was:
if (adcBits < adcBits2) then
debug "Turn Left"
Endif
[size=2][code] if (adcBits > adcBits2) then
debug "Turn Right"
Endif
[/code][/size]
Problems? No straight, wasn't very accurate
My second attempt was:
[size=2][code] if (adcBits > adcBits2) then
d = adcBits - adcBits2
Endif
If (d <= 5) then 'the tolerance is 5
debug "Straight"
endif
[/code][/size]
··The idea is how would you make sound detection code from two values ranging from 0-255?
· How should·I write code to tell what mic hears sound first?
My exact code will be uploaded later, if you help me with my problem that would be awesome!
Im going to sleep on it.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
···· -Devin
"I can only ask every question once."
Comments
detector to exceed this white level would be the first to hear
the sound. The ALD would set inside a fast loop, then jump
out to math out the detection. Which sound sensors are you
using?
humanoido
humanoido is on the right track... Assuming that you aren't listening for a particular tone, then any kind of Phase detection is out. For ambient noise, the best approach would be to establish a peak detector with some level of decay. The peak detector will serve to filter and average any incoming signals. This averaging will make any differential comparing easier to manage in software.
Here is a thread that is doing something very similar to what you want to do...
http://forums.parallax.com/showthread.php?p=572182
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
humanoido·and Beau Schwabe (Parallax):
I checked out Botwire's website, it seemed like he was more into the circuitry then the software.
The entire code is here: http://www.geocities.com/botwire/Vsoft.html
However·I get lost in all his mathematics
My exact code and my sound sensor·is down below.·My code can pick out which side is louder but has a large margin of error, im also working on detecting a straight direction.
"The ALD would set inside a fast loop, then jump out to math out the detection."
Do·I have something like that?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
···· -Devin
"I can only ask every question once."
Post Edited (Promagic) : 11/24/2008 3:32:20 AM GMT
www.inexglobal.com/downloads.php?type=manual
They also have an English version web page, plus circuits for Parallax Stamps. To answer your question, no you don't have it in your code. Another thing you don't have in your code is any comments! 1) Establish a baseline filter. 2) get some sound reading data. 3) When you are satisfied with stability, write smallest programs to do each thing, i.e. detect each sound direction. 4) Experiment with sound direction, intensity and frequency, noting how they relate. 5) Write the code with comments and debug it.
Note: surf the web for info about software filters. You can do many things with code filters, such as establish baselines, provide averages, vary numerical bandwidth, develop cutoffs, smooth and regulate quiescence, amplify, etc.
humanoido