Design of Plastic Sealed Brushless Motor Controller Based on Hall Effect

With the rapid development of electronic technology, brushless DC motors (BLDCM) are widely used in various fields such as electronics, industrial control, and the medical field because of their high efficiency, noiselessness, and high speed. However, the traditional BLDCM has large torque and cannot accurately determine the rotor position information. Therefore, this paper proposes the use of a Hall sensor controller to control the BLDCM and carries out the hardware circuit design of the motor driver circuit, Hall circuit, power supply circuit, etc., and the program control of STM32, and carries out the software design of PWM interrupt subroutine, AD picking like the program, etc., to realize the Hall effect sensor. The control of BLDCM is carried out.


Introduction
The brushless DC motor (BLDCM) [1] is a type of motor that is rapidly gaining in popularity.It is mainly composed of a rotor made of permanent magnets, a stator made of silicon steel laminate, and a position sensor.With the rapid development of electronics, the elimination of the carbon brush slip ring structure [2][3], while having all the advantages of a conventional DC motor, has become one of the most promising new motors of the 21st century.Instead of using brushes for commutation, electronic commutation is used [4][5].Compared to brushed DC motors and induction motors, they have many advantages: better torque and speed characteristics, fast dynamic response, high efficiency, long service life, noiseless operation, and a high-speed range.Because of these advantages and their simple construction, they are widely used in consumer electronics, industrial control, high-end home appliances, and medical applications.
Traditional square wave control methods with high torque pulsation are no longer sufficient for today's needs.In order to improve control performance, more precise information about the rotor position is required.Although sensorless techniques or the addition of mechanical sensors can be used, they both have a number of drawbacks.Control algorithms using sensorless techniques are mostly complex and difficult to start, making them unsuitable for practical applications.The method of adding mechanical sensors [6][7][8][9], on the other hand, has disadvantages such as a significant increase in cost and the fact that the detection accuracy can be affected by the environment and take up space.Therefore, the method of using Hall sensor controllers is more reliable and effective.In the case of cost control, demanded accuracy is not high, control volume, the Hall sensor controller is the best choice, and the Hall sensor controller in the control system has extremely wide application prospects [10][11][12].

Principle of operation
For the BLDCM to rotate properly, the rotor position needs to be sensed, which is achieved through the output signal from the sensor, and the output signal is transmitted to the phase change circuit to drive the motor.The three-phase stator winding is connected in a star shape, with a symmetrical distribution with a difference of one hundred and twenty degrees.To achieve commutation operation, the switching sequence of the six switching tubes (VT1-VT6) needs to be controlled to change the energizing sequence of the coils.The switching of these six power tubes is in fact the specific position of the rotor and is controlled via the control circuit, which enables the motor to run and complete the commutation operation.

General structure design of the hardware circuit
A three-phase inverter composed of three half-bridges (six bridge arms: three upper bridge arms and three lower bridge arms) is used to control the motor rotation, with each bridge arm equipped with an electronic switch (MOSFETS tube).The hardware circuit diagram is shown in Figure 1.The STM32 is chosen to control the on/off of the six MOS tubes A+, A-, B+, B-, C+, and C-so that it is not feasible to connect the pins of the STM32 directly to the pins of the MOS tubes for control.As certain conditions are required for MOS tube conduction, a driver circuit is required to achieve this by using a dedicated MOS tube driver IC.

