# Introduction

In this article I’ll talk about one of the popular drive-modes of H-bridges, the Sign-magnitude drive in detail. If you’re not familiar with H-bridges in general, I suggest you read the previous part of the series first, where we’ve looked at the basic operating principles of an H-bridge and went through the various meaningful operating modes.

Let’s quickly review the basics first! Our H-bridge looks like this: We will also make use of our motor equivalent circuit that I’ve introduced before:

# Basic operation

In sign-magnitude drive, we have four control modes to choose from:

Mapping 1 | Q1 | Q2 | Q3 | Q4 |

on-time state | close | open | open | close |

off-time state | close | open | close | open |

Mapping 2 | Q1 | Q2 | Q3 | Q4 |

on-time state | close | open | open | close |

off-time state | open | close | open | close |

Mapping 5 | Q1 | Q2 | Q3 | Q4 |

on-time state | open | close | close | open |

off-time state | close | open | close | open |

Mapping 6 | Q1 | Q2 | Q3 | Q4 |

on-time state | open | close | close | open |

off-time state | open | close | open | close |

These modes describe the way we map the states of the four switches to the ‘on-time’ and the ‘off-time’ of our PWM control signal. If you carefully investigate these tables, you’ll see that the four options describe the four possibilities for two binary choices: whether to keep the a-side or the b-side in a constant state, and whether to keep the low-side or the high-side switch closed continuously.

You will see pretty soon that one of these binary choices is usually made statically, while a control signal is used to decide between the remaining two choices.

However, for now, let’s just concentrate on mapping 1 and see, how the bridge operates! As the mapping tells us, during the on-time, Q1 and Q4 are closed. This means that the left-side of the motor is connected to V_{bat}, while the right-side is grounded. Current can flow from the supply through the motor:

When the off-time comes along, Q1 stays closed, but Q4 opens and Q3 closes instead. In this state, there’s no path from the supply to ground through the bridge. However, both of the motor terminals are connected to V_{bat}, basically short-circuiting the motor. If there was current flowing through the motor at the time the switch-over happened, that current can continue circulating around the in that loop:

The voltages and the current through the bridge will follow the following wave-forms:

The average voltage the motor sees can be calculated as the following:

V_{mot_avg} = V_{bat} * t_{on}/t_{cycle}, where t_{cycle} is the cycle time, and t_{on} + t_{off} = t_{cycle}

From this equation something should be immediately obvious: this mapping can’t move the motor backwards. For that we would need to be able to apply a negative (average) voltage to the motor terminals, but that’s not possible: the motor voltage can only be adjusted between 0 and V_{bat}. That would be a problem, but if we do the same math for mapping 5, we’ll see that in that mode, the opposite is true: that mode can only turn the motor in the reverse direction and the average motor voltage can only be between 0 and -V_{bat}.

In order to make a functional H-bridge, we need to employ both of these mappings and introduce a control signal that can choose between the two. This is the origin of the name of the drive mode: one control signal – the one that chooses between the two mappings – is used to determine the ‘sign’ of the voltage applied to the motor, while the other – the PWM signal – is used to determine the ‘magnitude’ of that (average) voltage.

The remaining two mappings are only slightly different from the previous two: the difference is that, during the off-time, instead of the two high-side switches, the two low-side ones are turned on. This means that the motor terminals are both connected to ground instead of the battery, but they are still shorted together and the motor current still circulates inside the bridge during the off-time:

# Current flow

Let’s take a closer look now at the way the current flows in the system! During the ‘on-time’ the motor inductors see a voltage difference of V_{bat}-V_{g} (provided the motor rotates in the same direction, the bridge tries to rotate it). If we disregard the internal resistance of the motor for a minute (or assume that the switching frequency is much higher than the electrical resonance frequency of the motor) this voltage will create a linear current ramp on the inductor (dI/dt = V/L_{m}). Since we assume V_{bat} is constant, the slope of the current increase will be determined by V_{g}, or in other words by the speed of the motor.

