Welcome to Synthiam!

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


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


It's kind of difficult to understand what you want to do sometimes ..
It's difficult due to many factors:
F1) What kind of goal ? 
F2) What kind of sensors are you using ? 
F3) No clues of your setup
F4) No clues of the code used

Usually I aim for the most complex stuff and sometimes there is a simple solution for the problem and I miss the point:)
#12   — Edited


I would like it to act like my Amazon Echo which with led's show where the sound is coming from.
The idea behind Amazon echo is called DOA direction of arrival denotes the direction (angle) from which usually a propagating wave arrives at a point. For this to work you need to have the measures and angles between each microphone and like i said before you need to code at low level, or if you use EZ-Builder you need a plugin to have compiled code versus interpreted code (JS/EZ-Script) plus you need to have the minimal latency capturing the microphone levels e.g. usb microphone array connected to the PC.



Ptp, he’s merely trying to identify the direction of a sound.
and he pointed a control:


I believe others who determined the direction of sound may have used the sound movement control: https://synthiam.com/Products/Controls/Scripting/Sound-Movement-16110
I'm guessing the control captures a Stereo audio, compares the peak levels and determines which one (left, right) has the smaller offset so you can identify left,right as the origin.
So Is not rocket science,  is simplistic and I believe can work, if you understand the limitations of the implementation. 

Tony Elis:
Did something similar. He used simple sensors (analog microphones) and code a firmware in a PIC micro-controller to capture the adc levels and his firmware dispatches the feedback direction to the EZ-Builder.

If you want something out of the box I would recommend Sound-Movement control or Richard's idea.

If you want something more elaborated/fancy I would try a hardware solution:
I believe there are some python scripts to grab the DOA angle, and other relevant information, but, you will need to take the risk of getting the board test and ask the vendor for windows support.

Sometime ago, I built something with Playstation eye cameras they have 4 microphones, and I've explored some sound algorithms on Linux, the idea was to have a cheap device Raspberry PI Zero with a PS Eye streaming audio plus DOA, and other stuff. I got mixed results, most of academic papers are complicated, and I forgot most of the college math, it was a pain and unfortunately during that time it seems not useful to me... 
I would love to port the code to windows, put the time is a constrain, and I spend most of my day coding so it's difficult to get the energy to code more.
#13   — Edited



if ($left>$middle)

if ($left>$right)
servo(D0,1) // left is highest


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

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.

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?
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.