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-B IoTiny
Related Controls ADC Graph ADC Value ADC Meter

ARC Pro

Upgrade to ARC Pro

Become a Synthiam ARC Pro subscriber to unleash the power of easy and powerful robot programming

PRO
Synthiam
#1  

Do your sensors require a pull-up or pull-down?

#2   — Edited

The sensors have both analog and digital.  I am using analog pin.  As I understand , analog provides a constant streaming variable voltage output.

PRO
Synthiam
#3  

Is there a gain on the audio sensor? Perhaps the gain is super high and picking up distortion? ADC will display what ever voltage it samples - garbage in is garbage out :D

#4   — Edited

User-inserted image User-inserted image

The above pictures are Top ADC Graph,  Next Sound Generator pictures.

Yes there is a gain control on both brands of sound sensors. I have tried from low to high on both of them to no avail.  I added a 1000 ohm resister between signal and ground as per the tutorial instructions when I first built the system.  I am beginning to wonder if this pull down resistor is only used when you are using the digital pin which I don't.  I am going to try removing it and see if that changes things.

It is showing a signal when my Lab dog barks and sometimes when I make a loud voice sound at a higher pitch.  It seems to prefer the higher frequencies.  When I turn on my sound generator and run it at 5000 Hz the generator puts out a perfect sign signal tone.   But on my ADC graph it shows a variable up and down signal.  Again I want to have all three sound sensors in sync so I can write script to to calculate which is louder.  I would like it to act like my Amazon Echo which with led's show where the sound is coming from.  If I could use an Echo far field microphone setup I would. Right now I am trying to build my own.

PRO
USA
#5  

Quote:

I would like it to act like my Amazon Echo which with led's show where the sound is coming from.
Sound localization, is a low level feature is not a job for a high level tool like ARC. You need to code the algorithm at the firmware level, there are some microphone arrays for integration: https://www.matrix.one/products/voice https://www.seeedstudio.com/ReSpeaker-Mic-Array-v2-0.html both products are open for integration and both require Linux and low level tools.

#6  

Thanks PTP.  Coding firmware is way beyond my skill level.  I would love to use one of the arrays but do not know how to interface them with ARC so I can control a head rotate servo. Do you know anyone that has used a microphone array with ARC in this kind of situation.

I have seen someone on the Community make a robot answer which ear is hearing the loudest voice with sound sensors and it seems to work.  I realize that that may not be exactly the same but if it can decide which ear is hearing it should be able to tell a servo to move in the direction of the loudest sound sensor.

PRO
Synthiam
#7   — Edited

Ptp, he’s merely trying to identify the direction of a sound. It should be straight forward with that sensor and adc though.

im wondering if a filtering cap would be useful. I have a sound sensor at the office. I’ll take a look at it this week and see if I can lend some advice

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

#8  

Thanks DJ.  I also think i can do it with sound sensors.  I think I can write the code once I get the voltages outputs from the three sound servo's.  I am using a Lol Tiny for testing since it has only two ADC0 and ADC1.  I will use the EZ-B microprocessor for the three sound servo's.

#9  

I have two questions concerning sound sensor that have come up.

  1. I am wondering if the wifi  is causing variations with sign wave on my Ez-b ADC Graph.  If you look at pictures at top you will see the difference between a sound generator and ADC Graph.  The sound Generator provides a solid tone same height signal.  It should cause the ADC Graph to show a solid voltage. What is going on? Am I wrong in my assumptions.

  2. I am looking at doing triangulation Location using time difference to calculate location of sound.  Where are the calculations of received signals calculated?  Will this work with this setup or do I need to have an on-board computer to eliminate WiFi slowdown.

#10   — Edited

@Ellis

  1. Yes, you are wrong in your assumptions Radio signals (wifi) and sound waves (sine waves in your case) are not even in the same ballpark as each other... I cannot see them interfering with each other

  2. It's kind of difficult to understand what you want to do sometimes as you seem to not quite understand it yourself.... Saying that you are way over complicating things.... You can easily calculate where the sound is coming from (left, right, centre buy using 3 cheap sound sensors) and a couple of lines of code... However if your goal is also to calculate range from the sound source you will need to buy some expensive sound hardware and have ptp write code for you.... In other words, forget it and just use a ping(s) in conjunction with your sound sensors to measure range...

FYI 3.3v - 5v Sound sensor This one worked for me no problem....

PRO
USA
#11  

Quote:

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 :)

PRO
USA
#12   — Edited

Quote:

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

DJ:

Quote:

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

Quote:

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: https://synthiam.com/Community/Robots/Altair-Robots-In-Servo-Magazine-294/comments 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 ARC.

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: https://www.seeedstudio.com/ReSpeaker-Mic-Array-v2-0.html 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
: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

PRO
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