Need some help with an H-Bridge

MikeML

Joined Oct 2, 2009
5,444
Scott, unless you put state elements (flip-flops) in the protection logic, and use a clock to advance from state to state, it is not possible to solve the shoot-through problem using diodes (or logic gates) alone.

If the micro-controller never puts out the non-allowed states, and advances between valid states in the correct order, then no extra diodes or protection logic is needed, anyway...
 

crutschow

Joined Mar 14, 2008
38,552
....................
First thing I did with your .asc file is to change dir with Vpwm low, and that instantly vaporizes the FETs.
.....................
I rather doubt that a single shoot through that occurs only when the motor is reversed will vaporize (or even damage) the FETs.
The simulation showed that while the peak instantaneous power is high, the maximum shoot-through energy dissipated in the top MOSFET is <10mJ when the motor direction is changed with the PWM MOSFET on.
 

ScottWang

Joined Aug 23, 2012
7,501
Scott, unless you put state elements (flip-flops) in the protection logic, and use a clock to advance from state to state, it is not possible to solve the shoot-through problem using diodes (or logic gates) alone.
I was designed that kind of control circuit before, use two control wires and one gnd wire, but I found some other people just used one wire to control the cw/ccw, I'm trying to use one wire to control 4 signals, but not success yet.

To solve the ee problem not just one way to go, there are many ways can reach the target, what I used just one method, and not just real flip flop can do that, some others still can do.

If the micro-controller never puts out the non-allowed states, and advances between valid states in the correct order, then no extra diodes or protection logic is needed, anyway...
The software should design what it should do, but the hardware was designed to avoids something happened not in our expected.
 

MikeML

Joined Oct 2, 2009
5,444
I rather doubt that a single shoot through that occurs only when the motor is reversed will vaporize (or even damage) the FETs.
The simulation showed that while the peak instantaneous power is high, the maximum shoot-through energy dissipated in the top MOSFET is <10mJ when the motor direction is changed with the PWM MOSFET on.
So you are saying that you get shoot-through when you reverse direction, but that it is ok because the 1200A that spikes from the power supply though one side of the H-Bridge lasts for such a sort duration that it doesn't heat the transistors much. What does this current spike do the power supply regulation? What does it do to ground bounce which might cause the microcontroller to reset unexpectedly, etc.

I think it is better to just avoid the shoot-through in the first place, and I showed how in post #9, with no extra diodes...
 

Thread Starter

Carsten Svendsen

Joined Oct 2, 2015
17
Guys, Guys, wouldn't it just be easier to make a software interlock with the 4 inputs instead of putting diodes and flip-flops all over the circuit? It's not like this is going to be used industrially, it's only for fun so there's no need to make it more advanced than it has to.
 

crutschow

Joined Mar 14, 2008
38,552
So you are saying that you get shoot-through when you reverse direction, but that it is ok because the 1200A that spikes from the power supply though one side of the H-Bridge lasts for such a sort duration that it doesn't heat the transistors much. What does this current spike do the power supply regulation? What does it do to ground bounce which might cause the microcontroller to reset unexpectedly, etc.

I think it is better to just avoid the shoot-through in the first place, and I showed how in post #9, with no extra diodes...
Yes, I'm saying it's OK.
A large filter capacitor across the bridge (which all such power bridges should have anyway) should sufficiently suppress the voltage glitch from the short current spike to have minimal effect on the rest of the circuit.
And this shoot-through in my circuit only occurs if the PWM signal is not off when the direction is changed. This can also be done by changing the direction during the time the PWM control signal is high (M5 off).

The purpose of my design was to minimize the number of inputs while having a simple design (requiring 5 MOSFETs and one CMOS inverter chip) which would eliminate shoot-through for the PWM signal.

If you prefer your design, that's fair.
 
Last edited:

MikeML

Joined Oct 2, 2009
5,444
... wouldn't it just be easier to make a software interlock with the 4 inputs instead of putting diodes and flip-flops all over the circuit?....
That is exactly what I have been trying to say... If you restrict the bit patterns to the appropriate ones, and do them in the right order, you will have a glitchless H-bridge.
 

Thread Starter

Carsten Svendsen

Joined Oct 2, 2015
17
Scott said:
2. R1, R6 will affecting the turn on speed of Q1, Q2.
3. R2, R7 will affecting the turn on/off speed of Q1, Q2.
4. R3, R5, R8, R10 will affecting the turn on/off speed of Fet1~Fet4
Before purchasing too many electronics, I would like to build a proper breadboard test setup first.
I already have a few of these components:
Transistor - NPN BD135
N-Fet - IRFZ24N
P-Fet - IRF9530
1k and 10k Resistors

I'm confused when you say the resistors are determining how fast the transistors will switch. Does this matter? I tested one of them by putting pure 4.8 volts on the base, and then I had adjustable voltage 0-8v going through Vce with no resistor at no problem.
Is it correct to assume that the bigger the resistor, the faster it will switch?
Can I substitute the 12k for 10k and the 4,7k for 1k for testing purposes, or is this not enough for PWM operation?
 

MikeML

Joined Oct 2, 2009
5,444
...

I'm confused when you say the resistors are determining how fast the transistors will switch. Does this matter? ..
Can I substitute the 12k for 10k and the 4,7k for 1k for testing purposes, or is this not enough for PWM operation?
Switching speed is not particularly critical because you will create delays in the u-controller code. The delay just needs to long enough for the transistors to turn off before you turn on something else.

If you use ~500Hz for the PWM freq (~2000us period), then the resistors around the FETs are not particularly critical. 25% PWM duty cycle would require two delays of 500us and 1500us, respectively. I wouldn't go higher than 2X Scott's values, however.
 

Thread Starter

Carsten Svendsen

Joined Oct 2, 2015
17
I've been testing and measuring my output signals from my NXT today, and the only output that I can control that is not a PWM signal is a 3,3v signal. Therefore I need to join AD and BC in the previous diagram together and miss out on a breaking function and put in the S1 switch as shown below referring to Scotts 1st post.
What would be the best type of relay for this application that works on 3,3v? I've been looking at Optocouplers, Solid States and Photomos' and none the wiser.
At a glance I'd say Photomos would work well if it's actually a mechanical relay function.

 

MikeML

Joined Oct 2, 2009
5,444
Scott's original two-input H-Bridge has exactly the shoot-through problem this entire thread has been about eliminating, and I wouldn't use it. Besides, he is discharging 100uF capacitors charged to 15V by shorting them with a relay contact, which will destroy the relay contact very quickly. The only thing that made Scott's circuit tenable is when he split the two control inputs into four!

What the hell is a NXT? Isn't it a general purpose controller with lots of port pins?
 
Last edited:

Thread Starter

Carsten Svendsen

Joined Oct 2, 2015
17
Well actually it was not the circuit I wanted, it was just to show the S1 function.
Which means A and D will be connected as one and put on the switch, same for B and C. I would then control the switch by my 3,3v signal.
If I can't do that because of the problems you mention, I can also make my circuit like shown below.
The Green wire would be supplied continuous 5v, while the grey wire would be PWM signal. S1 would still have to be powered by a 3,3v source.



An NXT is a LEGO device, which only delivers 8 volts of output voltage where as I need 12v. There are aftermarket bridges and PCB's available for it to connect bigger/more motors than intended but the time to switch from state 0 to state 1 is too long, it's the first thing I tried.
That's why I wanted a pure electronics H-bridge for snappy performance instead.

I do not know anything about raspberry Pi but do you know if it can deliver those 4 outputs seperatly? Because then I think it would make things quite easier, although I don't know how to program it - yet. Then I could just take the whole S1 block and switch it out for the Pi. Turns out it's not even as expensive as I thought.
 

MikeML

Joined Oct 2, 2009
5,444
I have controlled H-Bridges with PICs, and Arduinos. They have 8bit ports, where 4bits can be connected to the H-bridge and changed either one port pin at a time, or all four together. I believe Pi's are the same...

Sounds like you have only a total of two pins available on your NXT; X is a general purpose output pin, and Y is a PWM pin? Is that right?

What are the voltage levels that come out of X? Vhigh? Vlow?

What are the voltage levels that come out of Y? Vhigh? Vlow?

What is the PWM rate that comes out of Y?

When you stop the PWM signal at Y, can you stop it so that it is always in the low state (or high state, one or the other)?
 
Last edited:

ScottWang

Joined Aug 23, 2012
7,501
Scott, unless you put state elements (flip-flops) in the protection logic, and use a clock to advance from state to state, it is not possible to solve the shoot-through problem using diodes (or logic gates) alone.

If the micro-controller never puts out the non-allowed states, and advances between valid states in the correct order, then no extra diodes or protection logic is needed, anyway...
If you look carefully, the protection method as RS latch.
 

ScottWang

Joined Aug 23, 2012
7,501
Scott's original two-input H-Bridge has exactly the shoot-through problem this entire thread has been about eliminating, and I wouldn't use it. Besides, he is discharging 100uF capacitors charged to 15V by shorting them with a relay contact, which will destroy the relay contact very quickly. The only thing that made Scott's circuit tenable is when he split the two control inputs into four!

What the hell is a NXT? Isn't it a general purpose controller with lots of port pins?
Sorry about that, I didn't mention some more, that was designed for another member, because I just used the circuit for referring not for used with uC, I think you missed the most important switch as the S1, it is not a relay, the circuit is a test circuit before running with uC, it keeping the circuit never happened what you said the shoot-through problem, if you worried about the 100 uf capacitor then you just reducing the value, every times when you change the switch to ground then the 100 uf will be discharged, if you afraid of the contact then choosing a better switch.
 

ScottWang

Joined Aug 23, 2012
7,501
Before purchasing too many electronics, I would like to build a proper breadboard test setup first.
I already have a few of these components:
Transistor - NPN BD135
N-Fet - IRFZ24N
P-Fet - IRF9530
1k and 10k Resistors

