Many students are puzzled when controlling motors, as the microcontroller pins can output high and low levels. Why can’t we connect the motor directly to make it turn? Why is a driver necessary? What is its purpose? There are so many different driver models. Is it possible to operate without one? Today, let’s discuss this.
1. Why is a driver necessary?
1. Insufficient power:
The output current capability of a microcontroller’s pins is very limited, typically just a few milliamps to tens of milliamps. This amount of current is sufficient to light up a small LED light.
But for motors? Even a small toy motor requires a starting and running current that can reach hundreds of milliamps, or even several amps, which is dozens to hundreds of times greater than what the microcontroller pins can provide.
2. Different operating voltages
The operating voltage of a microcontroller is generally 3.3V, or 5V, with output pin voltages reaching a maximum of this level.
Many motors, especially those requiring more power, have higher operating voltages, such as 6V, 9V, 12V, 24V, or even higher. A 5V voltage may not be able to drive the motor at all, or it may turn very slowly and weakly.
3. Incompatible signal types
The microcontroller outputs a weak digital signal.
The motor requires a power signal that can provide continuous high current to keep it running.
Moreover, controlling the motor’s direction and speed requires specific circuit logic.
The weak high and low level signals from the microcontroller cannot directly command the motor to rotate forward, backward, or adjust speed as required.
4. Insufficient protection
When the motor is running, especially during sudden stops or reversals, the internal coils generate a reverse voltage, similar to a sudden backflow of water.
The result is that this reverse voltage, if fed back directly to the pins, can easily damage the microcontroller. Driver circuits typically include protective components that can absorb this backflow, ensuring the safety of the microcontroller.
2. What happens if you connect directly?
Scenario 1: You write a program to make the microcontroller pin output a high level, directly connecting the motor’s positive terminal to it and grounding the negative terminal. In an ideal situation, the motor turns. In reality, the motor attempts to start, requiring a large current instantly. However, the microcontroller pin can only provide a maximum of 20mA. As a result, the motor may not move at all, or only slightly twitch. More likely, the microcontroller pin will overload, causing the internal circuit to heat up and burn out, resulting in smoke from your microcontroller board.
Scenario 2: Even if you use a very small motor that operates within the microcontroller’s current limits, it seems to work. However, when you try to stop the motor or change its direction, the back electromotive force generated by the motor will directly apply to the microcontroller pin. This voltage may far exceed 5V, immediately breaking down the microcontroller’s fragile transistors, resulting in damage to the microcontroller!
Scenario 3: You want to control the motor speed. Although the microcontroller pin can output a PWM signal, it still cannot effectively drive the motor coils to switch rapidly due to the low current, resulting in poor performance or no effect at all.
3. Are all drivers the same for different motors?
Brushed DC motors: The simplest. The most commonly used H-bridge driver circuit. It enables the motor to rotate forward, backward, brake, and coast. Models include L298N, TB6612FNG, DRV8833/8871, and many H-bridges built with MOSFETs.
Stepper motors: Require precise phase control. The driver chips include timing logic. Examples include ULN2003, dedicated stepper driver chips like A4988, DRV8825, TMC2208/TMC2225, etc. Key features support microstepping control and current regulation.
Brushless DC motors: The most complex. They require precise three-phase commutation control. Generally, they need dedicated brushless motor controllers or three-phase inverter driver chips + pre-driver chips + MOSFET arrays.
Servos: Come with built-in driver boards. Servos already integrate the motor, reduction gearbox, control circuit board, and position feedback. You only need to send a specific period and width PWM signal to the servo signal line to control the angle. This PWM signal serves as the control command, with very low current, allowing the microcontroller IO port to drive it directly. The internal control board of the servo will interpret this PWM signal and drive the internal motor to the specified angle.
Driver circuits are indispensable. Understanding this, the first step in your next motor control design should be: What kind of driver do I need? This way, your system can operate stably and lastingly.