When the motor runs under no load V_{g} is very close to V_{bat}, so the current will change very slowly. If the motor is stalled, the current will rise much faster, as V_{g} is 0. The fastest current rise will happen if we abruptly change the drive direction from full-speed one way to full-speed the other way. In that case V_{g} will be close to V_{bat} in absolute value, but reversed in polarity.

During the off-time, the motor is short-circuited. If we disregard the internal resistance of the switches and the motor, the current can flow without interruption, and the inductors see V_{g} between their terminals. The current will start decreasing linearly, determined by the generator voltage and the motor inductor.

# Steady State

We say the bridge operates in a steady state if the cycle-to-cycle averages if the various parameters (voltages, currents) remain constant. The motor doesn’t accelerate nor decelerates and outputs a constant torque.

If things don’t change from cycle-to-cycle, it means that the motor current at the beginning of a cycle must be the same as at the end. Of course this doesn’t mean that the current stays constant during the cycle and this current-change is called ripple-current. Assuming linear current change during both the on- and the off time, the current deltas are the following:

I_{ripple} = (V_{bat}-V_{g})/L_{m}*t_{on} = V_{g}/L_{m}*t_{off}

If we express V_{g} from this, we get:

V_{g} = V_{bat}* t_{on}/(t_{on}+t_{off}) = V_{bat} * t_{on}/t_{cycle} = V_{mot_avg}

What we get is this: in a steady-state, the generator voltage must be equal to the average voltage the motor sees. The average current will be whatever it needs to be to reach that condition. Now, if we put this V_{g} back to the current equation, we get this:

I_{ripple} = V_{bat} / L_{m} / t_{cycle} * t_{on}*t_{off}

and since t_{off} = t_{cycle}-t_{on}:

I_{ripple} = V_{bat} / L_{m} / t_{cycle} * t_{on}*(t_{cycle}-t_{on})

This is a second-order function (a parabola) with its maximum at t_{on} = t_{cycle}/2. So the ripple current reaches its maximum at 50% duty cycle, and its value is:

I_{ripple_max} = V_{bat }/ L_{m} * t_{cycle}/4

## Reality Check

If you recall, the generator voltage is proportional to speed and current is proportional to torque. From the previous chapter it seems as though we have perfect speed control: the speed which is proportional to the generator voltage is equal to the average voltage seen by the motor, which in turn only depends on the duty cycle of the PWM input, our control signal. The torque (current) on the motor will be whatever it has to be to make that happen.

There’s something wrong with that picture isn’t here? After all we know that DC motors don’t keep a constant speed under load changes without any control circuit. True, and it’s easy to see what the problem is: we disregarded the internal resistance of the motor (and the switches).

Once you take those into account, you’ll see, that the motor current drops some voltage on those resistors, and the inductor sees only the remainder. (In the following equation I’ve made the simplification to assume that the motor current doesn’t change much, so the voltage drop on the resistor is relatively constant during the on- and off-times.)

V_{L_on} = V_{bat} – V_{g} – I_{mot_avg}*R_{m} during the on-time and

V_{L_off} = -V_{g} – I_{mot_avg}*R_{m} during the off-time.

If you put this into our previous ripple-current equation, you’ll see the result is a current- (or torque-) dependent difference between our intended speed and the actual speed of the motor:

V_{g} = V_{bat} * t_{on}/t_{cycle} – I_{mot_avg}*R_{m} = V_{mot_avg} – I_{mot_avg}*R

# Input Capacitor

In the previous chapter we calculated the ripple current, but we kept saying that the average motor current (in the ideal case at least) will settle at whatever level it needs to to make V_{g} equal to V_{mot_avg}. This statement has an interesting consequence: we can’t predict the direction the current will flow during the on-time and the off-time. In fact, if I_{mot_avg} is lower than half of I_{ripple}, the motor current changes direction twice during the cycle:

Now, one of those direction changes happen during the off-time, when the motor is short-circuited, but the other happens when the motor is connected to the supply. What follows is that at the beginning of every on-time for a short while at least, the current flows out of the bridge. Most supplies can’t deal with this quick reversal of current flow and if the reverse-current can’t find its way back to the power supply, the supply voltage will start rising potentially to dangerous levels.

