2. BLDC commutation principle with hall sensor

1. Analysis of the working principle of BLDC

@1.BLDC is commonly known as brushless DC motor, and brushless DC motor is compared to brushed DC motor. The most obvious feature of brushless DC motors is that there is no commutator. The rotor is made of permanent magnets and the stator is made of windings wrapped around copper coils. As shown below.

@2. The characteristics of the stator: The stator is composed of permanent magnets. Since it is a magnet, it must have N poles and S poles. The N pole and the S pole repel each other with the same sex, and the opposite sex attracts each other.

@3. The characteristics of the rotor: the rotor is made of steel silicon or other materials with copper wires wound on it to form a coil of copper coils. A certain spatial magnetic field will be formed after electrification, and different directions of electrification will generate spatial magnetic fields in different directions. According to the right-hand spiral rule, the direction of the magnetic field generated after the stator coil is energized can be judged, as shown in the figure below:

 An electrified coil can be equivalently regarded as a magnet, as shown in the figure below.

 @4. How does the combination of stator and rotor produce rotation? Between magnets, there is the principle that same-sex repels and opposite-sex attracts. The same principle exists for stators (energized coils) and rotors (permanent magnets). When the stator is energized, a magnetic field will be generated (N poles and S poles are generated according to the flow direction of the current), and the rotor itself is a permanent magnet (there are N poles and S poles). According to the principle of same-sex repulsion and opposite-sex attraction: the stator is given different directions The space magnetic field, the rotor will follow the stator to rotate at a certain angle.

2. BLDC Commutation Analysis of Hall Hall Brushless DC Motor

@1. Through the analysis of the first chapter, we already know the general principle. So in the actual usage scenario, what is the specific structure of the Hall DC brushless motor?

The DC brushless motor with Hall generally consists of 8 wires. 3 thick wires, 5 thin wires.

3 thick wires: (The color of the wire harness of different manufacturers may be different, pay attention to distinguish)

Yellow: motor control phase U (sometimes also called phase A)

Green: motor control phase V (sometimes also called phase B)

Blue: motor control phase W (sometimes also called phase C)

5 thin wires: (The color of the wire harness of different manufacturers may be different, pay attention to distinguish)

Red: 5V power line

Black: GND line

Yellow: Hall sensor U phase (sometimes also called A phase)

Green: Hall sensor V phase (sometimes also called B phase)

Blue: Hall sensor W phase (sometimes also called C phase)

@2. Analysis of the control principle of motor control U, V, W three-phase lines

To analyze the control principle, it is necessary to figure out the three-phase wiring method. We generally use the wiring method shown in the figure below, which is called the star wiring method.

A(U), B(V), and C(W) lead out 3 wire harnesses outside the motor. These 3 wire harnesses are the copper wires described above. Inside the motor, A(U), B(V), and C(W) Three wire bundles are wound on the stator's silicon steel or other windings. A (U), B (V), and C (W) three-phase copper wire windings are finally connected to a common common point. If conditions permit, we can disassemble a motor, and the multimeter finds this common point, which can correspond to the above figure.

@3. At this point, we add the rotor and do an analysis.

As shown in the figure above, the current flows from U to W. The U phase is connected to the positive pole, the W phase is connected to the negative pole, and the V phase is open. At this time, the current flows from the U phase to the W phase. At the same time, the magnetic field vector direction of the magnetic field generated by the U phase and the W phase is the direction of the rotor magnetic field.

The operation mode of BLDC is that the windings are turned on two by two, so there are only 6 kinds of energization conditions for the conduction combination of the three-phase coils. Switching the energization sequence according to a reasonable sequence can make the rotor rotate with the magnetic field.

 

3. Analysis of forward rotation and reverse rotation of brushless DC BLDC

@1. Through the above chapters, we can see the six-step commutation steps of BLDC, so how to make the motor rotate forward (CW) and reverse (CCW). When the motor rotates forward, we generally say that the motor rotates clockwise, and when the motor reverses, we generally say that the motor rotates counterclockwise.

V+U- W+U- W+V- U+V- U+W- V+W- According to this sequence, the motor rotates forward (CW, clockwise), as shown in the figure below

