Microcomputer's subdivision control of instrument stepper motor Instrument stepper motor Stepper motors are open-loop control elements that convert electrical pulse signals into angular or linear displacements. In the case of non-overload, the motor speed and stop position only depend on the frequency and pulse number of the pulse signal, and are not affected by the load change. That is, a pulse signal is added to a certain phase coil of the motor, and the motor rotates by one step. angle. The existence of this linear relationship, coupled with the stepper motor's only periodic errors and no cumulative errors, makes it very easy to control with stepper motors in the speed, position and other control fields. Although stepper motors have been widely used, stepper motors are not used conventionally like ordinary DC motors and AC motors. It must be used under the control system composed of double ring pulse signal and power drive circuit. The instrument stepper motor belongs to the category of small size and low power consumption in the stepper motor. It can be directly driven by the pins of the single chip microcomputer or special chip, without the need for an external driver, so it is used for the rotation control of the pointer in the instrument. demand analysis The instrument used in this solution has the following characteristics and design parameters: ◠The pointer responds sensitively and moves accurately, that is, it cannot lose steps after receiving the driving pulse; ◠The pointer moves smoothly, that is, the pointer should move smoothly from the current position to the target position, and no jitter can occur in both forward and reverse directions; ◠Two phases, step angle 10o, rotation range 300o. According to the technical parameters, the step angle when using two-phase four-beat and two-phase eight-beat is 10o and 5o, and only 30 and 60 scale divisions can be made within the range of 300o. In practical applications, the pointer step will be found The angle cannot meet the requirements and jitter is inevitable. In order to achieve accurate positioning and smooth operation of the pointer with high precision, the high-resolution subdivision of the stepping motor step is also the difficulty of the design. The stepping motor subdivision technology is an electronic damping technology. Its main purpose is to improve the running accuracy of the motor and realize high-precision subdivision of the stepping motor step angle. The basic concept is: the stepping motor is driven by the subdivision driver, and its step angle becomes smaller. For example, when the driver works in 10-division state, its step angle is only one tenth of the motor's inherent step angle. Take two phases and four beats as an example: when the motor works in the full-step state without subdivision, the control system sends a step pulse every time the motor rotates 10o; while the subdivision driver works in the 10 subdivision state, the motor only rotates 1o. The subdivision function is completely realized by the driver or the single chip computer by accurately controlling the phase current of the motor, and has nothing to do with the motor itself. Subdivision principle The driving state table of two-phase four-beat A, B, / A, / B is shown in Table 1. The driving state table of two-phase eight-beat A, B, / A, / B is shown in Table 2. From the above analysis, it can be seen that the two-phase four-beat is a full-step operation without subdivision, and the two-phase eight-beat is actually 2 subdivision. The angle between the resultant magnetic field and current vector changes in the manner of 90o and 45o, and so on and back. It is not difficult to find after referring to the relevant information: the subdivision drive technology often uses a sine wave-like stepped current instead of a rectangular wave current to generate a microstep rotating magnetic field, thereby driving the motor to rotate at a smaller step angle, its current waveform and rotating magnetic field The vector is shown in Figure 1. At the same time, because the sine wave current changes smoothly, the motor runs more smoothly and the noise is less. That is, by changing the size and direction of the adjacent two-phase (A, B) current (A-phase sine wave and B-phase cosine wave vector superimposed) to change the angle of the synthetic magnetic field, the stepper motor is controlled by the current vector synthesis Running. Hardware design and software programming According to the principle of subdivision, for two-phase stepper motors, the voltage magnitude and direction of two sets of coils need to be controlled at the same time to achieve the purpose of combined current vector control. There are two schemes for controlling the current size of the coils: one is to write through the single-chip microcomputer Digital quantity, the analog voltage is output by the digital-to-analog conversion device to control the coil current; the second is to output a square wave with a controllable duty cycle through the PWM pins of some microcontrollers, and use its AC effective value to control the coil current. Obviously, the duty cycle that changes according to the sine law determines that the coil current also changes according to the same sine law. The voltage application direction of the coil can be realized by a logic gate circuit. In summary, the ATMEGA48 microcontroller with two 16-bit precision PWM functions is selected. The peripheral hardware circuit design is shown in Figure 2. Use PB1 and PB2 with PWM function of this one-chip computer to connect PWM_A and PWM_B, use two ordinary pins to connect DIR_A and DIR_B to realize the control of the motor. The principle is explained as follows: A, / A, B, and / B of the motor correspond to pins 3, 6, 8, and 11 of the four-input AND gate circuit, respectively. When DIR_A and DIR_B are low, the 1 and 9 pins of the gate circuit are in the 0 state, the transistors Q3 and Q4 are turned off, and the 4 and 12 pins of the gate circuit are in the 1 state due to the pull-up. 8 The output is 0, that is, A and B are 0; At this time, the output of the 6 and 11 of the AND circuit is consistent with PWM_A and PWM_B, that is, / A and / B are determined by PWM_A and PWM_B. In other states, it has the same characteristics: the electrical polarity between A and / A, B and / B is determined by DIR_A and DIR_B; the current between A and / A, B and / B is determined by The duty cycle of PWM_A and PWM_B is determined. And as long as the transistors Q3 and Q4 work normally, there will be no logic confusion in the AND circuit. In accordance with the design of the hardware, an array of 64 data was written on the software, which corresponded to 8-bit digital quantized values ​​of 0 ~ 90o sine wave amplitude change (64-point sine wave sampling was simulated in the form of step wave), each The value is used to control the duty cycle of the output waveform, and actually participates in the calculation of the current during the rotation of the current vector angle of 90o. As we all know, the phase difference between the sine and cosine waves is 90o. After the 0 ~ 90o sine wave amplitude change table is known, the 90o ~ 180o, 180o ~ 270o, 270o ~ 360o (0o) sine wave and cosine wave amplitude change tables can also be obtained , So through the evolution of the 8-bit digital quantization table with a 0 ~ 90o sine wave amplitude change, the current vector angle can be divided into four quadrants on the basis of two-phase eight beats (two subdivisions), with the control of polarity, In each quadrant, the sine wave of A or / A and the cosine wave of B or / B are combined in 8 kinds, and the change in current size is completed in each combination, and finally the two-phase 64 beats (16 subdivisions) are made control. Moreover, the most ingenious point is: by selecting 64 data corresponding to 64 points of the sine wave every 90o range, you can use the size of one byte as a sign to distinguish the four quadrants, which is convenient for the angle of sine and cosine Evolve, that is, 0 ~ 63 corresponds to 0 ~ 90o, 64 ~ 127 corresponds to 90o ~ 180o, 128 ~ 191 corresponds to 180o ~ 270o, and 192 ~ 255 corresponds to 270o ~ 360o. The driving state table of two-phase 64 beats A, B, / A, / B is shown in Table 3 (with B as the starting state). Since the pointer of the instrument points from the current angle to the target angle, the amount of change will be different. In order to ensure that the pointer responds sensitively and without jitter, acceleration and deceleration control must be considered during forward and reverse rotation. In the program, you can set several control intervals according to the amount of change and positive and negative, write different delay parameters, and control the current size and direction (change PWM_A and PWM_B, DIR_A and DIR_B) according to this delay parameter In time, the purpose of controlling acceleration and deceleration is achieved. Conclusion Controlling the two-phase stepper motor by dual PWM not only achieves the purpose of high-precision subdivision, but also optimizes the hardware cost. By adding a power driving circuit and making a few modifications to the program at the subsequent stage of the existing circuit, it can be made into a high-precision, multi-division stepper motor driver. Disposable Vape Mini,Electronic Cigarette,Disposable Electronic,Disposable Vape Kit Shenzhen Niimoo Innovative Technology Co., Ltd , https://www.niimootech.com