I'm confused when you say the resistors are determining how fast the transistors will switch. Does this matter? I tested one of them by putting pure 4.8 volts on the base, and then I had adjustable voltage 0-8v going through Vce with no resistor at no problem.
Is it correct to assume that the bigger the resistor, the faster it will switch?
Can I substitute the 12k for 10k and the 4,7k for 1k for testing purposes, or is this not enough for PWM operation?
I mentioned something because when you doing the test then you have some place to find out the problem, The position of 12K can be works as 10K~22K for normal purpose, if you want to try 4.7K to 1K, then you should know the resistor is doing the shunt function, if the values too low, then the Ib current may not enough to turn on the Vbe of bjt, normally I will set the values of Rbe big than Rb(1/3)...(4.7K), this is the best chance to do the test, you can try different values then you will get the properly values in your mind, please don't just listen anyone or my opinions, do the test, measuring the Ic and Ib and recording when the values of Rb and Rbe changing and how they affecting the Ib and Ic values.

Doing the testing to create the values of Rb and Rbe in your mind:
1. To using the basic bjt circuit only RC, Rb, Rbe, and measuring the Ic, Ib, I_Rbe, Vb and Vc
2. Using different power supply to try as 5V, 6V, 9V, 12V, 15V, 18V, 24V.
3. Trying to input different voltages from 3.3V ~ 24V.
3. Using the values of current for Ib as 1~10mA, and the Ic as 10mA to 100mA, you may using the led or relay or motor or buz to be the load.
4. Using the values of Rbe > Rb(1/3), when the frequency more higher then the values will be more less, of course you can try Rbe < Rb(1/3), that's the purpose to let you know why I using that value.

Doing the very very basic circuit and measure them is the best way to learn how the ee components working and what is the better values for the circuit.

Good luck.
 

ScottWang

Joined Aug 23, 2012
7,501
Well actually it was not the circuit I wanted, it was just to show the S1 function.
Which means A and D will be connected as one and put on the switch, same for B and C. I would then control the switch by my 3,3v signal.
If I can't do that because of the problems you mention, I can also make my circuit like shown below.
The Green wire would be supplied continuous 5v, while the grey wire would be PWM signal. S1 would still have to be powered by a 3,3v source.



An NXT is a LEGO device, which only delivers 8 volts of output voltage where as I need 12v. There are aftermarket bridges and PCB's available for it to connect bigger/more motors than intended but the time to switch from state 0 to state 1 is too long, it's the first thing I tried.
That's why I wanted a pure electronics H-bridge for snappy performance instead.

I do not know anything about raspberry Pi but do you know if it can deliver those 4 outputs seperatly? Because then I think it would make things quite easier, although I don't know how to program it - yet. Then I could just take the whole S1 block and switch it out for the Pi. Turns out it's not even as expensive as I thought.
The Vgs of low side is designed for what you said 9V, so if you want to using 3.3V then you can adding two stages of npn and pnp, optocoupler is another option.
 

MikeML

Joined Oct 2, 2009
5,444
Scott, now I am really confused. If S1 and S2 in your circuit are toggle switches that are operated by hand (for testing), then your circuit is not ready to be controlled by the port pins of a micro-controller, and therefore is not a circuit useful to Carsten.

Manually controlled switches are almost impossible to throw (by hand) at the same instant, so the short delays created between the times S1 and S2 are operated mask the shoot-through that would occur if the two signals were coming from a port on a micro-controller where the two signals change state on the same clock cycle (essentially at the same instant).

The delays created by the 100uF capacitors and the base resistors in not a useful method of preventing shoot-through, either. If you "tune" the delays for the rising edge of the control signals, then the delays will not be right for the trailing edge, and vice-versa...
 

ScottWang

Joined Aug 23, 2012
7,501
Scott, now I am really confused. If S1 and S2 in your circuit are toggle switches that are operated by hand (for testing), then your circuit is not ready to be controlled by the port pins of a micro-controller, and therefore is not a circuit useful to Carsten.
That is just to let TS comparing the inputs circuit what is different with mine.

Manually controlled switches are almost impossible to throw (by hand) at the same instant, so the short delays created between the times S1 and S2 are operated mask the shoot-through that would occur if the two signals were coming from a port on a micro-controller where the two signals change state on the same clock cycle (essentially at the same instant).
I think you were thinking too deep, the input just shown on the leftest side of circuit, only the DC voltage input, there is no any pulse from uC

The delays created by the 100uF capacitors and the base resistors in not a useful method of preventing shoot-through, either. If you "tune" the delays for the rising edge of the control signals, then the delays will not be right for the trailing edge, and vice-versa...
The 100 uF was designed to buffering for the 15V input, although it has delay time, but it is not important at this test circuit.

The circuit was designed to let the user manual control for one direction at a time only, it was to preventing the damaged from shoot-through as +V to gnd, there is no any chance to happen as Fet1 and Fet2 turn on at the same time or Fet3 and Fet4 turn on at the same time.

You can say that before I know the PS what to do, that is just let the TS to thinking something first, that's all.
 
Top