Electronic – The PWM output of dsPIC chip fail to drive the motor with H-bridge circuit

dc motorh-bridgepic

I am simulating a dsPIC33FJ32MC202 in Proteus to control a motor.

enter image description here

I used an H-bridge to let motor rotate, but the motor is not rotating after the simulation started.

enter image description here

You can see the oscilloscope output connected to the IO pins of the dsPIC. The ideal output should be 3.3V to -3.3V, I don't quite understand why it is 2.3V to -2.3V, but it seems OK.

enter image description here

And also the oscilloscope output connected to the lines between Q3-R1 and Q1-R3. The output looks weird, and I don't know the reason causing this phenomenon.

enter image description here

P.S. You can download the Proteus design file and my program files(.c and .hex files) here.

Best Answer

You can't solve it by changing resistor values. You need more gain.

Basically, bipolar transistors are current-gain devices. This means that for a certain amount of current that flows into the base, a correspondingly larger current will flow into the collector.
The ratio between these two currents is the gain of the transistor, commonly called \$H_{fe}\$ in most transistor datasheets.

Transistors typically have a \$H_{fe}\$ in the range of 5-500, with big power transistors tending towards the 10-100 range.

Now, if you have a transistor with a \$H_{fe}\$ of 25, and you want to pull an amp through the collector, you need \$\frac{1A}{25} = 40 mA\$ of current flowing into the base. Obviously, your PIC cannot source that. Even if you have a \$H_{fe}\$ of 100: \$\frac{1A}{100} = 10 mA\$, you're still not going to have any luck.

I would say, that since this seems to be more of a learning project then anything else for you, you should look at playing with Darlington transistors. A darlington is two transistors wired in such a way that it has a much higher \$H_{fe}\$. However, the voltage drop across the transistor is doubled (to 1.2V), so they're rarely used in power applications. However, if you replaced the transistors in your circuit with darlington transistors, I think it would probably work, at least in the simulation.

(You would still have to deal with the issue of not turning the PNP transistor off, see the bottom section of this answer)


Another problem you will have with the topology as you have draw it is what is colloquially called "shoot-through". Basically, when your microchip decided to change the state of one half of the H-bridge, it will begin driving the voltage on the IO pin to the other state. Since there is capacitance on the connection, and the MCU IO line cannot source or sink infinite current, the voltage will slew from one extreme to the other. As such, there will be a period of time when the voltage on the IO pin is between 0 and Vcc.

Now, look at your circuit. What will happen when the voltage on the bases of both the top and bottom transistors is somewhere in the middle of 0-Vcc?

Both transistors will be turned on, and a large currents can flow straight through both transistors, completely ignoring the motor.


There is another issue with your design.

To fully turn off the upper transistor (the PNP transistor), you need to drive it's base-voltage to within -0.6V of it's emitter. Since you have the emitter tied to 5V, and your PIC microprocessor can only drive it's IO lines to 3.3V, you can never turn the top transistor off. As such, when you try to turn the bottom transistor on, all you're doing is shunting current through both transistors to ground, completely ignoring the motor.