To handle this reverse current properly we need to put a capacitor on the input terminals of the bridge to temporarily soak up the current coming from the bridge. The capacitor will release it’s extra charge back into the motor in the part of the cycle when the current flows to the ‘proper’ direction:

But just how big this capacitor needs to be? Well, that depends on a lot of things, so let’s list them:

- How much reverse-current can the power supply handle?
- How much voltage-hike can the circuit live with?
- What are the motor characteristics (mostly inductance)?
- What is the switching frequency and duty cycle of the bridge?
- How much torque the motor needs to output (the average current through the motor)?

Since some of these parameters are dependent on the operating conditions and the exact application, let’s first do some simplifications and assume worst-case conditions:

- Let’s assume the power supply can’t take any reverse current
- Let’s also assume that I
_{mot_avg}is 0, so the current changes direction exactly at half of the on-time. (The capacitor can’t be sized for the condition when even I_{mot_avg}is reverse compared V_{mot_avg}, since in that case the capacitor can’t completely release its extra charge during the cycle. We will discuss that situation later). - Finally let’s assume that the ripple current is at its maximum, so the duty cycle is at 50%

Under those conditions, the current will rise for 50% of the time, and cross 0 at 25% of the total cycle time:

The total charge released back to the system during the first-half of the on-time is:

Q_{release} = 1/2*((I_{ripple_max}/2)*t_{on}/2)

We also know that

t_{on} = t_{cycle}/2

Finally we know our ripple current is at its maximum:

I_{ripple_max} = V_{bat }/ L_{m} * t_{cycle}/4

Putting these together and do some simplifications, we get:

Q_{release} = 1/64 * V_{bat} / L_{m} * t_{cycle}^{2}

If we assume that the power supply can’t take any of this charge as we’ve said before – in other words all of it needs to be stored in the capacitor – the capacitor voltage will rise:

V_{bat_ripple} = Q_{release}/C

So if we know how much change in the supply voltage we can tolerate, we get a capacitor value:

C = Q_{release}/V_{max_bat_ripple}

Substituting Q_{release }we get:

C = 1/64 * V_{bat}/V_{max_bat_ripple} / L_{m} * t_{cycle}^{2}

Note that the term V_{bat}/V_{max_bat_ripple} is the ratio between the supply voltage and the ripple voltage allowed on the it. If for example we allow for 5% ripple, this value is a constant 20 independent of the supply level. Also note that the capacitance value needed increases quadratically with the cycle time.

I’ve measured a few motors, and the lowest inductance value I’ve seen was in the order of 30µH, but of course this value varies a lot from motor to motor. So, to give you actual numbers, let’s take that 30µH inductance value, allow for a 5% ripple on the power supply and a 20kHz switching frequency. With that, we get a minimum ~26µF of capacitance needed on the power supply. If we only want to switch at – let’s say – 1kHz though, the capacitance needed is more than 10000µF!

# Transient states

Whenever V_{g} is not equal to V_{mot_avg}, the bridge is not in steady-state. When it is lower, the motor is accelerating, when it is higher, it is braking. We’ve seen above that the on-time current change is:

I_{delta_on} = (V_{bat}-V_{g})/L_{m}*t_{on}

while the off-time current change is:

I_{delta_off} = V_{g}/L_{m}*t_{off}

Let’s express V_{bat} from V_{mot_avg} and put that into the first equation! We get:

I_{delta_on} = (V_{mot_avg}-V_{g})/L_{m}*t_{on} + V_{mot_avg}/L_{m}*t_{off}

Next, let’s see what the difference between the current at the beginning of the on-time and the end of the off-time:

I_{delta_cycle} = I_{delta_on} – I_{delta_off} = (V_{mot_avg}-V_{g})/L_{m}*t_{on} + V_{mot_avg}/L_{m}*t_{off} – V_{g}/L_{m}*t_{off}

After some re-arranging:

I_{delta_cycle} = (V_{mot_avg}-V_{g})/L_{m}*t_{cycle}

In other words, the motor current changes from cycle to cycle proportionally to the difference between the intended generator voltage (V_{mot_avg}) and the actual generator voltage (V_{g}).