3. Analysis of forward rotation and reverse rotation of brushless DC BLDC

@1. Through the above chapters, we can see the six-step commutation steps of BLDC, so how to make the motor rotate forward (CW) and reverse (CCW). When the motor rotates forward, we generally say that the motor rotates clockwise, and when the motor reverses, we generally say that the motor rotates counterclockwise.

V+U- W+U- W+V- U+V- U+W- V+W- According to this sequence, the motor rotates forward (CW, clockwise), as shown in the figure below

 V+U- V+W- U+W- U+V- W+V- W+U- Commutation in this order is the reverse rotation of the motor (CCW, counterclockwise), as shown in the figure below

 4. When should the motor reverse direction? How to know the real-time position of the motor?

@1. First of all, we need to know the real-time position of the motor, or in detail, where is the permanent magnet rotor of the motor? Without knowing where the rotor is, don't you know which winding to drive when? So the premise of driving the brushless motor is that we must know the current position of the rotor. The way that brushless motors rely on sensors to provide rotor position information for driving is called inductive drive. The Hall sensor is used to detect the position of the permanent magnet stator.

@2. How does Hall work? The Hall sensor can detect the change of the magnetic field. According to the characteristics of the detection of the change of the magnetic field, a certain circuit is used to convert the signal of the change of the magnetic field direction into different high and low level signal outputs.

 Taking the Hall sensor as a reference, when the rotor rotates, the magnetic field change and output signal detected by the Hall sensor are as follows.

 Like the evenly distributed stator of the brushless motor, the three Hall sensors used to output the three-way magnetic field signals are also evenly distributed around the brushless motor. The electrical angle difference between two adjacent sensors in each phase is 120°. When the direction is turned, the output of the 3 Halls will change according to the law of 6 steps.

 @2. The relationship table of Hall sensor U, V, W three-phase and motor U, V, W three-phase motor forward and reverse

 

Assume that the U value of the Hall sensor is the high bit of bit2, the V value is bit1, and the W value is bit0.

Motor positive conversion value: V+U- W+U- W+V- U+V- U+W- V+W-

Corresponding forward rotation Hall value: 2 3 1 5 4 6

Motor reverse direction value: V+U- V+W- U+W- U+V- W+V- W+U-

Corresponding to reverse Hall value: 5 1 3 2 6 4

@3. Through the corresponding relationship between the three-phase values ​​of the Hall sensor U, V, and W and the three-phase values ​​of the motor U, V, and W in the forward and reverse directions, we can clearly know the rotor position at any time. According to the Hall sensor The input value can be arbitrarily reversed.

5. Realization of commutation algorithm in hardware and software

@1. Hardware design controls commutation

Regardless of whether it is U phase, V phase, or W phase, in the six states of motor commutation, sometimes it needs to be connected to the positive pole, and sometimes it needs to be connected to the positive pole, so there is a problem, how to control the switching of the three-phase polarity by half? Need to use a three-phase inverter circuit to achieve. 

The so-called three-phase inverter circuit is a circuit composed of three half-bridges, A+A-(U+U-) is a half-bridge, B+B-(V+V-) is a half-bridge, C+C -(W+W-) is a half bridge, and there are three half bridges in total, and these three half bridges correspond to the three-phase windings of A(U), B(V), and C(W) respectively.

If you want to control the polarity of the winding, you only need to control the "upper bridge arm conduction" or "lower bridge arm conduction" of the corresponding half bridge of the winding to connect the phase to the positive or negative pole. However, it should be noted that the upper and lower bridge arms of the half bridge on the same side cannot be turned on at the same time, otherwise it will short-circuit and burn the motor. To achieve 6-step control, it can be realized through a three-phase inverter circuit.

 We found that the above method directly loads the power to the coil, which will directly make the motor soar to a very high speed, which is not conducive to our control, so generally the high and low levels are replaced by PWM, which is very convenient. Control the coil current to control the rotor torque and speed. The following figure is a schematic diagram of PWM control mode

 

 

There are five common methods of using PWM to control brushless DC motors, namely:

