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?
Upgrade to ARC Pro
Get access to the latest features and updates with ARC Early Access edition. You'll have everything that's needed to unleash your robot's potential!
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.
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.
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.
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
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.
Here is what the robot looks like:
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.
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?
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.
@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:
@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:
Have fun and good luck!