Since current is proportional to torque, this means that if there’s a difference between the two voltages, the torque will start changing linearly. In this simple model, the current would keep changing forever, but in reality that of course isn’t the case. For one, internal losses limit the maximum current as we’ll see in a minute, but eventually, the changed torque would hopefully change the motor speed as well, bringing it closer to V_{mot_avg}, slowing down the current change. Eventually a new steady-state is reached where V_{g} is equal to V_{mot_avg} and the torque changed to a new value that is needed in order to maintain that balance. (If you read the article on motor modeling, you’ll see that in many cases the motor and the attached mechanical system can be modeled as a large capacitor and some sort of loss. That capacitor, with the internal internal resistance of the motor determines the time-constant by which this new steady-state is reached, and the actual response will be closer to an exponential curve.)

## Braking

Now, this is all fine for acceleration, but there’s something strange that happens during braking. When V_{g} is higher than V_{mot_avg}, the torque (current) will start decreasing. As the electrical time-constants are usually several orders of magnitude lower than the mechanical ones (again, see the article on motor modeling for the details), the current (and the torque) turns the opposite direction to the shaft rotation (generator voltage).

Let’s see how big this reverse current can be, but in order to do so, we’ll first have to re-introduce the motor resistance into our model. The reason is that without the resistor, the motor current will just keep decreasing (or increasing in the negative direction) until the generator voltage changes and becomes equal to V_{mot_avg}. In other words, without the resistor, the motor current can be an arbitrarily large negative number. With the resistor in place however, the bridge will quickly settle to a constant cycle-to-cycle current, as the voltage drop on the resistor will put an end to the current-increase over the inductor.

Once that happens, we can use our steady-state equations, to figure out the average current:

V_{g} = V_{mot_avg} – I_{mot_avg}*R_{m}

and solving that to the current, we get:

I_{mot_avg} = (V_{mot_avg}-V_{g})/R_{m}

The reason the system can be in steady-state, while V_{g} is not equal to V_{mot_avg} is the internal motor resistance. What happens is that the internal resistance of the motor makes the cycle-to-cycle current change zero, which was the initial assumption in deriving the steady-state equations.

You can also see, that the average motor current is negative, as expected. It means that the torque is in opposite direction to the shaft rotation, so we are in fact braking the motor.

During the off-time this current is circulating through the motor and either the two low- or the two high-side FETs. However, during the on-time, the only way for the current to flow is through the supply. While the current through the motor is always in the ‘negative direction’ – more precisely opposing the generator voltage – the same current flows into the supply in the positive or negative direction, depending on which way the FETs are open during the on-time:

or

This current either charges the battery (first case), which is called regenerative braking or dis-charges it (second case), which is called dynamic braking.

### Regenerative braking

While one would think that re-charging the battery is a good thing, there are two serious limitations to the effectiveness of regenerative braking:

- As we’ve seen, the average current during braking depends on the difference between V
_{mot_avg}and V_{g}, and reaches its maximum when V_{mot_avg}= -V_{bat}. However, re-charging only happens if the current flow goes against the battery voltage, so we can’t operate the bridge in the reverse direction. This limits the amount of torque that’s available during regenerative braking. If more torque is needed, the bridge needs to operate in the non-regenerative (dynamic braking) domain. The regenerative braking torque will also decrease as the speed (V_{g}) decreases: it’s not possible to provide a constant deceleration down to 0 using regenerative braking alone. - Even though the motor braking current gets greater, as V
_{mot_avg}gets further away from V_{g}, that doesn’t mean that all that current will re-charge the battery: only during the on-time does the current flow through the battery. As you decrease V_{mot_avg}to increase the braking current, t_{on}will decrease as well and the re-charging effect will decrease with it. To be more precise, the amount of energy transferred in each cycle to the battery is the following:E_{re-charge}= V_{bat}* I_{mot_avg}* t_{on}which becomes this after doing the proper substitutions for I_{mot_avg}and V_{mot_avg}:E_{re-charge}= V_{bat}/R_{m}*(V_{bat}*t_{on}/t_{cycle}-V_{g})*t_{on}As you can see this is a quadratic function of t_{on}, and it reaches its maximum whent_{on}= 1/2 * V_{g}/V_{bat}* t_{cycle}in other words when the V_{mot_avg}is half of V_{g}. This effect will further limit your ability to regenerate energy from the motor while braking, or your ability to quickly brake the motor while maintaining good re-generation efficiency, depending on which way you look at it.