PWM – ON: This method means that the upper half-bridge PWM of a certain phase controls the T1 time, and the corresponding lower half-bridge maintains a high level during the T1 time (that is, the lower half-bridge is normally on) ; Then in the following T2 time, the upper half-bridge of a certain phase remains high (that is, the upper half-bridge is normally open and turned on), and the lower half-bridge of the other phase is controlled by PWM in the T2 time period

ON–PWM: This method means that the upper half-bridge of a certain phase maintains a high level during the T1 time (that is, the upper half-bridge is normally on and on), and the lower half-bridge of the other phase is controlled by PWM within the T1 time; Then the upper half-bridge of a certain phase controls the T2 time in PWM mode, and the corresponding lower half-bridge maintains a high level during the T2 time (that is, the lower half-bridge is normally on);

H_ON – L_PWM: The upper half-bridge of a certain phase is always kept at a high level (that is, the upper half-bridge is normally open and turned on), and the lower half-bridge of the other phase is always controlled by PWM

H_PWM – L_ON: The upper half-bridge of a certain phase is always controlled by PWM, and the lower half-bridge of the other phase is always kept at a high level (that is, the lower half-bridge is normally on).

H_PWM – L_PWM: Both the upper half bridge and the lower half bridge are controlled by PWM. This kind of control must have a dead zone, otherwise it may cause a short circuit at the moment of commutation.

 

Analysis of the advantages and disadvantages of the above five commutation methods:

PWM-ON: The commutation torque ripple of the lower bridge commutation and upper bridge commutation is equal and the smallest; the non-commutation phase current ripple is also the smallest;

ON-PWM: The commutation torque ripple of the lower bridge and the upper bridge is equal and larger than that of PWM-ON mode, and the non-commutation phase current ripple is also larger than that of PWM-ON mode.

H_ON - L_PWM: The lower bridge commutation torque ripple and non-commutation phase current ripple are small and equal to the torque ripple and current ripple in PWMON mode, the upper bridge commutation torque ripple and non-commutation phase current ripple are large and equal to Torque ripple and current ripple in ON -PWM mode, etc.

H_PWM - L_ON: The lower bridge commutation torque ripple and non-commutation phase current ripple are large and equal to the torque ripple and current ripple in ONPWM mode, the upper bridge commutation torque ripple and non-commutation phase current ripple are small and equal to Torque ripple and current ripple are equal in PWM-ON mode. H_PWM - L_PWM: Maximum commutation torque ripple and maximum non-commutation phase current ripple. Different control methods have different effects on performance. For practical applications, you can try a variety of modulation methods, and then choose the optimal modulation method. It is generally believed that: unipolar modulation has smaller torque fluctuations, and bipolar modulation Moment fluctuations are large.

The driving hardware used next is the H_PWM – L_ON driving method.

@2. The software algorithm realizes the commutation mode.

First of all, the software must have a PWM method to control the conduction of the U, V, and W three-phase upper and lower bridge arms. The controller used here is Endi's AD18F06 processor, which is an 8-bit chip specifically for motors and touch.

The PWM output uses the timer3 timer, and the timer3 timer can output 4 channels of PWM with the same duty cycle and the same frequency. can also

Combine timer3 and HBRIDGE unit to output 6 non-complementary or complementary PWM waveforms.

 

HBRIDGE is implemented by a series of registers. These registers can be used to select the PWM modulation mode, dead-time setting, output polarity control, etc. There are three groups of HBRIDGE, the outputs are PWM00 and PWM01, PWM10 and PWM11, PWM20 and PWM21, among them, the schematic diagram of PWM10 and PWM11 is as shown in the figure below, and the principles of PWM00 and PWM01, PWM20 and PWM21 are the same.

Note: The upper arm corresponds to PWM00, PWM10, PWM20 The lower arm corresponds to PWM01, PWM11, PWM21

Configure the timer3 timer and associate it with the HBRIDGE unit to control the output control of the 6-way PWM. Duty cycle duty and frequency Ft can be set.

The above is the conduction control of the three groups of upper and lower bridge arm control motors outputting U, V, and W three phases.

