Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.
Get Started

Asked

Moving Head Sound Detector

How do I get my sound detectors to give constant voltage readings on the ADC Graph?  I am using the two detectors to see where the loudest signal came from then move the robot's head toward the loudest.

I have read all I can find on Synthiam including the Community and Tutorials but can not see anything that will solve my problem. 

The problem is I can't get a consistent signal from in the ADC Graph.  The line graph will jump up and down even with the a constant audio signal coming from my sound generator.  Since their is no sound consistency I can't write script to make the head move.

Is my problem having to do with the wrong sound detectors or the way the information is handled by the Ez-Robot program?


Related Hardware EZ-Robot EZ-B IoTiny
Related Controls ADC Graph Read ADC ADC Meter
AI Support Bot
Related Content
Synthiam
#13   — Edited

Code:

:loop
$left=GetADC(adc0)
$middle=GetADC(adc1)
$right=GetADC(adc2)

if ($left>$middle)

if ($left>$right)
servo(D0,1) // left is highest
sleep(2000)
goto(loop)
endif

endif

if ($middle>$right)
servo(D0,90) // middle is highest
ELSE
servo(D0,180 // right is the highest
endif

sleep(2000)
goto(loop)
I just whipped this up quickly and is untested... I am sure it can be done with fewer lines of code but I am multitasking at the moment... It is obviously meant to work with 3 sound sensors....
#14   — Edited
Thanks to all of you. 

I agree with simple.  I have been trying to make it simple but it hasn't worked.  I have been using sound sensors for location.  I have tried DAOKI Sound Microphone Sensor Detection Module and RobotDyn sound sensors both with digital and analog pins.  I am using the analog pin.  The response I get can be seen on the above pictures.  The graph is all over the place.  I do not know if this is the problem. 

What really happens is the graph will jump from 0 to 64v instantly then right back to 0.  This continues to happen but with different voltages except they mostly peak from 64-65 volts no matter how loud the audio is to the speakers.  This is mostly a one volt variant.  The information is useless to sense sound volume because you can not compare which microphone is louder.

This is why it looks like I am all over the place.  All I want to do is collect sound from three microphones, use a program to process microphone info and make decision where the sound is coming from and turn robot head in that direction so it is looking at where the loudest noise is coming from.

Richard I will try the code.  I looks good for finding loudest microphone.  I hope the information I am getting to the app is the right info.

Thanks
Synthiam
#15  
I still feel like this is a gain issue. Because a sound should be louder based on the direction of the microphone. With no sound in the room, the microphone shouldn’t be returning much voltage on the adc wire. 

I’m assuming the sensor shares a common ground with the Ez-b? And maybe it does require a pull down resistor on the signal wire? What’s the data sheet show?
#16  
DJ you might be right.  I did adjust the gain to see if it would help it work.  I will work on that some more.  Also it does share ground with the sensors and it did not work with or without resister.

Also above Richard showed some script I am going to try and just skip the controls.

I will let you know how that comes out.

Thanks for your interest.
#17  
Hi. Richard gave me the script that would help me make the sound sensor work.

Here is the script:

:loop
$left=GetADC(adc0)
$middle=GetADC(adc1)
$right=GetADC(adc2)

if ($left>$middle)

if ($left>$right)
servo(D0,1) // left is highest
sleep(2000)
goto(loop)
endif

endif

if ($middle>$right)
servo(D0,90) // middle is highest
ELSE
servo(D0,180 // right is the highest
endif

sleep(2000)
goto(loop)


I would like to understand this script.  Where can I go to understand the format of the loop script.  I have been looking on Synthiam to understand loop but to no avail.  I know it loops scripts but I do not understand all the loops and their inset protocol .  I really want to write my own scrips using the loop script but right now I do not understand it and don't know how to find how to use it.  Please Help.
#18  
Thanks for ideas and help.

I am still trying to use Richards script to make my robot Max turn his head toward who is talking.  Richards script helped me a lot.  I still cannot get it to work but I am working on it.

https://www.youtube.com/watch?v=r8qBdeMNlJA&feature=youtu.be

Above is a my YouTube video that will show you that the three sensors are not peak coordinated therefor I cannot compare voltages at the instance sound is made.  I also added a steady tone of 1141 Hz, from my Tone Generator which should show a steady tone on the three Read ADC gauges. If I could get a steady tone on my gauges,  I could balance the gauges using the sensitivity on each sound detector.  Sensors are Sound Detectors by RobotDyn.  I could then use the steady tone from my Tone Generator to balance them.

Here is a pictures of my setup.

User-inserted image


Thanks for all the help.  Please give me some direction to go.

Ellis