Even if you’re fine with all the limitations above, the question still remains: what to do with the back-converted energy? If your system is battery operated, the battery may or may not absorb this energy, depending on its technology. Even more serious problem is that the amount of charge a battery can take depends on its charge level – a fully charged battery can’t take any more charge. This means that you either risk overcharging your battery or limit your braking capability at least under some circumstances. Neither options are too pleasing.

If you run your system from mains (and necessarily through a power supply, since mains is AC and we’re driving a DC motor here), you’re even more limited: unless you specially design your power supply, it simply can’t pump energy back into the power outlet.

In both cases it seems that your safest bet is to consume or store the regenerated energy locally. If you have other loads consuming power, of course you can power those loads up to their current requirements. You might have lights, computers, other motors, heaters, sensors, what not running at the same time, that need energy. All that is great, but you don’t want the brake distance depend on how much the seat-wormer is on in your car, do you?

In other words, all these options provide some, but not very deterministic or reliable places to put energy to. What you would really need is some sort of reliable energy storage device that is not as sensitive as a battery and can store a lot of energy. Effectively a capacitor. Trouble is, actual capacitors of the sizes needed (easily several Farads) are not feasible. There is however another way (you would have to read more on mechanical modeling to understand why): stick another motor with a big wheel attached to it into your system. When you have more energy then what you know what to do with, simply spin-up the wheel to store the energy. When you are in need of energy, use (again) regenerative braking on that wheel to regain the energy and supply your needs. This is called a flywheel, and is in fact used in certain systems.

Trains, subways and other large, but well controlled systems usually benefit from regenerative braking as well as they quite often have another consumer (another, accelerating train) that can use the regenerated energy.

As you can probably see from this much, the problem of safely and reliably putting the braking energy somewhere is a complex one. It requires full understanding of the complete electro-mechanical system, and there is no one-size fits all solution.

### Dynamic braking

Let’s say you don’t want to use regenerative braking because of all the complexities involved. So you want to operate in the dynamic braking mode of the bridge, and avoid regenerative braking altogether. How do you do that? The first thing you need to do is to figure out if the system is in regenerative braking mode. You can go about it in two ways:

- We know the bridge is in regenerative mode if V
_{g}is higher than V_{mot_avg}but the same polarity. To use this, we need to measure V_{g}or something related to it. That’s not necessarily a simple thing to do. I will come back to techniques for doing so in a future article about speed-control mechanisms, but usually you will need a method to measure the shaft speed using an encoder for example. - Use the knowledge that the bridge is in regenerative mode if the bridge current flows in reverse direction compared to the battery voltage. This involves measuring the current through the bridge including it’s polarity.

After you have the right feedback in place, you can adjust your drive direction to make sure that V_{mot_avg} is always reverse in polarity than V_{g} any time you’re braking. But there’s another complication: how do you know you **need** to brake? You only know that if you know the intended and the actual speed of the motor, so you need to measure the shaft-speed (or V_{g} somehow) and you have to implement some sort of a control circuit.

If you did all that, you can successfully avoid regenerative braking. Then another problem arises: how much torque can you apply in braking mode to the shaft, provided you would only want to operate in the dynamic braking domain? We know that torque is related to the motor current and we’ve also seen that the average motor current during braking is the following:

I_{mot_avg} = (V_{mot_avg}-V_{g})/R_{m}

To make sure that the motor remains in the dynamic braking domain, you will have to make sure that V_{mot_avg} has the same polarity as the motor current, which is opposite to V_{g}. So if V_{g} is positive as in all of our examples so far, V_{mot_avg} will need to be negative. That has the unfortunate consequence that I_{mot_avg} cannot be smaller (in absolute value) than a certain amount:

abs(I_{mot_avg}) >= V_{g}/R_{m}