Motor drive circuit design
The MOS tube model of the driver board for the six bridge arms is IRF540NS and its characteristic parameters are shown in Table 1.The IRF540NS power field effect tube selected for this paper uses advanced manufacturing technology to make its performance better than other power field effect tubes.It has an extremely low on-state impedance and HEXFET design, a design that gives the component a fast conversion rate and higher durability.These characteristics make the IRF540NS more efficient and reliable, which is why we chose it for our hardware circuit design.In addition, it has a very wide range of applications.The IR2110S chip is used as the driver IC for the above-mentioned MOS tube (IRF540NS), as shown in Figure 2. The IR2110S chip has a small size, high driving capability, high integration, high bias voltage, and fast response.In addition, it has externally protectable blocking ports for easy debugging.Although the bias voltage is high, it does not exceed 600 V.The IR2110S chips can jointly drive two of the bridge arms, however, we need to drive six bridge arms, so three IR2110S chips are required to drive the IRF540NS.The circuit is powered by a bootstrap capacitor, so a 10-20 V supply is sufficient.The response time is Ton/Tof=120/94 ns.This chip will then reduce the cost and also increase the reliability of the product.The IR2110S has a pin that acts as a shutdown and can be used for emergency contingencies.
NMOS tube conduction basic conditions: VGS is greater than a certain threshold value VGS (th) (IRF540 chip threshold value of 4 V).In this paper, the chip IR2110S power supply voltage is designed to be 15 V, and then the chip IR2110S low-end drive is also the figure of Q6 (chip IRF540), you can easily meet the NMOS drive conditions.IR2110S high-end drive, that is, to drive Q5 IRF540, you need "bootstrap circuit" support.The bootstrap circuit is the boost circuit (its role is to drive the high-end drive, Q5 chip, so that the chip IR2110S pin number eight, that is, HO, the output signal can meet the conditions greater than VGS (th)), the circuit D7 diode and C13 capacitor for the bootstrap circuit.
In Figure 2, the left side of the IR2110S chip uses three TLP715s, which are used to control the signal inputs.However, the actual motor drive is a high voltage and high current drive, so this reflects the role of the TLP715 because it is with isolation protection, which can effectively protect the normal operation of the circuit.It also has a boosting role, the STM32 chip pin voltage we used is 3.3 V.If the STM32 and IR2110S are not directly connected, it is necessary to convert the 3.3 V PWM signal into a 15 V signal by boosting the voltage, and the IR2110S input can be achieved by such a conversion operation.

Power circuit design
This paper uses 15 V and 9 V voltages, uses an LM7809 chip to produce 9 V voltage, and designs a 3.3 V power supply at the same time.The maximum input voltage of the chip is 37 V, so it is normal to heat up during normal operation, and a radiator can be added to assist the heat dissipation.The 3.3 V voltage is generated by the LM1117T.The circuit design is shown in Figure 4.

Protection Circuit
In order to detect the bus voltage and ambient temperature, and to detect whether there is overvoltage, undervoltage, or high-temperature risk, a protection circuit is added on the drive board to play a circuit protection role in the moment of crisis.The protection circuit is shown in Figure 5.

Sampling circuit design
The voltage and current in the circuit need to be collected during the operation of the motor, so the sampling circuit is designed as shown in Figure 7.

Main program design
The main program is mainly initialized, such as system initialization, the initialization of each function module (mainly to complete the initialization of peripheral function modules, including the Hall IO module, ADC module, and PWM module), interrupt initialization, etc.The main program flow chart is shown in Figure 8(a).
The initialization of the system is completed by initializing the clock module and watchdog, as well as the PLL.For function module initialization, it includes the initialization of many modules, such as PWM module initialization, Hall IO module, and ADC module.For PWM module initialization, register configuration GPIO0-5 pin function is PWM function.The sub-module time base counter of PWM1-3 is set to the technical mode of complementary output (increment or decrease mode).The ADC module samples are in cascaded sequential mode and then initiate the conversion of the AD through a periodic interrupt of the PWM.The initialization of the Hall IO module is through the configuration of the register GPIO67-69 pin function to set to the general input and output function and set to the input and use it to obtain the three-phase Hall status signal.Through the cycle of the CPU timer, the cycle count is carried out, and then each interrupt obtains accurate information by reading the data recorded in the CPU timer.Then through Hall detection, the motor is started to control the start and stop of the motor and determine whether to enter the interrupt to cycle the interrupt procedure.

