Asked — Edited

2Nd H-Bridge To Control Wrist Movement

I want to add a 2nd H-Bridge to my robot to control the rotational movement of the wrists for the hands. I want to be able to do this using voice command and will be using the H-bridge listed in the add control panel.

I know that it will have to be done using scripting, but I don't know what to start for that.

Can anyone help me out here?


Dan S.


Upgrade to ARC Pro

ARC Pro is more than a tool; it's a creative playground for robot enthusiasts, where you can turn your wildest ideas into reality.


I'm at work now so cant go into great detail but it's easy to do. I've got three h-bridges running several dc motors in my B9 robot contriled by EZB. You attach the h-bridge to a dgital port on ezb. one pin for each direction and one for the PWM. Be sure to add a PWM slider in ARC to enable the voltage. Without setting the PWM level your H-Bridge will not put out any voltage. The higher the PWM setting the higher the voltage and the faster the motor will run. As far as scripting, I have many examples in my B9 Project. I cant post it right now but you can open it from the EZ-Cloud. Look for B9 Robot Control. Also you can look through my project thread by clicking on my user details and you will find the link there. Let me know if I can help at all.

Have fun!


There is a 2 H-bridge sample in the examples directory in ARC, one using a Movement Panel and the other using scripting.

The only thing that looks difficult to me is if both H-bridges are serial (like the HB4113 or two Sabertooth's "saberteeth?" in serial mode) but with R/C or 4 wire, should be easy.



Thanks guys I looked over the information you suggested and it still does not make and sense to me.

This robot will be operated using a Acer W510 Tablet only, so I am limited to what I can use for controls.

Heres what I have right now.

EZ-B board:

Foot Drive Motors D0 is hooked to my Robo Claw 2x30 motor controller to operate the feet motors <- is operational using the Touch Movement control and works with voice command as well.

Hand movement Motors D1 is hooked to the ENA & ENB pins on the L298N H-Bridge. D2 is hooked to IN1 on the L298N H-Bridge. D3 is hooked to IN2 on the L298N H-Bridge. D4 is hooked to IN3 on the L298N H-Bridge. D5 is hooked to IN4 on the L298N H-Bridge. Gnd and +5 pins of D1 are hooked to Gnd and +5 on the L298N H-Bridge. The VCC pin on the L298N is hooked to a 5V regulator to power the motors.

The Motors I am using are 5VDC gear motors that have no encoders or feedback control. Forward and reverse is done by reversing the polarity of the motor.

These two motor are mounted inside a 1" diameter PVC pipe I am using for the Arms and are hooked to the hands. There is no space for adding pots or encoders to provide feedback as to how far the motors have turned.

Here is my problem. I need to be able to use voice command only to operate the two gear motors that will be used to turn the hands left and right.

How do I go about doing this and which controls do I need to select? Right now I have two PWM sliders added to the controls for the left and right hands. I am assuming Port D1 on the EZ-B which is hooked to the L298N H-Bridge ENA and ENB would be the port needed to be listed in the PWM slider. Is this correct?

What controls or scripting would I need to move each hand independently using voice command only? I want the hands to move only 90 degrees one way and then back to the original position.

Arm Movement D8 uses 1/4 scale High Torque R/C servo connected to a set of gears to lift right arm up and down D9 uses 1/4 scale High Torque R/C servo connected to a set of gears to lift left arm up and down These are functional using voice command.

Eye Movement - Winking and Blinking D13 operates Right Eye Servo D14 operates Left Eye Servo Both are functional using Voice Command

Antenna Movement D12 operates and continous rotation servo <-- still working on the controls for this.

Audio Output / Sound D7 is connected to the Sparkfun MP3trigger using voice command which is functional.

Any help getting the hands to rotate using the H-Bridge control would be greatly appericated.

Dan S.


I am going to be doing very similar with my robot, and I am hoping to have some time to set it up this weekend or early next week. As soon as I have the H-bridge working with the robot hand and wrist I will post my configuration here for you.



Alan: Thanks I would appericate that. This is the only function that I do not have working on this robot and the Museum is hopeing to debute it to the public memorial day weekend. I would at least like to be able to make one arm raise up and the hand move back and forth like it is waving, even if I don't have the other hand move.

Here is what the robot looks like:

Dan S. User-inserted image


You really have to have some kind of feedback device when useing a h bridge. Without it your script well not know when and where to stop. Limit switches would be the easiest to stop at the same point each time. I guess you could write a script that would turn on the port, add a sleep command that's timed to where you want your arm to stop, then turn it off. Then the same on the other port to reverse direction. However I think your just asking for heartache if you try to do it that way.


That is a good idea Dave. My arm has a ratcheting gear so out can't go too far off I get my script tuning off, but some kind of limit detection would be even better, particularly for the gripper so it doesn't crush whatever I pick up. Drawing board and eBay time again:)


Dave: I think that is what I will have to do, as there is absolutley no way I can put any switches or pots to do any limiting. As you can see the diameter of the arms. I has to drill out the PVC pipe a 1/16 of an inch just to get the motor inside it. I am working with constraints that most robot builder do not have. I have to cram all the electronics and motors and servo in an existing figure and can not alter its outward apperance as it has to look like the animated graphics that the museum will be using to go along with the robot for the Museums wesite and interactive activities.

I am not worrying about the wrist movement being percise where it stops. the hands are easy enough to rotate if i need to make any corrections on the fly.

Would I use the digital ControlCommand() to do this?

Dan S.


If you want to use speech recognition here is what I would do, I would write a script that would turn the motor on an off, pause for a split second reverse and turn the motor on an off. That way when you say for example, "hello there please wave at me"' he's wrist will start turning back and forth. You don't really even need to add a digital control. Speech recognition start the script all by itself. You could however also add a control and assign it to that Digital port. That way you could turn the motor on and all of with those controls by hand from your laptop. I can't help you with the script right now but it would be really easy to write out. Just a matter of turning the digital ports on an off with a sleep function to get the proper timing.


OK, back home again from vacation and on my home computer now so I can send info better.

@thetechguru , Yes, I'm a big fan of limit switches. They have saved my butt more then once. As you know it's very easy to send your motor speeding away towards disaster or your fingers while your setting things up. Limit switches to cut power on each side of the radius and keep the tears away from your eyes. By adding a simple blocking diode on each switch you can easily revise direction. Without the diodes installed there is no way to back off the rotation because there is no power flowing. Blocking diodes allow power to flow one way but not the other so with them installed in the proper direction you can simply reverse your h-bridge when your rotation hits the switch and run it the other way. Here's one of my setups. You can see the switches to either side of the blue pot I use for location feedback:

User-inserted image

User-inserted image

@droidmech2002 , Try this script. You will need to adjust the values to your needs. Let me know how it works. Tip: start out with small sleep() times to keep your movements short but long enough to let the motor move to the proper place you want. Enlarge the times a little at a time till you get it right. This will hopefully keep you from having a runaway motor with no limit switches installed. (0500) = 1/2 second, (1000) = 1 second, (1500) = 1 1/2 second, exc:

# To Rotate wrist one way
# Adjust the Sleep() to get your timing right
#Replace Set() values to your ports
Set(D9, on)
Set(D9, off)

#add a Sleep() to pause between waving one and the other. Adjust value as needed:

# to Rotate wrist the other way
# Adjust the Sleep() to get your timing right
#Replace Set() values to your ports
Set(D7, on)
Set(D7, off)

Have fun and good luck! Dave Schulpi