This is a problem because it tells us that we can’t brake the motor arbitrarily gently. The only way to achieve that is with regenerative braking. As a matter of fact, it also tells us that he minimum amount of braking torque we can apply to the motor depends on the speed and is proportional to it. So at high speeds we will have more abrupt braking than at low speeds.

# Summary

By now you probably see that dealing with bridges in phase-magnitude drive is not simple. At first sight it seems you only need two control signals – a PWM input to set the average voltage on the motor and a digital signal to set the direction – and you’re ready to go.

Detailed analysis however shows that no matter how you operate your bridge, braking is a problem. You either use regenerative braking with all of its complications or try to avoid it which isn’t simple either. You probably need to monitor the bridge current and the supply voltage to make sure you you don’t over-charge your battery. If you want to avoid regenerative braking completely you’ll most likely have to somehow measure the motor speed as well.

The silver lining is that at least you have a fail-safe mode to go back to: you can always set the PWM to 0% duty-cycle, effectively short-circuiting the motor. That will safely brake it down to a halt (almost) without risking to over-charge your battery or causing any other harm to your system. When you do that however, you have no control over how long it will take for the motor to stop though, so while it sounds safe from an electrical perspective, it might not be from the mechanical side.

Also, if there’s an external torque applied to the motor, simply short-circuiting it will never completely stop it as the braking torque is proportional to the speed: your electrical car will never stop on a slope just by short-circuiting the motor. You’re battery won’t explode, so there’s some benefit, but you would still end up in the ditch.

Talking about safety, there’s another positive about sign-magnitude drive: you can set the input signals to a static state (0% PWM is basically a constant low- or high- voltage) at which point the motor won’t see any voltage from the battery. This is especially important in systems where some setup is needed on power-on before normal operation can start, like in the case of microcontrollers. You can configure the HW so that the default state of the control pins is such that the motor is safely stationary and only move out from that state only after the system initialization is complete.

All in all, sign-magnitude drive seems simple at first, but as with many things, the devil is in the details. For undemanding, simple applications it might be a good fit as it is, in most cases you’re probably going to need some sort of monitoring circuitry that can detect dangerous or unwanted situations and intervene to prevent them.

# Where to go from there?

I will come back to the sign magnitude drive when we will talk about drive circuits and component selection. Before that however I will cover cover the other main drive mode, the lock anti-phase drive and compare the two to each other.

Dude, you might have mistaken dI/dt for I. dI/dt is inversely proportional to L. The solution for the diff.eq is a exponential function. The current does NOT increase or decrease linearly in time. Otherwise, it’s an awesome write-up.

Thanks for the comment. Actually, my statement about a linear current change is an approximation, but a correct one. If we disregard all resistance in the circuit, the solution of the differential equation is in fact the linear function. Of course in reality there’s always some resistance somewhere, if which case you’re right: the solution is an exponential function.

What happens though is that if you switch the circuit fast enough, you will only see the very first part of this exponential response which can be well approximated with a line even in the presence of some resistance. There is a more accurate frequency-domain explanation to this, which I meant to expand upon in an ‘advanced’ article in the future. For now it’s suffice to say that in almost all H-bridge applications your operating PWM frequency is higher than the (inverse of the) electrical time constant of the motor (Rm-Lm) to minimize ripple-current. In those cases, the linear approximation is a good one.

Hi,

No need to publish this comment. At the beginning of the article, there’s this sentence “As the mapping tells us, during the on-time, Q2 and Q4 are closed.” with an image showing current flow. I think you meant Q1 and Q4.

Cheers

In the start of the “Breaking” section, you say “When Vg is lower than Vmot_avg …”; don’t you meant “Vg higher than Vmot_avg”? Otherwise I can’t see how the current becomes negative. If I understood correctly the scenario, it’s let’s say, when you speed to X and then leave the throttle a bit but the inertia of the vehicle makes it take some time to reduce to the new lower speed, and in this situation the motor will be spinning faster than the throttle value (PWM duty cycle) “would allow”. Or where’s my understanding failing?

Thank you Nuno for all these corrections! You are right and I’ve fixed the page now.

You’re welcome. Spotted another one, in the following sentence, “As the electrical time-constants are usually several orders of magnitude lower than the electrical ones”. I think you meant “… than the mechanical ones.”

