"Motor": commonly known as "motor", an electromagnetic device that converts or transmits electric energy according to the law of electromagnetic induction. Including: motor and generator.
The motor is represented by the letter M in the circuit, and its main function is to generate driving torque; As the power source of electrical appliances or various machines, the generator is represented by the letter G in the circuit. Its main function is to convert mechanical energy into electrical energy.
Motor control: control of motor start, acceleration, operation, deceleration and stop.
1. DC brush motor
Because of its simple structure, convenient operation, low cost and good deflection and speed regulation performance, DC brush motor (BDC) is widely used in various power devices, ranging from toys, button adjustable car seats to printing machines and other production machinery.
The electric energy of the DC power supply enters the armature winding through the brush and commutator to generate armature current. The magnetic field generated by the armature current interacts with the main magnetic field to generate electromagnetic torque, causing the motor to rotate and drive the load.
Advantages: low price and convenient control
Disadvantages: due to the existence of brushes and commutators, the brush motor has complex structure, poor reliability, many faults, heavy maintenance workload, short service life, and commutation sparks are easy to produce electromagnetic interference.
2. Stepping motor
Stepper motor is an actuator that converts electric pulse into angular displacement; More generally speaking, when the stepping driver receives a pulse signal, it drives the stepping motor to rotate a fixed angle in the set direction. We can control the angular displacement of the motor by controlling the number of pulses, so as to achieve the purpose of accurate positioning; At the same time, the speed and acceleration of motor rotation can be controlled by controlling the pulse frequency, so as to achieve the purpose of speed regulation.
Advantages: simple control, large torque at low speed and low cost;
Disadvantages: the stepper motor has no-load starting frequency, so the stepper motor can operate normally at low speed, but it cannot be started if it is higher than a certain speed, accompanied by sharp whistling; At the same time, the stepper motor is open-loop control, and the control accuracy and speed are not as high as servo motor.
3. Servo motor
Servo motor is widely used in various control systems. It can convert the input voltage signal (or pulse number) into the mechanical output on the motor shaft and drag the controlled components to achieve the purpose of control. The servo motor system is shown in the figure below. Generally, the torque is required to be controlled by the current output by the controller; The response of the motor should be fast, the volume should be small and the control power should be small. Servo motor is mainly used in various motion control systems, especially servo system.
Servo motor can be divided into DC and ac. the earliest servo motor was a general DC brush motor. When the control accuracy was not high, the general DC motor was used as the servo motor. At present, with the rapid development of permanent magnet synchronous motor technology, most servo motors refer to AC permanent magnet synchronous servo motor or DC brushless motor.
Advantages: it can control speed, position accuracy, high efficiency and long service life.
Disadvantages: the control is complex and expensive, which requires professionals to control.
4. Brushless DC motor
Brushless DC motor [BLDCM] is developed on the basis of Brushless DC motor, but its driving current is AC. Generally, there are two kinds of driving currents of brushless motor, one is trapezoidal wave (square wave), the other is sinusoidal. The square wave driven is called DC brushless motor (BLDC); The sine wave drive is called permanent magnet synchronous motor (PMSM), which is actually a servo motor.
Brushless DC motor and servo motor have similar advantages and disadvantages. BLDC motor is cheaper than PMSM motor, and the drive control method is simpler.
5. DC reduction motor
Important parameters of reduction motor
Generally, the motor has a minimum starting voltage, which is the voltage value that can make the motor (no load) start to rotate. In order to ensure the normal operation of the motor, it is generally necessary to connect the voltage at both ends of the motor from the minimum starting voltage to the rated voltage. And within this voltage range, it is considered that the speed is directly proportional to the voltage.
The motor coil is wound with copper wire, so the resistance of the motor armature winding is generally very small, so the current in the circuit is generally large. This has a great impact on our motor drive design.
In addition, the motor has another important parameter: torque. In a simplified understanding, torque is the force that the motor can drive the external parts to rotate. It is physically described by torque, and the unit is N.m (the common unit is kg. Cm). Large torque can drive heavier things. It is generally believed that the torque of DC motor is directly proportional to the current.
6. DC reduction motor drive design
DC motor rotation: the motor can rotate by supplying power to the motor with two wires, forward rotation to the positive voltage motor and reverse rotation to the opposite voltage motor; The greater the voltage, the faster the motor rotates, the smaller the voltage and the smaller the speed. Generally, we can easily adjust the motor speed by using STM32 single chip microcomputer, but the IO interface voltage and current of STM32 are generally very limited. The voltage is 3.3V and the current is 8Ma. Therefore, in order to facilitate control, we need to add a drive circuit board directly to the microcontroller and the motor. The motor drive board has two kinds of input lines: power input line and control signal input line. The power input line is generally required to be a high current power supply that can provide the rated power supply of the motor. Generally speaking, what is the voltage and rated current required by the motor, then how much voltage and current should be provided to the motor drive board, which is the source of power for the motor. The connection between the control signal line and the signal line of the microcontroller is the method to realize speed regulation, which is generally the adjustable square wave signal of PWM. The motor drive board also has an output line and two interfaces, which are directly connected with the pins of the DC motor. Note that the output line of the motor drive board here should be output after a series of circuits, that is, the output line modulated by the input signal. All control machines must have drivers.
If forward and reverse rotation control (unidirectional rotation) is not required, the following driving circuit can be used to realize unidirectional speed control of the motor.
◆ when switches a and D are closed and B and C are disconnected, the DC motor rotates normally. Note that the rotation direction is positive. ◆ when switches B and C are closed and a and D are disconnected, the DC motor rotates normally. Note that the rotation direction is the opposite direction. ◆ when switches a and C are closed and B and D are disconnected, or when switches B and D are closed and a and C are disconnected, the DC motor does not rotate. At this time, it can be considered that the motor is in the "braking" state, and the potential generated by the inertia rotation of the motor will be short circuited to form a back emf that hinders the movement and form a "braking" effect. ◆ when switches a and B are closed or when switches C and D are closed, the direct power supply will be short circuited, which will burn the power supply. This situation is strictly prohibited. ◆ when the four switches a, B, C and D are disconnected, it is considered that the motor is in the "coasting" state, the potential generated by the motor inertia will not form a circuit, so there will be no back EMF hindering the movement, and the motor will rotate inertia for a long time.
In this way, the simple control switch state can control the selection direction of the motor. As can be seen from the above figure, its shape is similar to the letter "H" and is negative; The loaded DC motor is mounted on it like a "bridge"; Therefore, it is called "h-axle drive". The position of the four switches is called "bridge arm". Triode and MOS transistor can be used as electronic switches in the circuit. These two devices can be used instead of switches.
7. H-bridge circuit analysis
The forward and reverse control of the motor is explained below with the H-bridge circuit built by MOS tube. To make the motor run, a pair of MOS tubes on the diagonal must be turned on. As shown in the following figure, when Q1 tube and Q4 tube are connected (Q2 and Q3 must be turned off at this time), the current passes through the motor from left to right from the positive pole of the power supply through Q1, and then returns to the negative pole of the power supply through Q4. As shown by the current arrow in the figure, the current flowing will drive the motor to rotate clockwise.
When the other pair of MOS tube 2-phase Q3 is on (Q1 and Q4 must be turned off at this time), the current flows through the motor from right to left, driving the motor to rotate counterclockwise. When driving the motor, it is very important to ensure that the two MOS tubes on the same side of the H bridge will not be connected at the same time. If the MOS tubes Q1 and Q2 are connected at the same time, the current will pass through the two MOS tubes from the positive side of the power supply and directly return to the negative side. At this time, there is no other load in the circuit except the MOS tube, so the current on the circuit reaches the maximum value and burns the MOS tube and the power supply. Q3 and Q4 are turned on at the same time.
When driving the motor, it is very important to ensure that the two MOS tubes on the same side of the H bridge will not be connected at the same time. If the MOS tubes Q1 and Q2 are connected at the same time, the current will pass through the two MOS tubes from the positive side of the power supply and directly return to the negative side. At this time, there is no other load in the circuit except the MOS tube. Therefore, the current on the circuit reaches the maximum and burns the MS tube and the power supply. Q3 and Q4 are turned on at the same time.
A simple switch can only control the forward and reverse rotation of the motor, and the introduction of PWM control can adjust the direction and speed. Adjust the duty cycle to control the speed. The larger the duty cycle, the greater the average voltage (current) and the faster the speed. The PWM frequency is generally between 10kHz and 20kHz. Too low frequency will lead to too low motor speed and high noise. If the frequency is too high, the efficiency of the system will be reduced due to the switching loss of MOS transistor.
According to the different PWM control modes of different bridge arms, it can be roughly divided into three control modes: limited unipolar mode, unipolar mode and bipolar mode.
1. Restricted unipolar mode
Restricted unipolar mode: motor armature drive voltage polarity is single
Advantages: simple control circuit.
Disadvantages: no braking, no energy consumption braking, and no directional torque when the load exceeds the set speed. Large static error of speed regulation, poor speed regulation performance and poor stability.
2. Unipolar mode
Unipolar mode: motor armature drive voltage polarity is single.
Advantages: fast start, acceleration, braking, energy consumption braking, energy feedback, speed regulation performance is not as good as bipolar mode, but the difference is not much, and the motor characteristics are also better. It can also provide reverse torque in case of load overspeed.
Disadvantages: when braking, it cannot decelerate to 0, and there is no braking force when the speed is close to 0. You can't turn back suddenly. The dynamic performance is not good, and the speed regulation static error is slightly large.
PWM and pwmn are complementary PWM signals, which are generally controlled by advanced control timer channel and complementary channel. When PWM is high: MOS tubes 1 and 4 are on, MOS tubes 2 and 3 are off, and the current flows from the positive side of the power supply, through MOS tube 1, through the motor from left to right, and then through MOS tube 4 into the negative side of the power supply. When PWM is at low level: MOS tubes 2 and 4 are on and MOS tubes 1 and 3 are off. According to Lenz's law, there is self induced electromotive force, and the current still flows through the motor from left to right, forming a current circuit through MOS tube 4 and MOS tube 2.
3. Bipolar mode
Bipolar mode: the armature voltage polarity is alternating positive and negative.
Advantages: it can run forward and reverse, start quickly, speed regulation accuracy is high, dynamic performance is good, speed regulation static difference is small, speed regulation range is large, it can accelerate, decelerate, brake and reverse, it can provide reverse torque when the load exceeds the set speed, it can overcome the static friction of motor bearing and produce very low speed.
Disadvantages: the control circuit is complex. During operation, the four MOS tubes are in working state, with large power loss and easy scalding of the motor.
Pwm1 and pwm1n, pwm2 and pwm2n are PWM complementary channels. Advanced control timer channel and complementary channel are used to control bipolar mode. Pwm1 and pwm2 have the same cycle, the same duty cycle and opposite polarity, so that the two MOS transistors on the diagonal are turned on and off at the same time.
4. Hardware circuit design of H-bridge
Four N-type MOS transistors are generally used in the H-bridge. The reason why two n-type MOS tubes + two p-type mos tubes are not used is that the p-type mos tube is difficult to achieve the model of high withstand voltage and high current, and the on resistance is large. For MOS with the same performance, n-type is cheaper than p-type.
For NMOS, when the external gate source VGS voltage is greater than the VGS threshold of the chip (mostly between 2v-10v), drain D and source s are directly connected. If the external VGS voltage is less than the threshold, the gap between drain D and source s is cut off.
Simply think of it as a switch controlled by the grid g voltage.
Suppose the VGS threshold of n-MOS tube in the figure is 3V and VCC = 24V.
For the lower bridge arm q2mos transistor, the STM32 chip pin can be used for direct control, because the PWM high level of STM32 is 3.3V, which is enough to turn on the n-MOS transistor.
The upper bridge arm Q1 MOS cannot be turned on directly by using the STM32 chip pin, because assuming that Q1 is turned on, the voltages of drain D and source s are almost equal (RDS is very small), that is, VA = VCC = 24V, which requires VG > = VA + VGS = 27V. In short, when VG is greater than 27V, Q1 is on, and when VG is less than 27V, Q1 is off. Therefore, a circuit is needed to boost the 3.3vpwm signal of STM32 to 27V. This circuit can be realized by bootstrap circuit.
Upper axle arm drive: bootstrap circuit
Lower axle arm drive: level control
In the actual circuit design, VGS is generally set to 10 ~ 20V, because it ensures the complete conduction of MOS tube.
Another problem is that when the MOS tube is fully turned on, the internal resistance RDS of the MOS tube is generally small. In a few milliohms, it is equivalent to a wire. However, when the MOS tube is not fully connected, that is, when VGS is less than the opening voltage, the MOS is in the incomplete conduction state, so the internal resistance of the MOS tube is relatively large, and the current of the motor drive plate is also relatively large. Then the heating of MOS will be very serious and the chip may be burned out.
5. Half axle drive chip ir2104s
The so-called half bridge drive chip is a drive chip that can only be used to control two MOS tubes on one side of the H-bridge. Therefore, when using half bridge driver chip, two chips are needed to control a complete H-bridge.
Accordingly, the full bridge drive chip can directly control the on and off of four MOS transistors, and one chip can complete the control of a complete H-bridge.
The IR2104 used here is a half bridge driver chip. Therefore, it can be seen in the schematic diagram that each H-bridge needs to use two such chips.
1. Typical circuit design (from data manual)
2. Pin function (from data manual)
VCC is the power input of the chip, and the working voltage given in the manual is 10 ~ 20V.
As input control, in and SD can jointly control the rotation state of the motor (steering, speed and rotation).
VB and vs are mainly used to form bootstrap circuits.
Ho and lo are connected to MOS tube grid to control the on and off of upper arm and lower arm MOS respectively.
Com pin can be directly grounded.
3. Bootstrap circuit
This part is the difficulty of understanding the chip and needs to be explained. From the above code
Our other product: