Design of Universal Motor Control Device Based on Atmegal6 Single-Chip Computer

The drive and control of motor is an important research topic in modern Electronic technology. Different types of motors require different control and drive methods. Using a high-performance single-chip microcomputer as the core of the motor control drive device can effectively reduce the cost of the motor drive, expand the application range, and improve the flexibility of use.

0 Preface

The drive and control of motor is an important research topic in modern electronic technology. Different types of motors require different control and drive methods. Using a high-performance single-chip microcomputer as the core of the motor control drive device can effectively reduce the cost of the motor drive, expand the application range, and improve the flexibility of use.

The ATmegal6 microcontroller is a high-performance 8-bit AVR microcontroller from ATMEL. It has a powerful programmable timing and counting unit inside. It can easily generate the driving waveforms of various AC, DC motors and stepper motors through programming. Therefore, using this kind of powerful single-chip microcomputer as the core of the motor controller can make the controller application more flexible, wider application range and lower maintenance cost. The universal motor control device designed in this paper has complete functions. Its liquid crystal Display device and buttons can control and display the running state of the motor, while the digital temperature sensor can effectively and accurately monitor the running temperature of the motor. The RS485/232 bus communication interface can Networking of multiple controllers. So as to realize the intelligent remote control of the motor.

1 Motor control and drive circuit design

Fig. 1 shows the overall structure diagram of a general motor control device system. The whole microcontroller system takes ATmegal6 microcontroller as the control core, and the slave microcontroller and the master microcontroller use I2C bus to communicate. Connecting the buttons and the LCD screen from the single-chip microcomputer can realize the function of human-machine interface, which can save the precious I/O resources for the main single-chip microcomputer and improve the operating efficiency of the system. In addition, DSl8820 adopts single bus structure to collect temperature, which can realize the monitoring of motor temperature.

Design of Universal Motor Control Device Based on Atmegal6 Single-Chip Computer

1.1 ATmegal6 main control circuit

ATmegal6 microcontroller has 3 timer/counter T/C0, T/Cl and T/C2 with PWM function, of which T/C0 and T/C2 are two 8-bit timer/counter, and T/Cl is 16-bit Timer/Counter with Input Capture.

The main control microcontroller circuit of this system is shown in Figure 2. It takes megal6 single-chip microcomputer as the core, and is equipped with peripheral reset circuit and oscillator circuit. All the I/Os of the single-chip microcomputer can be independently led out for connection and expansion with external circuits.

Design of Universal Motor Control Device Based on Atmegal6 Single-Chip Computer

1.2 Motor temperature monitoring circuit

The surface temperature of the motor is an important indicator to measure whether the motor works in a safe state. The motor temperature monitoring circuit of this system is realized by the single-bus digital temperature measurement integrated circuit DSl8820 introduced by DALLAS semiconductor Company of the United States. The digital sensor has a wide temperature measurement range (-55°C to +125°C), only three leads are required for operation, and multiple DSl8820s can be connected in parallel to monitor the temperature of multiple motors.

When the system is working, DSl8820 can transmit the measured temperature data to the one-chip computer. If the user setting is exceeded, the system can also perform procedures such as motor protection and alarm. The structure of the motor temperature monitoring system is shown in Figure 3, and Figure 4 is its temperature monitoring circuit.

Design of Universal Motor Control Device Based on Atmegal6 Single-Chip Computer

1.3 Keyboard and LCD interface circuit

The key and LCD interface control circuit of this system is based on the single chip AT89S51, which uses the I2C bus to communicate with the main single chip. Using this design of separation of the master and slave microcontrollers can centrally manage some low-speed devices that occupy a large amount of IO port resources, thereby saving hardware resources and program overhead for the master microcontroller, and improving the flexibility and operating efficiency of the system. Its LCD display and keyboard processing circuit are shown in Figure 5.

Design of Universal Motor Control Device Based on Atmegal6 Single-Chip Computer

1.4 RS-232/485 communication circuit

In order to meet the networked and intelligent requirements of motor control, this motor controller has RS232/RS485 data interface. Using these two bus interfaces, users can easily connect multiple motor controllers into a network, so as to facilitate the centralized management of the motor system. The RS485 interface circuit uses the “transparent” management of the transceiver control. The transceiver switching of the MAX485 chip is automatically completed by the monostable circuit composed of NE555. When the microcontroller needs to transmit data to the RS485 bus, the NE555 can automatically switch the MAX485 to the sending state. After the transmission is complete, the MAX485 will return to the receiving state. The RS-232/485 bus driver circuit is shown in Figure 6.

