Let's Make Robots!

H-Bridge Motor Control for DIY Servo

I'm building a DIY servo for steering Yard Gnome. I'm testing some things out while I wait for the 24VDC 30 rpm 41 in-lbs gearmotor I ordered to arrive.

I'd like some advice on my controller.

H-Bridge

I'm designing a fairly straightforward H-bridge like the one Weiss posted here. I'll be using two TIP127 PNP transistors and two TIP120 NPN transistors for the main H-bridge. For interacing to the drive signals, I'll using a pair of PN2222A NPN transistors, because I have a bunch of them. My test circuit right now is using 1N4004 diodes like in Weiss' design, but I will substitute some 3A 1N5402 transistors for the final implementation.

(click for larger image)

I have successfully tested the H-bridge running at 16VDC (the limit of my bench power supply) driven by 6V from 4xAA batteries.

I'm hoping this H-Bridge will have plenty of current handling capacity at the nominal 24VDC from the batteries to drive the motor mentioned above, I don't have the motor stall current specs, but I'll take some measurements when it arrives.

Servo Controller

My biggest question right now is how to drive the H-bridge above from the servo controller. I was planning to either buy a controller that is designed to work with a standard DC motor and potentiometer, or rip a controller out of an existing servo. The key point is that I need the high current and 24V capabilities of the H-bridge to interface between the motor and the servo controller. My question is, how do hook them up?

If I use a servo controller out of an existing servo, can I simply disconnect the servo's own motor, and use those leads to drive the H-bridge above? 

(click for larger image)

Update 2010-06-05

I decided to go ahead and try driving the H-bridge from a servo. It worked! I desoldered the servo motor and hooked the leads to the two input signals for the H-bridge. Now if I either manually move the potentiometer on the servo, or use my R/C controller to tell the servo to move, it drives the motor through my H-bridge.

However, when the motor is not moving, it continuously jitters. I'v'e tried slightly adjusting the servo potentiometer and using the trim controls on the R/C transmitter, but nothing helps. Maybe some capacitors on the driven motor will smooth things out.

I posted a video so you can see what I'm talking about.

AttachmentSize
YG_H-Bridge1.jpg24.55 KB
YG_Servo_Controller1.jpg14.87 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

After some more testing, I found that as soon as I connect the 6V batteries to the circuit, it drags the 16V supply down to 3-4V. I think I need a way to interface the two circuits. I'm thinking optoisolator.

Without a circuit diagram it's ahrd to figure out why your 16V drops to 3V. Seems to me this could be easily prevented with a clever diode somehwere.

OK, I added dagrams for the H-bridge and servo controller. To keep it simple, they are separate diagrams, but the inputs/outputs are labeled. The grounds of the two circuits are connected.

When power from the 6V battery is applied to the R/C receiver and servo, the 16V supply for the H-bridge drops down to about 3.4V. While I'm causing the motor to turn via the R/C transmitter, I monitored the voltage on one of the outputs of the servo board that is now driving the H-bridge. The voltage was a bit over 5V and the 16V supply goes up to about 10V.

You can see on the video that initially the multimeter is reading almost 16V, but after I connect the 6V battery you will see (at about 1 min 50 seconds) that the supply has been dragged down to between 3 and 4 volts. Then when I use the R/C transmitter you will see the supply voltage jump briefly up to about 10V

My thinking is that the 0-5V range of the servo board drag the supply down through the voltage drops of the transistors. When the servo outputs are at 0, the supply is dragged down to 3.4V. Turning the output high to drive the motor, the supply is not dragged down nearly as far.

This is why I'm considering an optoisolator. I can keep the power supplies and signal levels for the two circuits completely isolated.

I always find it much more educational to strip my circuit ad test it in all feasible modes. How about you remove the servo board and replace those signals with plain pullup (to 5V) / pulldown resistors. Measure your 16 V supply and make sure to also measure the current drawn.

My suspicion is that current (and lots of it) is flowing out the inputs, or at least somewhere in your bridge. Find the flow and you'll find the flaw. What happens when you increase the 1k resistors to 10k or 100k? Does the current draw plummet? Proportionally?

Side note: An optoisolator is basically a photo transistor actuated by a built in led. You could probably use them to replace the input transistor (pn2222). If the isolator happens to be NPN.

I tried a quick test replacing the 1k resistors on the bases of the PN2222A transistors with 10k, 100k, and then 1M and measuring the voltage put out by the supply.

Increasing the resistor values did not seem to have an appreciable effect. The voltage still dropped to about 3.4V at the supply, and rose to around 10V when the motor was running.

I do agree that a lot of current is probably flowing into the inputs of the servo board. Since my bench power supply cannot support a lot of current, it is pulling the voltage down. If I was connected to my 24V battery, it might keep the voltage up, but I think I need to fix the current drain/voltage drop problem before moving forward.

I think my next step is the optcouplers. Thanks for the idea of using the output stage to replace the PN2222A transistors, I'll try that. My only concern on using optocouplers is ensuring they are fast enough to respond to the output of the servo board. If they introduce a lot of delay, it could make steering sloppy or worsen my jitter problem instead of solving it.

Excellent points, rik and I agree with your approach.  I already tested the motor with the H-bridge alone as you suggested before hooking it up to the servo board, and it works perfectly with no voltage drop and no jittering of the motor.

I will try adjusting the resistor values and see if that helps. Good thought. If not, it's off to find some optocouplers!