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
Brazil
Asked — Edited
Resolved Resolved by Dave Schulpius!

Soundservo Control

friends, I've been trying to use the SoundServo control to animate the mouth in one of my robots.
I'm using the EZ-b4 soundservo.
but.. it does not respond in sync to the sayezb command...
sometimes it does not move at all.
someone knows how to set it up correctly in order to sync sound and the servo movement ?
thaks...

AI Support Bot
Related Content
Synthiam
United Kingdom
#6  
I can confirm those small blue servos don't like 7.4v at all, mine gave up working quickly after applying 7.4v to it.
Brazil
#7  
are you shure that the speaker should be near the board ?
I mean, when using sayEZB it does not send the sound value to the soundservo ? instead the sound must be "listen"by the MIc ?!
United Kingdom
#8  
The Sound servo (EZB) control doesn't use the mic.
Brazil
#9  
Now I'm trying to power the servos from another source (with only 6V).. But still not good...
It does not sync at all!
*stress*
Brazil
#10  
Does anyone have a script that uses the $SoundValue to move the servo?
I tryed to write one.. But I'm not the script guy yet...
4 positions (close, barely close, barely open, open) I think would work..
What do you think? *confused* *confused* *confused* *confused*
United Kingdom
#11  
I wrote a script similar to that a while back but it would probably take longer to find than it would to write...

Code:


# Variables, change to suit
$closed = 0
$halfclosed = 60
$halfopen = 120
$open = 180

# The script - assuming servo on D0. Adjust IF and ElseIf values to suit.
:begin
IF($SoundValue = 0)
Servo(D0, $closed)
ElseIf($SoundValue < 5)
Servo(D0, $halfclosed)
ElseIf($SoundValue < 10)
Servo(D0, $halfopen)
Else
Servo(D0, $open)
EndIf
Sleep(250)
Goto(begin)


Obviously modify to suit and be aware this was written without ARC and without much thought. There may be a better method but the basics are there for you.
#12  
Rich, wouldn't the halfclosed part always be on because of the 0 for closed(its less than 5)? I know this was a half-hearted write but just to make sure.
United Kingdom
#13  
Nope. And I am glad you asked the question as it leads on to how the script is run and read by ARC.

The IF nest checks the IFs in order so in the above we have

Code:

IF($SoundValue = 0)
ElseIf($SoundValue < 5)
ElseIf($SoundValue < 10)
Else


When the IF nest finds a statement which is true it will run the code after that statement but before the next. Once it has found a statement to be true and run the code after that statement it then jumps down to the EndIf.

The formatting of an IF nest helps explain it and helps write scripts.

So for instance, if the sound value variable was 7 I will explain the steps which will be run by ARC...

Code with line numbers and comments and settings removed to make it clearer and easier;

Code:

01 :begin
02 IF($SoundValue = 0)
03 Servo(D0, $closed)
04 ElseIf($SoundValue < 5)
05 Servo(D0, $halfclosed)
06 ElseIf($SoundValue < 10)
07 Servo(D0, $halfopen)
08 Else
09 Servo(D0, $open)
10 EndIf
11 Sleep(250)
12 Goto(begin)


So taking $SoundValue as being 7 the script would run the following lines in this order...
01, 02, 04, 06, 07, 10, 11, 12, 01, 02 etc...

Notice that when the IF or ElseIf isn't true it doesn't run the code between the IF or ElseIf, it jumps to the next ElseIf or Else.

When it is true it runs the code after it (line 07) then jumps to the EndIf since a statement has been satisfied.

The order in which the If and ElseIfs are put makes a big difference.

So another example, this time $SoundValue is 0 the script would run the following lines in this order...
01, 02, 03, 10, 11, 12, 01, 02 etc.

If $SoundValue was 4 he script would run the following lines in this order...
01, 02, 04, 05, 10, 11, 12, 01, 02 etc.

If the $SoundValue was 11 the script would run the following lines in this order...
01, 02, 04, 06, 08, 09, 10, 11, 12, 01, 02 etc.


So once a statement is found to be true it stops checking the other statements hence the command being ElseIf.

Think about it this way, you see a colour on a piece of paper, someone asks you what colour it is out of Black, Blue or Red...

Code:

If you think it's black
Say Black
Else, if you think it's blue
Say Blue
Else, if you think it's red
Say Red
Else
Say I don't know


If it was black you wouldn't keep thinking about if it was blue or red, neither does an IF nest.

Hopefully that's explained it clearly.
Brazil
#14  
No matter what I do.. I just can't put that to work..
The servo does not respond in sync to the sound.

When I power the EZB with 7.5 volts and plug the servo on (say.. D0) I always get the message "battery is low.."
I tried do feed the servo from another source.. but it simply do no move at all!

I am sooo frustrated.. The soundServo was a big thing to me to wait for the V4...
Thanks for ANY HELP!
#15  
By default the low voltage warning is set at 6.6v... Are you sure the battery you are using is at 7.5V? Maybe you need to recharge it...? What battery are you using? If you are using a wall adapter, make sure it can supply more than 2 amps... Servos need power, a 1 amp adapter cannot supply enough power to run the EZB4 board and even 1 servo.... Something like this (below) would give you lots of juice...
User-inserted image
United Kingdom
#16  
If it's 7.4v and stating it's low it needs charging.

Depending on the battery type and the voltage level you may need to replace the battery.

Check the voltage with a multimeter or connect it with no accessories connected to the EZ-B. Check the voltage then. It could be a faulty servo which, when attempting to move, creates a huge voltage drop, this may happen for many reasons so it's worth testing the servo and testing the battery.
#17  
Good point Rich.... Does the servo move properly when you just use it with the basic horizontal or vertical servo control? Maybe your servo is faulty as Rich suggests?...
#18  
I know when you cue a sound, there's a slight delay when sending it to the ez-b but it would cause the servo to be delayed equally though.
United Kingdom
#19  
@Technopro, I believe you are suffering from an issue with your EZ-B or network if you have a delay between hitting play and it playing. If you watch my unboxing videos the sound is instant (and I have very high network traffic too but a fast ethernet).
#20  
This is direct to the ez-b on ap mode. Everybody says I've gone mental but I have slight delays(1/2 of a second max) from time to time in the camera and in sound transfer.
United Kingdom
#21  
It could be the network card in the PC. My old sony vaio suffered a lot due to a poor wifi card, a few other things I have also drop a lot for no real reason. Other things suffer no problems.

Id say give the ez-b a try on a different PC or a different wifi dongle just to test it.
Brazil
#22  
ok folks.. I tryed all the sugestions. Another computer, another dongle.. and, I am still not able to sync perfectly the jaw with the sound on EZ4...
So what I did was incorporate an "audioservocontroller" board... (http://www.audioservocontroller.com/)
And that works great, even if getting sound from EZ-4 (I soldered the wires from the points indicated on the board to get the sound from ezb to audiocontroller...)

Of course it was not the best solution I was looking for (since if we could use only the EZ-B would be much better..)
So.. Any other Ideas ?!
thanks
#23  
Hi @tevans, that sound board is really cool and looks like a good solution. I see nothing wrong with taking the load off V4 EZB. That little wonder has it's hands full already so why not give it a break if things run smoother and you have the room. I myself use a different sound controler to flash the neon in sink with voice files on my B9 robot.
Brazil
#24  
Yeah... It's the best solution for now.
But I can think a dozen of uses to sound servo feature, so I hope it works better in the future.
Thank you guys for your replies.
You rock!
:)