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.


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.

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.

Yes, this works fine. If I leave the potentiometer alone and command the servo/motor to move with my RC transmitter, it turns but does not stop, since the potentiometer is not moving. If I leave the RC transmitter alone, but move the pot, the motor moves to match its position.

When I get the motor to run without all the jitter, I'll get the potentiometer hooked up mechanically to the motor or the steering linkages.

I forgot to mention.  I am using a servo motor output  like you have on the schematic to drive my motor.

My motor does not jitter but it is a DC brushed type, and like I said it works great on 9v.  Just not the supply I need

User Jerry asked via PM about my H-Bridge. I thought I'd answer in the forums rather than directly.

Jerry asked:

Did you get the jitter out of the motor?  I am trying to hook up a motor
using this simple H-Bridge design, bought the parts, but it seems like
maybe I am missing something.  As I look closely at the photo of the
breadboard, I was wondering if the NPN 2222s are supposed to be reversed,
or maybe I have the wrong Tip connected.  I can not seem to get the motor
to reverse when I use my throttle control.
Looking for a suggestion.

I'm still dealing with the jitter for now. But keep in mind this was an H-Bridge being fed by the electronics of a servo I tore apart. The servo already has an H-Bridge, but it won't handle the voltage I want to drive this motor at. So I'm dealing with a servo PID algorithm designed for a different motor, driven through the original servo h-bridge, then driven through my own h-bridge. Not ideal.

If all you are trying to do is drive a motor with the h-bridge above, it should work fine with no jitter at all. See my comment above.

My advice is to double-check the datasheets for all of your transitors and be sure you have them all wired correctly. Then try setting one of the inputs to the h-bridge (the base of one 2222A transistor) high. Now use a multimeter and test what is happening. Did the 2222A transistor turn on? Is it triggering the PNP and NPN power transistors to turn on the motor in one direction? Verify each component is working.

After further investigation, I did have the 2222s reversed.  I forgot the pin out is reversed from the bottom of the transistor

Thanks a lot.

Anyway, the great news is, it works perfectly with a 9 v battery I used for a supply for my motor.

I decided to increase the voltage so I got a 12v lawn/tractor battery.  That is my objective.  Then, the TIPs started smoking and got very  hot.  It really made the motor run as fast as I wanted, but after a few times, I think they fried because the circuit won't work anymore even on the 9v battery I started with.

The motor only draws less than 200mA when put directly on the 12V battery.  It does not seem like that is too much.

Could you offer a suggestion?


You could try adding heat sinks, but if your motor really only draws less than 200mA, it may not be necessary.

Did you accidently turn on both sides of the h-bridge at the same time? The design does not include protection for this. If you look at a basic h-bridge schematic, and imagine both inputs high, you will notice that this would result in each pair of transistors in one "leg" of the H to be on at the same time. This shorts power to ground through the transistors, drawing tons of current. Very bad.


What does this comment mean?

I replaced one of the TIP 127s that burned up.  Again, as I power it with 9V it works great.  Forward and reverse.

I then apply the 12V supply and it starts smoking again.  I checked it with the 9V back on it and it still works ok.  So it must not have burned it out.

Do I need to turn on my transmitter first or receiver first?  As I turn them on, could it be shorting out somehow?

I have noticed that when I turn on the receiver or transmitter there is a little movement in the motor.

Thank you

You have not provided a lot of detail on what you are doing, so it is difficult to give you a complete answer. Maybe you should post your own question to the forum, and provide a complete description of your setup. Pictures or diagrams would help a lot too.

If your TIP127s are burning, you are pushing too much current through them. Those things can handle 5 amps, so you are doing something wrong if they are getting hot with a 200 mA motor.

It is likely that your 12V battery can supply much more continuous current than a standard 9V battery. That may be why it is not burning the transistors with the 9V, but it doesn't mean everything is OK.

Please post your question to the forums with as much information as you can and we'll try to help you out.

the same as without them.

My optocouplers came in yesterday. I tried replacing the PN2222A transistors that drive the H-bridge in the schematic above with optocouplers. The good news, it works. The bad news, the motor still has a major case of the delirium tremens.

I may keep the optocouplers in the design, since I still haven't tried the circuit at the nominal 24VDC from the batteries. However, jittery motor remains a problem. Grrrrr.

After some further experimentation with the servo and h-bridge, I think I'm going to try a slightly different approach.

I tried running the original servo motor, but with my H-bridge circuit in between. My thought was that the servo controller was tuned for this motor. Unfortunately, I saw similar behavior to the other motor: too much jitter. 

Since my new 24V motor had arrived. I replaced the temporary gear motor I was using with the new 24V one. I had similar results. Actually, I think the jittering was even worse.

Now the coils for my new motor measure at 70 ohms. So I figure the stall current at various voltages:

  • @ 6V: 6 / 70 = 85.7 mA
  • @ 24V: 24 / 70 = 342.8 mA
  • @ 28V (maximum battery voltage): 28 / 70 =400 mA 

By comparison, the original motor from the servo has a coil measuring 17 ohms:

  • @ 6V: 6 / 17 = 352.9 mA

Based on this, I decided it would be safe to try to drive the new motor directly from the servo controller, without my H-bridge in between.  The motor ran fine, but far too slowly. Since the motor is rated at 30 rpm at 24V, it is very slow at 6V. The good news is I learned the servo controller could drive this motor without jitter.

So I think I will abandon the idea of an H-bridge in between the servo controller and the motor. I had originally thought about placing some optocouplers in between the controller output and the H-bridge to eliminate any interference. Since I have already ordered the optocouplers, I think I will try using them to interface to the new motor, only with no H-bridge.

Servo controller -> Optocouplers -> High voltage transistor (possibly) -> Motor

My thinking is that with an open collector optocoupler, I can simply translate the output of the internal servo controller's H-bridge to a higher voltage to drive the motor. As long as I can source 400 mA (the motor's stall current at 28V), I think this may work. Hopefully the simplicity of this design will allow the servo controller to drive the new motor with enough speed and torque, and without introducing the jitter.

It is possible the jitter will return when I drive the motor at higher voltages. Only time will tell.