Next, analyze the input signal acquisition of the Hall sensor. The U, V, W three-phase data lines of the Hall sensor are connected to the IO pins of the processor, and then the IO port is configured as a double-edge interrupt trigger mode, and the U, V, W three-phase data is triggered to be read during the IO interrupt line value. There are many ways to read the value of the Hall sensor. The reason why we use the interrupt here is that the real-time performance of the interrupt is very high, which is of great benefit to the subsequent commutation algorithm software processing. Of course, it is also possible to start a timer and read the values ​​of the U, V, and W three-phase data lines in the timer interrupt, but this method has certain aftereffects, especially when the motor speed is very high, such as 10000rpm, In order to meet the requirements of speed control, the data fed back by the Hall sensor must be processed in a timely and effective manner, otherwise the speed control may not meet the requirements. The most fundamental reason for the speed control failing to meet the requirements is that the motor commutation is not timely.

Combined with the above description, we read the values ​​of the U, V, and W three-phase data lines in real time during the IO interrupt. Then we put the U-phase value in bit2, the V-phase value in bit1, and the W-phase value in bit0.

If our hall sensor is working normally, the whole motor and circuit are running normally. Then the HallData value of the U, V, W three-phase data lines of the Hall sensor is in the range of 0~7.

0: It means that the value of the Hall sensor is not collected, but we analyze that the reason for this situation is that either the Hall sensor is faulty, or there is a problem with the software configuration, or there is a problem with the motor and circuit design.

7: Indicates that the value collected by the Hall sensor is disturbed, that is to say, the value collected by the Hall sensor is abnormal. This problem should also be ruled out.

Under normal circumstances, according to the above-mentioned commutation truth table, the effective value is in the period of 1~6.

If it is forward commutation, then the relationship is as follows:

Motor positive conversion value: V+U- W+U- W+V- U+V- U+W- V+W-

Corresponding forward rotation Hall value: 2 3 1 5 4 6

The Hall value corresponds to the conduction relationship of the U, V, and W bridge arms of the motor at this moment.

 

const vu8 PMS_Config[]={0x80,0x9f,0xb7,0x9f,0xbd,0xbd,0xb7,0x80};

const vu8 PXC_Config[]={0xc0,0xc4,0xc1,0xc1,0xd0,0xc4,0xd0,0xc0};

The 2 lines of code excerpted above are the core commutation algorithm, which maps the Hall value, the commutation table and the conduction relationship of the upper and lower bridge arms together.

2         V+U-                   PMS_Config[2]:0xb7, PXC_Config[2]:0xc1:V+U-

3         W+U-                 PMS_Config[3]:0x9f, PXC_Config[3]:0xc1:W+U-

1         W+V-                 PMS_Config[1]:0x9f, PXC_Config[1]:0xc4:W+V-

5         U+V-                  PMS_Config[5]:0xbd, PXC_Config[5]:0xc4:U+V-

4         U+W-                 PMS_Config[4]:0xbd, PXC_Config[4]:0xd0:U+W-

6         V+W-                 PMS_Config[6]:0xb7, PXC_Config[6]:0xd0:V+W-

Through the above analysis, the HallData value of the Hall sensor corresponds to the subscript value of the commutation table array, and only the software implementation of PMS_Config[HallData] and PXC_Config[HallData] is needed to realize the forward commutation.

Next, let’s look at the analysis of the motor’s reverse steering software algorithm:

Motor reverse direction value: V+U- V+W- U+W- U+V- W+V- W+U-

Corresponding to reverse Hall value: 5 1 3 2 6 4

we discover:

The subscript of the commutation table corresponding to V+U- is 2, and the Hall value HallData is 5

W+U-corresponding commutation table subscript is 3, and Hall value HallData is 4

Through the above analysis, we found that 7-5=2 is the subscript of the commutation table. 7-4=3 is the subscript of the Hall value, then we deduce that the value of 7-HallData is the subscript of the corresponding commutation table, so that the same commutation table can be used to realize the commutation of Hall.

The above is all the analysis content of the commutation principle. A screenshot of the software implementation is attached.

 

Guess you like

Origin blog.csdn.net/qq_27568125/article/details/126631125