The most common type of motors you might have come across is the 3 V DC motors which are optimized to work with low voltages. These motors are hobbyists friendly and low cost.
Running them is quite simple. Just connect them with two 1.5 V AA batteries and they will fire up. This setup is good for simple works like making a fan or a miniature windmill. But when it comes to the dynamic applications of them such as robots, more precision is required - in the form of variable speed and torque.
We can decrease the voltage of the input source to decrease the speed of the motor. That's intuitive! But if the motors are connected to the common voltage source, we need a circuit to change the voltage using a proper driving circuit.
Variable linear voltage regulators like LM317 can be used to increase or decrease the voltage and a few bipolar transistors can be added to increase the current supply if required. But the biggest drawback of this is that the transistor dissipates power and the efficiency of the driver decreases.
The solution to this problem is the method of PWM or pulse with modulation. Here, the motor is driven by a square wave with an adjustable duty cycle (ratio of the on-time to the period of the signal). The total power delivered is proportional to the duty cycle. In other cycles, the motor is powered for a small fraction of the time period – so over time, the average power to the motor is low. With a 0% duty cycle, the motor is off (no current flowing); with a duty cycle of 50% the motor runs at half power (half the current draw) and 100% represents full power at the maximum current draw.
This is implemented by connecting the motor high side and driving it with an N-channel MOSFET, which is driven again by a PWM signal.
This has some interesting implications – a 3 V motor can be driven using a 12V supply using a low duty cycle since the motor sees only the average voltage. With careful design, this eliminates the need for a separate motor power supply.
What if we need to reverse the direction of the motor? This is usually done by switching the motor terminals, but this can be done electrically.
One option could be to use another FET and a negative supply to switch directions. This requires one terminal of the motor to be permanently grounded and the other connected to either the positive or negative supply. Here, the MOSFETs act like an SPDT switch.
However, a more elegant solution exists.
This circuit is called H-bridge because the MOSFETs form the two vertical strokes and the motor forms the horizontal stroke of the alphabet ‘H’. It is a simple and elegant solution to all motor driving problems. The direction can be changed easily and the speed can be controlled.
In an H-bridge configuration, only the diagonally opposite pairs of MOSFETs are activated to control the direction, as shown in the below figure:
When activating one pair of (diagonally opposite) MOSFETs, the motor sees current flow in one direction and when the other pair is activated, the current through the motor reverses direction.
The MOSFETs can be left on for full power or PWM-ed for power regulation or turned off to let the motor stop. Activating both the bottom and top MOSFETs (but never together) brakes the motor.
For the H-Bridge
- DC motor
- 2x IRF3205 N-channel MOSFETs or equivalent
- 2x IRF5210 P-channel MOSFETs or equivalent
- 2x 10K resistors (pulldown)
- 2x 100uF electrolytic capacitors (decoupling)
- 2x 100nF ceramic capacitors (decoupling)
For the Control Circuit
- 1x 555 timer (any variant, preferably CMOS)
- 1x TC4427 or any appropriate gate driver
- 2x 1N4148 or any other signal/ultrafast diode
- 1x 10K potentiometer (timing)
- 1x 1K resistor (timing)
- 4.7nF capacitor (timing)
- 4.7uF capacitor (decoupling)...