Asked — Edited

Hbridge Sound-Servo Control

Dear EZ-Robot Team and friends,

I want to control a 4 Wire HBridge PWM connected Motor with the Sound-Servo App or a similar program / script.

Its a mouth-motor from a toy, I cannot change the motor. so I want to use HBridge.

I dont wanna make a long script with mouth animations.. for 1-3 sentences its okay but for a conversation not.

Can someone help me ? is there a trick ?

regards Marty


Upgrade to ARC Pro

Join the ARC Pro community and gain access to a wealth of resources and support, ensuring your robot's success.


There is no positional feedback for an hbridge. Unfortunately it cannot be done. Can you use a hot glue gun and retrofit a servo?

A servo knows it's position. This is why servos are used in robotics for joints. An hbridge can only tell a motor to move forward or reverse and does not know the position of the output shaft. Hbridge is good for controlling the wheels of a robot, not joints.

Find out why servos are different than a regular motor by reading this tutorial:


Okay, all what I need is a little move forward if he talks.. there is a mechanism.. that change the mouth to the start position. is it not possible to move "forward" the 4 Wire HBridge PWM connected Motor if he talks?

thanks again :-) DJ


You can set up a talk servo our sound servo object with a virtual servo, then have a script that reacts to changes in position of the virtual servo (also, at least the sound servo object populate a variable. For instance, sound servo EZ-Bv4 populate $sound4value with the servo position.

The script could then send forward and pwm commands to the H-bridge based on the variable or virtual servo position.

Little bit of scripting, but definitely possible based on what you are trying to do.



It still won't work. There's no way to know when the mouth is open or closed. There's no feedback of positioning. It'll just be random movements with no positioning.

Use a glue gun and retrofit a servo is the best option.


Use the electronics of the servo to connect to the existing motor. And retrofit the pot for positioning


DJ, you didn't read what he said. He just needs forward, and speed (PWM). I am guessing the mouth is some kind of cog driven motor that just opens and closes as the motor spins. A lot of toys that uses motors are like that. I have a robot arm that just has clutched gears so when the arm reaches the extent, the motor can keep spinning but the clutch slips until I stop supplying power. It isn't nearly as good as servos, but it works.



@thetechguru thanks, that's it. the mouth goes to the normal position by mechanism. so I need only forward if the sound servo react.

I hope I get it. I leave the thread still "open".


Again, here's absolutely zero positioning. This means the software doesn't know when the mouth is open or closed to simulate speaking.

This also means when the sound is completed, the mouth will be left open.

If this is what you want, then you simply need to start the digital ports that move the hbridge before talking, and stop the digital ports after.

There is absolutely zero way a sound servo or talk servo can be used.

Even if you control the pwm with sound servo, it's going to be really terrible. It'll move fast and slow with sound but certainly won't look like speaking.

Either retrofit a servo to replace the motor -OR- connect the servo electronics to the motor and fit the positioning sensor somewhere.



Can you help me a little bit ?

Now I have opened the sound-board, HBrigde Movement, Sound servo EZB and EZ Script.

First I go to Sound servo and make a virtual servo like V1 then I copy/ Paste $Soundv4Value in the EZ Script and make a COde.

All what I need is " Forward(255,200)" if the V1 recognizes sound/ the soundboard play a sound.


Okay, I understand.. but my robot-mouth has an jump-spring... is the power off, the mouth goes very fast to the close-position by jump-spring - without any electronics.. all what I need is a power on/ off reaction If the Sound-Board play sounds. " Forward(255,200) "


Oh geez, then that's super easy.

Before each SayEzbWait() command, add the code to start the hbridge. Then after, add the code to stop it


Set(d10, true)
Set(d11, false)
SayEzbWait("I am speaking right now")
Set(d10, false)
Set(d11, false)

Or, if you're using pwm on the hbridge, simply connect the pwm to a servo port and use Talk servo control. Initialize the hbridge to always be on by either hard wiring the direction or connect it to the ezb and init script such as

Set(d10, true)
Set(d11, false)


@DJ @Thetechguru

I want to use my own "german" MP3-Sounds with the soundboard 4 + sound servo ezb 4. I want to play selfmade voice sounds and the 4 Wire HBridge PWM must powering on " Forward(255,200) " if the sound servo recognized sounds.

Is it easy, too ?