Mega-excellent job anyways :). Cheers

Hello,

I have a small query regarding the operation of H-bridge in sign magnitude mode.

In Sign magnitude mode, you mentioned that when Q1 closes, Q4 opens and Q3 closes, the decaying current circulates in a loop from source to drain of Q3. Does the current flows from source to drain in NMOS when source is tied to body internally? Or does the current flow through the internal body diode of the MOSFET? I have searched many articles and forums regarding this query but found mixed answers. Could you please clarify this?

When a MOSFET is open (that is it’s gate-source voltage is above threshold) it conducts in both directions, the body diode doesn’t play a role. So, in sign-magnitude drive, when you open both Q1 and Q3 for the off-time, the decaying current flows through the channel of the fet and not through the body-diode. The reason you might find conflicting data on this on the web is that there is a similar drive mode (I’ve called it asynchronous sign-magnitude drive where the decaying current is in fact conducted through the body diode. If you look at the current-flow diagrams in the two articles, you’ll see the difference highlighted. Others might not make such a clear distinction between the two drive-modes, or use a different nomenclature than I do, which might result in some confusion.

I hope this helps,

Andras

Can you please explain how to determine the ripple current requirement for the input capacitor? Thank you for providing all this information.

The maximum ripple current on the capacitor is the maximum ripple current through the motor.

Hello,

Thank you for the great article. i am dealing with DC motor driving for a month and have some problems i guess regarding the FETs needed for my design and this material i hope will clarify for me the missing points.Thank you. (i have motor that with high loads can reach up to 5A and i don’t succeed to design something that will work.)

I have a question though regarding the beginning of the artice, maybe i missed something – what is Vg voltage? you calculates motor voltage as Vbat-Vg and i didn’t see this value before (at the beginning of the article or the previous one.).

Can you please explain?

thanks a lot

Yulya

Thanks for your comment Yulya. V

_{g}is the generator voltage of the motor. It is introduced on the second image in the article.Good luck with your design!

Andras

Hey,

this is a really amazing article. I learned a lot!

But when discussing breaking the motor using sign-magnitude-drive, I got a question:

I undestand most of the things about using regenerative und dynamic breaking. But I was asking myself:

What happens if I use dynamic breaking (requirement: Vmot_avg > Vg with reversed polarity) and now Vmot_avg gets lower than Vg (requirement gets injured)? Than we do something like regenerative breaking but with the wrong polarity… What will happen?

Lets say I have a huge capacitor, delivering power to the H-bridge and a power-supply is connected in parallel through a diode. In my eyes the current trys to lower the voltage on the capacitor. If my power-supply delivers enough current, I can hold the capacitor-voltage on a positive level (electrolyt-capacitor would be destroyed otherwise). But there is something wrong in my thinking… In this case I would stick two currents into the system (power-supply and generator) but what happens with that energy?

Sorry, my head is spinnig… Maybe you can help me to solve it… Thanks a lot!

Thanks!

The short answer is: nothing. You have dynamic braking still. I think your confusion starts where you say: Vmot_avg > Vg with reversed polarity. Braking happens when Vmot_avg < Vg, not in absolute value, but sign included. So any time Vmot_avg has reversed polarity compared to Vg, independent of magnitude, you're braking. In fact, you are in braking using dynamic braking, no re-generation will happen. So where does the energy go? In these - highly idealized - models the only resistive component is the motor winding resistance, so that's where all this braking energy gets burned up. In reality, some if it gets to heat the FETs, the input capacitor, the wires and the battery. I hope this helps, Andras

Pololu has several controllers–e.g https://www.pololu.com/product/1457– that use a mode they describe as “Sign-magnitude (drive-coast)” as opposed to “Sign-magnitude (drive-brake)” which is clearly what you are describing here. I would appreciate your explanation of what is going on here. I have been experimenting with this mode and it appears to run cooler. However, there is a very non-linear relationship between the pulse width and motor speed, which is not a problem for me but may be an issue for others.

From what I can tell, in by ‘coast’ the mean all four FETs are off. This mode doesn’t provide any benefit compared to the ‘asynchronous sign-magnitude’ drive, in fact it might be exactly the same thing. Turning off all four FETs is a bit dangerous in my mind as it leaves it up to the motor inductors and catch diodes to find a path for the motor current to flow in the off-phase of the cycle. It’s better to keep at least one FET conducting to make this path well defined. It also reduces heat dissipation on the bridge as the conducting FET has lower voltage drop than a catch diode does.

can u plzz explain how inductor or motor current changes while applying PWM??

Sure. See here, here and here

Dear Andras,Im working on PWM dc motor driver since last 9 months,i read all about it,starting from mosfet configurations till shoot through and all other concepts.

Now Ive a small problem at Hbridge side,my PWM generated side+amplification+other things are working very good.

Only problem with the Hbridge which is having 4 Nmosfets.What image you are having,i ve also designed the same way,only additional pull down registers are being added,and also ive put 1000uF polar capacitor there.

Please help me to get rid off this.the mosfets are getting blown off sometimes(its without load testing).

Other time its working good but the motor voltage is coming only 10V@96%duty,WHY?

24V battery, psmn2r8 mosfets,PIC18f458,LM358.

I honestly don’t understand your problem. Could you explain it in more detail?

OK,here I’ll elaborate…

I didn’t use any kinda pwm driver ice.Just directly from uC to op amp,which gives me 0-10v pwm swing with different duties.

Now I’ve 4nmosfets in my h bridge with pull up,down resistors,and 1st 4th MOSFETs gates r shorted governed by pwm1,same 2nd and 3rd MOSFETs gates r shorted, governed by pwm2,but its not working!!!

If you have complementary MOSFETs, connected to 24V and driven by a 10V p-p op-amp, the top-side won’t ever completely close. Thus, every time the low-side is opened, you’re essentially short the power supply through your MOSFETs. They will eventually overheat and blow up. Even if the didn’t your bridge still wouldn’t work. You have to fix the high-side gate-drive.

Andras

I’ve I improvised my circuit and now its working fine,what I did is,I used 2 pmos upper and 2 nmos lower side.Upper pmos specially driven by npns.and the amplified pwms r diagonally shorted to upper pmos and lower diagonal nmos.The amplified signal from uC is quite good enough producing 0 -10v swing fed to MOSFETs.

I’m little dizzy after reading all of this, but I think that when you wrote about dynamic braking you really meant reverse current braking. In dynamic braking the additional resistor must be inserted in place of supply. Am I right?

Andrew,

I’m far from being an expert in this field, but I believe reverse current braking is not the correct term here. Here’s one link the describes the three terms: http://www.electrical4u.com/types-of-braking-in-a-dc-motor/. Here I’m talking about a case where the braking current is charging the battery, which is regenerative braking. Don’t forget: braking means to remove kinetic energy from the system, and that energy has to somewhere. Doing this electrically, there are only two places it can go to: either stored in something (battery) or wasted as heat (burned on a resistor).

Hello

Arent you using the wrong picture below ?:

“However, for now, let’s just concentrate on mapping 1 and see, how the bridge operates! As the mapping tells us, during the on-time, Q1 and Q4 are closed. This means that the left-side of the motor is connected to Vbat, while the right-side is grounded. Current can flow from the supply through the motor:”

When Q1 and Q4 are closed there can not run any current through them.

Hello!

When I say a FET is ‘closed’ I mean it in the sense of an electrical switch: it closes the circuit, so it can conduct current as opposed to being open, in which case it can’t.

Hope this helps,

Andras

Just curious, what is the minimum value of the current? and how do you calculate the minimum current value of the inductor? Obviously, the current began above 0 in your figure, which made me confused.

In some sense it’s very simple: I

_{min}= I_{avg}+ 1/2 * I_{ripple}. That of course only applies in steady-state situations. If you’re asking the minimum possible current under all conditions, that’s not possible to predict in theory. Think about it: what if the motor shaft is driven in the opposite direction of what the H-bridge is trying to achieve by an external source. It can drive arbitrary power into the motor and thus the current flowing out of the motor can be (theoretically) arbitrarily high.