AntonMarinski
Posts: 22
Joined: Sat Sep 10, 2016 10:31 am

A motor controlled with a transistor-H-bridge

Sun Dec 31, 2017 2:29 pm

Hi all,
I have made a circuit in an online circuit simulator and I have got two questions. First of all, would the following circuit work IRL (it should, right??)
http://tinyurl.com/y8a4upl5
Secondly, how can I approach the issue of voltage spikes when working with a DC motor and not a lamp? I'll have to add a diode somewhere, but where?
Help would be greatly appreciated!
P.S. Pretend the lamp is a DC motor :)
P.S.2 Moreover, top and bottom transistors on -> current - rightwards; middle two transistors on -> current leftwards

User avatar
davidcoton
Posts: 3121
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: A motor controlled with a transistor-H-bridge

Sun Dec 31, 2017 3:56 pm

Nice simulation! I'm not an H-bridge expert, so I may not be 100% correct in what follows, but I think you have some problems here.

First, the 100R resistor will severely limit the motor current, and probably cook itself.
A 3V3 base supply will never turn on the transistors with collectors at 5V unless the 100R is dropping most of the voltage.
You must of course ensure that the software can never, under any conditions, switch on the two top or the two bottom transistors together. Doing so would short the 5V supply, leading to the transistors behaving as three-legged fuses.
This is particularly hard at start-up, shut-down, and on changing direction. H-bridge drivers can use hardware to prevent this condition if there is a software error. One way is to use just two GPIOs, controlling the two 0V transistors directly. A bit more circuitry is used to derive a control signal for the high-side transistors (which might need to be PNP). This must take into account the switch-over period, preventing both transistors coming on together. I believe the commercial circuits use FETs rather than bipolar transistors.

For back EMF protection you need four diodes, clamping each side of the motor to the motor supply (5V and 0V). This assumes that the 5V supply can safely absorb the back EMF energy.

You might do well to look at the datasheets for commercially available integrated H-bridge controllers and see how they tackle these issues.
"Thanks for saving my life." See https://www.raspberrypi.org/forums/viewtopic.php?p=1327656#p1327656
“Raspberry Pi is a trademark of the Raspberry Pi Foundation”

AntonMarinski
Posts: 22
Joined: Sat Sep 10, 2016 10:31 am

Re: A motor controlled with a transistor-H-bridge

Sun Dec 31, 2017 5:14 pm

davidcoton wrote:
Sun Dec 31, 2017 3:56 pm
Nice simulation! I'm not an H-bridge expert, so I may not be 100% correct in what follows, but I think you have some problems here.

First, the 100R resistor will severely limit the motor current, and probably cook itself.
A 3V3 base supply will never turn on the transistors with collectors at 5V unless the 100R is dropping most of the voltage.
You must of course ensure that the software can never, under any conditions, switch on the two top or the two bottom transistors together. Doing so would short the 5V supply, leading to the transistors behaving as three-legged fuses.
This is particularly hard at start-up, shut-down, and on changing direction. H-bridge drivers can use hardware to prevent this condition if there is a software error. One way is to use just two GPIOs, controlling the two 0V transistors directly. A bit more circuitry is used to derive a control signal for the high-side transistors (which might need to be PNP). This must take into account the switch-over period, preventing both transistors coming on together. I believe the commercial circuits use FETs rather than bipolar transistors.

For back EMF protection you need four diodes, clamping each side of the motor to the motor supply (5V and 0V). This assumes that the 5V supply can safely absorb the back EMF energy.

You might do well to look at the datasheets for commercially available integrated H-bridge controllers and see how they tackle these issues.
The problem I am having is that I have not connected the load to the collector. How stupid of me... Anyway I shall continue trying to make this work without excessive wiring.

AntonMarinski
Posts: 22
Joined: Sat Sep 10, 2016 10:31 am

Re: A motor controlled with a transistor-H-bridge

Sun Dec 31, 2017 7:10 pm

If anyone is interested in a rough sketch that should work properly - http://tinyurl.com/y8rxth3j
I'll post a tidier version later someday...
Happy New Year

drgeoff
Posts: 8440
Joined: Wed Jan 25, 2012 6:39 pm

Re: A motor controlled with a transistor-H-bridge

Sun Dec 31, 2017 7:29 pm

There is an issue with the two transistors which feed current from their emitters into the motor. The emiiters will never be at higher voltages than their bases minus about 0.6 volts. So although you are using a 5 volt supply, the motor will only get about 2.5 volts.

Also the 100 ohm resistor is rather high. Assuming the above 2.5 volts on the motor, there is a bit under 2.5 volts across that resistor. The current through it (and the motor) is thus 25 mA. Must be a tiny motor and lightly loaded.

Return to “Advanced users”

Who is online

Users browsing this forum: No registered users and 24 guests