WHY CAN'T THE MICROCONTROLLER DRIVE THE MOTOR DIRECTLY?

Why can't the microcontroller drive the motor directly?

Why can't the microcontroller drive the motor directly?

Blog Article

Does it mean that the microcontroller can directly drive all motors?

Of course not.

I don't know if you have noticed that the motor in the video is very small, and there is a big difference in size compared to the motors we often see in other electronic products.

The rated voltage of this small motor is 3.3V and the rated current is 4mA. If you want to make it rotate, the first condition is that the output voltage and current of the microcontroller IO port must meet the rated voltage and rated current of the motor.

Taking the STM32F103 microcontroller as an example, it can be seen in the output voltage characteristic table that the high-level voltage of the STM32F103 I/O output is between VDD-0.4V and VDD. If it is powered by 3.3V, then the high-level voltage of the I/O port is between 2.9V and 3.3V.

 

Image source: STM32F10xxx reference manual

In the output drive current description table of STM32F103, it can be seen that the I/O output pull current is 8mA, the output sink current is 25mA, and the total current flowing through the chip must not exceed 150mA.

 

It seems that the IO port of STM32F103 is directly connected to the small motor, which is completely fine! However, the problem is --

Small motors, that is, DC brushed motors are inductive devices. When the motor is running, it will generate back electromotive force. When measured with an oscilloscope, if the power supply is 3.3V, the peak-to-peak value of the generated back electromotive force reaches about 10V. This back electromotive force will be added to the I/O port of the microcontroller.

 

Combined with the I/O structure of the microcontroller, at this time, the back electromotive force is all consumed by the protection diode. Once the protection diode is damaged, the I/O of the microcontroller will also be directly finished.

 

Therefore, for low-power motors, although the microcontroller I/O can be directly driven, it will not take long for the microcontroller I/O to be damaged. For high-power motors, the microcontroller cannot be directly driven.

So how should the microcontroller drive the motor correctly?

Different motors have different driving methods. Take our common DC brushed motor, DC brushless motor, and DC stepper motor as examples.

01

Drive of DC brushed motor

If you only control the motor rotation speed and not the motor rotation direction, a microcontroller + 1 MOS tube is enough. One IO port of the microcontroller is connected to the G pole of the MOS tube, as shown below:

 

When the MOS is turned on, the motor rotates. When the MOS is turned off, the motor stops. The back electromotive force generated by the motor is consumed by the diode D1, which plays a role in protecting the power supply. When the motor speed needs to be controlled, the microcontroller only needs to control the duty cycle of the PWM.

If you want to control both the direction and the speed, you need to use a microcontroller + H bridge.

69a5b1be-d2d5-11ef-9310-92fbcf53809c.png

The 4 IO ports of the microcontroller, namely PWM1, 2, 3, and 4 in the figure above, are connected to the G poles of the 4 MOS tubes of the H bridge respectively. By controlling the output level of the IO port of the microcontroller, the 4 MOS can be turned on in a certain order. When Q1 and Q5 are turned on, the motor rotates forward, and when Q2 and Q4 are turned on, the motor rotates reversely. When the motor speed needs to be controlled, the microcontroller only needs to control the duty cycle of the PWM signal.

02

Drive of brushless DC motor

Brushless DC motors usually have two important components, the motor body and the driver. A single motor cannot run. The stator winding of the brushless DC motor will be made into a three-phase symmetrical star connection. The rotor is usually composed of n pairs of permanent magnets. According to the rotor operation mode, it can be divided into an inner rotor and an outer rotor.

There are three types of drive for brushless DC motors:

The first type is the integrated driver and motor. For a brushless DC motor to run, a driver is required. For some small brushless motors, the driver and motor are integrated, such as the cooling fan below. When we use it, we only need to connect the power supply to run it.

 

The second type is the electronic speed regulator. For brushless DC motors commonly used in drones, an external electronic speed regulator and control signal are required to work.

 

The third type is the use of closed-loop control, which is usually used in industrial motion control. The motor integrates a 3-phase Hall sensor to detect the rotor position and speed. At the same time, the matching driver board is also relatively complex, integrating many signal acquisition and motor protection functions, which can control the speed, torque, direction, etc. of the brushless DC motor.

03

Stepper motor drive

Stepper motors must have a stepper motor driver to operate, and there are many types of stepper motor drivers. For stepper motors with relatively low power, you can use a single-chip microcomputer, plus ULN2003 or MX1508 to drive. This type of drive is more complicated, and the timing of the pulse signal of each phase must be controlled by yourself.

 

Another type is a stepper motor driver designed with an integrated driver chip, such as TB6600, A4988 and other driver chips. This type of driver has high driving power and is easy to use. The control only needs to provide speed, direction and enable signals, set the driver parameters, and give the number of pulses to make the stepper motor rotate to the corresponding angle.

 

In addition, there is a stepper motor with integrated drive and motor. This type of stepper motor also integrates an encoder and is generally used in high-precision control situations. This type of stepper motor can be controlled through serial communication or pulse signals.

 

The issue of motor drive cannot be fully discussed in one article. Due to limited space, this is all I have to say. In short, everyone should remember that the microcontroller cannot directly drive the motor, and it needs to be matched with a suitable drive circuit.

Report this page