0
\$\begingroup\$

Say I have a DC motor which runs clockwise when current flows in one direction, and counter-clockwise when the current flow is reversed.

I have 2 lines going in my circuit, +5V and ground. I have a PIC, and two motors.

I want to be able to control the direction each of the motors spin without any mechanical relays.

Say pin RA0 is motor 1 forwards, RA1 is motor 1 backwards, RA2 is motor 2 forwards, and RA3 is motor 2 backwards.

What is a good way to accomplish this? Should I build an H-bridge out of transistors?

\$\endgroup\$

2 Answers 2

6
\$\begingroup\$

One H bridge per motor is the normal way to do this. You then turn on opposite corners of the H bridge, one pair for clockwise and the other pair for counterclockwise. If the motor is also to be powered from 5V, then the high side switches could be just PNP transistors with a base resistor each.

The easiest way to do this is to use 4 PIC pins to drive the H bridge. It is important to do break before make when switching direction, so you don't want to just tie the two base (or gate) signals together for each side, especially since bipolar transistors will take longer to turn off from saturation than to turn on.

Don't forget the two reverse diodes to power and ground on each side of the motor, else the transistors could get destroyed due to inductive kickback.

\$\endgroup\$
1
\$\begingroup\$

Say I have a DC motor which runs clockwise when current flows in one direction, and counter-clockwise when the current flow is reversed.

Technically the torque is clockwise when the current flows in one direction, and is counterclockwise when current is reversed -- with a simple load that means the rotation will eventually run in the same direction as the torque.

What is a good way to accomplish this? Should I build an H-bridge out of transistors?

Yes. You'll need an H-bridge with built-in transistor drive circuitry, or you'll need to make transistor drive circuitry yourself (with MOSFETs this is gate drive circuitry).

If you don't PWM the bridge and you don't have a hardware overcurrent limit, you'll want to wait a period of time before reversing the motor, otherwise you can get a current equal to twice the stall current.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.