Let's improve the basic motor driver and build a circuit that allows to control the direction of the motor.
The motor that we will be controlling can handle 12V and a maximum current (Imax) of 500mA.
If I connect the motor directly to a power supply and apply 12 V and no load on the shaft, the motor will run freely with a current less then Imax.
With this configuration I am not able to control the motor with a microcontroller. I need to include some sort of switch that allows to turn on and off the current that flows through the motor.
Transistors are good candidates to be used as switches to control the current that flows through the motor. There are different types of transistors but we will focus on using MOSFETs for this motor driver.
H-Bridge with MOSFETs
In order to control the direction of a motor I need to find a way to change the direction of the current that flows through the motor. One way of doing that is by using an H-Bridge circuit. An H-Bridge is a transistor-based circuit capable of driving motors both clockwise and counter-clockwise.
Let's use power MOSFETs for the H-Bridge circuit. We will be using the N-Channel MOSFET IRF630 and the P-Channel MOSFET IRF9630. Because they are power MOSFETs they can handle a lot of current flowing through them and for sure meet the maximum current specs for our motor (500 mA).
MOSFETs are controlled by voltage. So as long as the MOSFETs are TTL compatible (transistor Vgs turns on at 5V or 3.3V) then we are in good shape to connect the microcontroller ouput pins directly to the transistors.
This is one example of connecting P-Channel and N-Channel MOSFETs to build an H-Bridge motor driver. The terminals in blue will connect to a microcontroller. Now we only need to make sure that we follow table below in order to control the motor direction without damaging the transistors.
Do we need heatsinks on the MOSFETs?
To understand if we need heatsinks we need to do the following steps:
- Look for the RDS on the respective datasheet. Keep in mind that RDS will vary with Vgs. So the limit (or Max) stated in the description of the MOSFET, may not apply to your circuit.
- Once you know the on-resistance, you can use your maximum load's current (500mA) to calculate how many watts the MOSFET will dissipate.
- Now let's calculate the maximum power dissipation that transistor can handle without heatsink. Look for the maximum junction-to-ambient temperature and maximum junction-to-case temperature.
- Apply the following formula:
Because Pn and Pp is less than PD there is no need for a heat sink. If Pn and Pp were bigger than PD, you will need a heatsink.
Using Multisim Live we can validate the circuit.
We are able to reverse the current that flows through the motor.
Created with an image by Michael Dziedzic - "Motherboard, Reverse Detail: This is a green motherboard, photographed with red-gelled flashes."