Design of Universal Motor Control Device Based on Atmegal6 Single-Chip Computer

1.5 Motor drive circuit

The drive part of this controller uses Sunplus SPGT62C19B motor driver chip to realize the drive of DC motor and stepper motor. SPGT62C19B is a low voltage monolithic stepper motor driver

The output voltage can reach 40 V, and the output current can reach 750mA. When designing, the width and frequency of the output pulse can be determined by the input logic level. The motor drive system composed of this chip integrates the pulse generator, the pulse distributor and the pulse amplifier, so many peripheral devices can be omitted. Like other components, the main control circuit is also designed as an independent module. In order to facilitate replacement, and the module can also be used for other occasions. Its motor drive circuit diagram is shown in Figure 7.

1.6 Speed ​​measurement circuit

The rotational speed measurement can be realized by a set of infrared pair tubes used on the mouse, and its circuit principle is shown in Figure 8. When the gap between the infrared transmitting tube and the infrared receiving tube is blocked by the opaque part of the grating turntable of the DC motor, the infrared receiving tube is in the cut-off state, and the SPEED output in the figure is high at this time. On the contrary, when the light-transmitting groove of the grating turntable is turned between the infrared pair tubes, the infrared receiving tube is in a conducting state, and SPEED outputs a low level at this time. In this way, the SPEED is connected to the I/O port of the single-chip microcomputer, and the rotation speed of the motor can be calculated by the method of timing counting.

Design of Universal Motor Control Device Based on Atmegal6 Single-Chip Computer

2 MCU programming

2.1 Main program

The program design of this driver adopts the idea of ​​modular programming, and its main program is used to complete the calling of each subprogram. After the system works, first call the initialization subroutine to complete the selection and setting of I/0 pins with multiplexing functions, the selection and setting of various interrupt functions, the initialization of AT89S51 and ATmegal6, the setting of interrupt mask register, and the interrupt register. The reset of the system variable, the initialization of system variables, etc., and finally complete the opening of the interrupt. After the initialization is completed, the system will call the driver and complete the startup of the system. After the system is started, it enters the normal operation state. All the running process of the system can be controlled and adjusted in real time by the keyboard.

2.2 Initialization procedure

The flow chart of the initialization procedure of the system is shown in Figure 9. The program includes the initialization of human-machine interface parts such as LCD display and keyboard. The main function is the selection and setting of pins with multiplexed functions, as well as the selection and setting of various interrupt functions (such as external keyboard interrupt selection, etc.), including AT89S5l initialization, keyboard mode selection, working time determination, Display mode settings, etc. The initialization of the system variables includes the setting of the temperature, the setting of the initial value of the speed and so on.

Design of Universal Motor Control Device Based on Atmegal6 Single-Chip Computer

2.3 Control program

After the system starts, it enters the control program. The control program is the main part of the system program, which is mainly used to ensure the normal operation of the system at a given speed. This program mainly adjusts the duty cycle of the PWM port of the microcontroller, thereby adjusting the average voltage across the motor windings to achieve the purpose of speed regulation. Its control program flow is shown in Figure 10.

Design of Universal Motor Control Device Based on Atmegal6 Single-Chip Computer

3 Conclusion

This design implements a motor control device with ATmega16 microcontroller as the core. The device has functions such as output of various motor drive pulses, motor temperature monitoring and protection, man-machine interface and long-distance industrial bus communication. Using the software and hardware characteristics of AVR microcontrollers, the drive and control of various motors can be realized, which can be used in motor drive research, networked motor centralized control and other fields. Because the controller adopts the design of master-slave single-chip microcomputer, the operation of the system can be well divided. Among them, the slave single-chip microcomputer realizes low-speed human interaction, and the master single-chip microcomputer realizes high-speed motor drive and control. the highest operating efficiency. The motor control device has an open structure and flexible use, and can be well applied to various motor drive and control fields such as the speed control of DC motors, the variable frequency drive of AC motors, and the step subdivision of stepper motors.

The Links:   MG75Q1BS11 MDC100B-18