PWM interrupt subroutine design
The PWM interrupt program is the core part of the whole BLDCM control.In this paper, the PWM cycle frequency is set to 12.5 KHZ, and the PWM cycle task is set to generate an interrupt every 0.08 ms, and then enter the AD sampling.The calculation of the duty cycle is based on updating the rotor position Angle, and the duty cycle of each bridge arm is calculated and assigned to the corresponding register.The block diagram of the PWM interrupt sub-program is shown in Figure 8

AD appearance programming
In the operation of the motor, the AD module is needed to collect voltage and current signals, as shown in Figure 9.In this paper, AD automatic sampling is adopted, and the corresponding AD pin data is automatically collected according to the set AD sampling period.In the software, we only need to read the collected data in the AD cache (ADCBUF0-ADCBUFF).We read AD data in an interrupt mode.The AD module is set to output an AD interrupt when 16 data are collected, and the collected data are processed in the next step.Figure 9. Sampling time At the same time, the values of phase current and bus voltage need to be stored.The data structure used is the cyclic queue.The circular queue structure uses Pointers, which move forward one position each time new data is stored, overwriting the last data in the queue, so the number of data stored in the queue can always remain the same.The advantages of this method are that it can save storage space, the operation is simple (just move the pointer), and it is easier to filter (such as moving average filtering, that is, the average of the first n input data is used as the output value).Therefore, you only need to average the data stored in the queue to get the output value.The specific AD sampling procedure flow chart is shown in Figure 10(a).

Level reference interrupt subroutine design
By referring to the change of electrical frequency to detect whether the Hall signal changes, so as to initialize the relevant data, the rotation direction of the motor, electrical Angle, initial speed, and a series of operations are determined.According to the change of the Hall signal, the rotor rotation direction is judged, and the initial electrical Angle is determined according to the Hall signal and the rotor rotation direction.In the interrupt program of reference level change, the motor commutation operation is carried out to determine whether the Hall signal is correct, store the running time, clear the timer, calculate the speed, etc.The running time of the sector is completed by the TMR l timer.When the Hall signal is detected to be wrong, the TMR l will not be cleared.After confirming that the Hall signal is correct, the TMRl count value is stored in the queue as the run time and the count value is cleared to start the timing of the next sector.

Conclusion
In this paper, the controller of plastic-sealed BLDCM is designed based on the Hall effect.The main components of the control system include the control chip (STM32), Motor drive circuit, sampling circuit, and Hall circuit.In this paper, the speed of the motor is controlled by pulse width modulation (PWM) technology based on the six-step commutation method.For 6-step PWM program implementation, the BLDCM driver adopts 6-step PWM, using advanced control timer generation.Generally, it is the PWM modulation mode of H-pwm-L-on or H-on-L-pwm, both of which can be simplified to 3 PWM output plus 3 level output to control the implementation.This paper uses the timer function to output PWM control.For the BLDC drive implementation, the Hall interface is three-phase, three wires are connected to the three input channels of the timer, and the timer is configured as the Hall sensor interface function.When any Hall sensor interface changes, the six-step PWM commutation function is run to change the state of the function.The six-step PWM designed in this paper is very suitable for controlling the robot, the current sampling is convenient and the control is simple.

Figure 6 .
Figure 6.Control interface and anti-signal interface design Circuit design

Figure 7 .
Figure 7. Sampling circuit (b) below.(a) Main program flow chart (b) PWM interrupt program block diagram Figure 8. Programming drawing If the TMRl overflow occurs, it indicates that the motor is blocked, and the timer overflow will trigger the interrupt program and start the blocking protection program.Undervoltage and overvoltage protection is also set in the program.The programming flow chart of reference level change is shown in Figure 10(b).
(a) Subroutine design block diagram of the sampling circuit (b) Interrupt program block diagram of reference level change Figure 10.Subroutine design diagram

Table 1 .
Characteristic Parameters of the IRF540NS