H-Bridge Motor Control for DIY Servo

Servo pot

ignoblegnome, you mentioned the pot in the servo controller. Have you thought about replacing it with a pair of resistors as they sometimes do when converting a servo to full rotation?

You could try adding heat

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.

 

This would not help as I do

This would not help as I do need position feedback from the potentiometer.

h-bridge

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 can’t chill your own stuff

What does this comment mean?

You have not provided a lot

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.

feedback

Currently the motor in the servo case is not moving, so, neither is the pot. Could the pot be rotated slightly to get the servo board to think the servo is in the deadband?

Yes, this works fine. If I

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.

Have you had any luck with

Have you had any luck with the servo and hbridge issues? I am having the same problem as you with my set up of two hbridges side by side controled by two servo . Did you go with the optocouplers? What was your solution?

Never got this working, and

Never got this working, and it’s tabled for the long term.

The Problem is Not with Your H-Bridge its…

I know exactly what your problem is because I’ve done this exact thing already. The problem is with your servo outputs, ACTUALLY you can NOT directly connect your servo motor leads to your H-bridge. Here’s why, if you connect the servo motor leads to an o-scope, you’ll see that the pulses not only change polarity depending on the direction it needs to turn the motor, but at rest (when the pot exactly matches the PWM) it sits both motor leads outputs at 2.5 volts, NOT at ground. Now lets look at just one side of your H-bridge, and lets assume your driving it at just 5v, its got a PNP and NPN transister. The NPN is turned “on” when it gets anything above 0, the PNP is backwards, it is turned on with ANYTHING below 5, so, if you give your H-bridge 2.5 volts, BOTH the PNP and NPN are on at the same time! Thats a direct short to ground, no wonder you keep frying your power transisters! You need to connect the motor leads to a schmitt trigger or comparitor first to ensure that your h-bridge gets a control signal of exactly 0 or Vmot (24 in your case I think). Hope this helps!

Thanks for the comment. I

Thanks for the comment. I appreciate the input, though this project is on near-permanent hold.

I hear what you are saying about the h-bridge design. Though the problem I experienced was merely jitter. I never had an issue with shorting the transistors to ground and frying them.

I was using a low current bench supply, which probably can’t put out enough current to fry those power transistors. So it is possible that I was seeing the h-bridge short you describe, but never fried anything due to the current limitations of my supply. Had I been working with the two 12V DC batteries this driver was intended for, things may have been very different.

In any case, this is an abandoned design for the foreseeable future. 

Problem Solved

I understand this thread is “permanently benched” but I would like to put this issue to rest  for other readers who stumble onto it (like I did :slight_smile:

 

Yeah, I see now the “fryed and smoking” issues were not your comments but others, it’s good you had a current limiting PowerSupply.

 

The jitter problem is because even when the motor is stopped, all 4 transistors are still turned on allowing all available current to flow around the motor, not through it. The jitter is actually the result of the 2 sides of the H-bridge passing the current unevenly (because they are pegged) and the resulting tiny variations in voltage cause the motor to twitch. LOL, I feel so strongly on this matter I even drew you a diagram. Please see it here: https://www.robotshop.com/letsmakerobots/node/34692

Yeah, I agree the topic is

Yeah, I agree the topic is worth discussing for posterity. Thanks for taking the time to put this together. I’ve re-posted your picture below for reference.

Servo_Driven_H-bridge.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I was not aware that the servo’s control outputs (going into it’s internal h-bridge) worked that way. Edit: I meant the servo’s internal h-bridge output going to the motor. Duh.

Anyway, what you say makes sense. Some day I will get around to trying this out. I’m sure I’ll need a big, honking sized servo one day for something!

Question: If I use a Schmitt trigger on the outputs, won’t I run into a situation where I cannot really achieve the ‘virtual zero’ case you illustrate in your diagram?

Consider signal A in your top-left diagram. As the signal drops from 5V towards 2.5V, the hysteresis of the Schmitt trigger may keep the signal high, instead of allowing it to drop to zero.

Similarly, signal B will be approaching 2.5V from 0V. If it doesn’t quite hit the threshold, the signal will never go high.

Even if signal A or B do hit their threshold, if one or the other does not, you will get unwanted results. Say in your ‘Stopped’ diagram (2nd from the right along the top), if signal A doesn’t quite reach the Schmitt trigger threshold, it will stay high, and the servo motor will be turned on at half the normal voltage.

So I think you are on to something here, but the exact way to fix it may need some more thought. Maybe I can find a schematic for the h-bridge used in an actual hobby servo. The way they interface their h-bridge to the control circuit should already solve this problem.

Edit: Wait, maybe I get it. If I used a couple of comparitors, and set the threshold lower than 2.5V, let’s say 2V, Then the outputs will either be 0 or 5V. If the inputs are both around 2.5V, I’ll get both outputs at 5V. So I’d have to design a ‘smoke proof’ h-bridge for the final output stage. 

A comparator is a better

A comparator is a better choice here because it has a clear on/off point, but if you used a Schmitt trigger then it would need a very narrow hysteresis, so long as the drop out is till above 2.5 it would work the same. Either way, only the tops of square waves will trigger an output.

 

You don’t want the virtual zero, you only ever want to output a 0 or 5, so you really only care when the input signals are high, because the one that is high tells you which direction to turn, so when B is toggling between 2.5 and 0, you couldn’t care less, its not above 3 so leave it’s output at 0.

 

But turn the POT the other way will cause A and B to switch, now B goes between 2.5 and 5, so the output is 5, but now A is toggling between 0 and 2.5, but that’s not high enough so the output stays at 0.

 

I went ahead and made a video showing all these principals, please watch!

http://youtu.be/usYpLUsRRNo

have you succed

hello, Ignoblegnome (i like the name)

it’s been a long time since this post started but here i am the little frenchy facing exactly the same problems than all the one spoken in your post.

have you solved your problem and did you succed to control an Big motor through a H bridge using the parameters coming from the RC receiver.

I’m facing the same building and can’t find the solution.

look forward to hearing from you.

sorry for my english.

best

railman

 

Interesting!

Very interesting all of this, as I’m about to do the same.

I want to control an l298N with a servo pcb. Your solution works really good, well done! However I have another idea using only 2x 1N4148 diode I like to try out by myself.

Let me explain:

Voltage from servo stays at 2.5V wich is too high.

L298N’s Vih  (input high voltage) is 2.3V according its Datasheet. So actually the 2.5v needs only to be a little lower for the l298N to stay low. Therefore my idea is to simply put a diode in serie with it.

With the voltage drop (lets say 2.5V-0.7V=1.8V) It would stay low. the only downside of course is that a “high” 5V will only be 4.3V but this will not be an issue for the l298N

As soon I have some time I will give it a go.

Hello,
I searched for a long time and found what is inside a small modeling servos SG90 and MG996R. Maybe it will be useful to someone. Here is the link related to the integrated circuit KC9102 I found inside (KC9102 digital servo motor controller):
http://www.kcsemitech.com/upLoad/down/month_1902/201902261540192521.pdf