introduction
Belt drive is a common transmission device used in industrial production. Its commonly used speed detection device is a photoelectric encoder installed at the rotating end of the motor. However, in the long-term use of the equipment, due to unpredictable conditions such as wear, the motor speed and the belt drive speed are seriously inconsistent. This semi-closed loop control method has a large error in the belt drive speed control that requires high precision. Grating rulers are expensive and have high requirements for the on-site environment, so they are often not very suitable for the modification of belt drives in ordinary working conditions. In view of this, this paper proposes to use a general commercial photoelectric mouse to replace the traditional detection device, and realize the on-site PID control through the AT89S51 microcontroller, so that the belt drive speed meets our satisfactory requirements.
1. Hardware composition of the detection system
1.1OM02 optical sensor chip and mouse controller
This optical COMS sensor is a non-contact photoelectric mouse chip for personal computers . It integrates a digital signal processor ( DSP ), a dual-channel orthogonal output port, etc. There is a photosensitive eye at the bottom of the chip, which can continuously take pictures of the object and send the two images to the DSP for processing to obtain the direction and distance of movement. The displacement value generated by the DSP is converted into a dual-channel orthogonal signal, and with the mouse controller, the dual-channel orthogonal signal is converted into a PS/2 data format that can be processed by the microcontroller. The device is installed on a set of plastic optical lens devices and is equipped with a high-intensity LED. In addition, it can provide a resolution of up to 400 dots/inch and a speed detection within 16 inches/second.
Figure 1 is the installation and assembly diagram of the mouse chip. Because the OM02 chip is a COMS sensor, it must be equipped with a high-intensity light-emitting diode that is compatible with it, and the emission angle and the bottom plate are within the range of 30° to 45°. After standard installation, the effective distance between the bottom plate and the working surface is within 0mm to 2mm, and the OM02 chip can perform normal data reception and detection.
1.2 Detection and control principle
This system adopts a full closed-loop control method, as shown in Figure 2 below. The displacement increment detected by the mouse is fed back to the microcontroller, and digital PID control is performed. The calculation result is transmitted to the inverter through the D/A conversion chip, thereby controlling the speed of the motor.
This experimental system is mainly composed of prime mover, transmission part, execution part and control part. As an important part of the machine, the mechanical transmission system should not only be able to achieve the expected function, but also have good performance. For this reason, this experiment uses a three-phase AC asynchronous motor (Y2-63M1-4 type, 0.12KW), a frequency converter (Fuji FRN0.4C1S-4C), a 30:1 worm gear reducer, a v-type B-phase belt transmission device, a P204 ball bearing and a bearing seat as the main transmission and execution parts of the simulated industrial equipment. By adjusting the output voltage U of the digital-to-analog converter through the single-chip microcomputer , the output frequency of the frequency converter can be changed, thereby changing the motor speed.
2. MCU Programming
2.1 Principle of Mouse Communication Protocol
The data communication method between the mouse and the microcontroller adopts the PS/2 communication protocol.
The physical interface of the PS/2 mouse is a 6-pin circular interface. Only 4 pins are needed for use: 1-pin Data, 3-pin GND, 4-pin +5V Power and 5-pin Clock.
The mouse implements a bidirectional synchronous serial communication protocol, sending or receiving data serially under the action of the clock signal. Usually, the microcontroller has bus control priority on the bus and can suppress the communication from the mouse at any time. The data from the mouse to the microcontroller is read on the falling edge of the clock, and conversely, the data from the microcontroller to the mouse is read on the rising edge of the clock. The clock signal is always provided by the internal chip of the mouse, and the clock frequency is generally 10~20KHz. [page]
2.1.1 MCU to mouse communication
According to the protocol requirements, the MCU only needs to pull down the clock line for at least 100us to disable its communication, and the MCU pulls down the data line to put it in the request to send state. As shown in Figure 3, when the clock line rises to a high level and is pulled down again by the PS/2 device, the MCU can start communicating with the mouse.
2.1.2 Mouse to MCU Communication
Because the MCU has control over the bus, when the mouse wants to send information to the MCU, it must first check whether the clock line is at a high level. As shown in Figure 4, when the clock line is at a high level and the data line is at a low level, it indicates that the mouse requests to send and the MCU can accept data from the mouse.
2.1.3 Control data sent by the microcontroller
According to the PS/2 protocol specification of the mouse, when programming, first send 0xff to the mouse to reset it. The default sampling frequency is 100 times/second, the scaling ratio is 1:1, and data reporting is prohibited. Use the 0xea command to enter the stream mode, and use 0xe8 and 0x03 commands to set the resolution to 8 points/mm. Use the 0xf4 command to enable data reporting. In conjunction with the timer function of the AT89S51 microcontroller, set its time constant to 0.1s, and send the 0xeb command to read the displacement data information each time an interrupt occurs. Each time it is issued, the displacement data packet received by the microcontroller contains the displacement information and key action information. The specific format is shown in Table 1. When compiling, you only need to extract the valid data packet of X3, that is, the displacement increment in the Y direction.
2.2PID control software algorithm
The system was simulated and tested in Matlab using neural network PID adaptive control , and the results were quite satisfactory. However, the multi-order matrix operations of the input layer, hidden layer, and output layer greatly increase the operation time of the single-chip microcomputer, resulting in an increase in the uncertainty of time. Compared with the incremental PID control, although the latter requires adjustment of three control parameters, it can also achieve the expected accuracy and significantly reduce the operation time. Therefore, the incremental PID algorithm can still be used as the control. The control algorithm of the incremental digital PID is:
U(k)=U(k-1)+*(e(k)-e(k-1))+*e(k)+*(e(k)-2e(k-1)+e(k -2))
Where e(k) is the change between the current displacement increment and the previous displacement increment. Similarly, e(k-1) and e(k-2) are the displacement changes in the previous time interval. [page]
By using the serial interrupt receiving function of the microcontroller, the kp, ki, and kd parameters of the PID can be adjusted in real time on the PC.
3. Host computer monitoring design
Send through the serial port of the microcontroller, write a program in LabVIEW to complete the PC control data communication equipment to exchange data, directly receive external data through the serial port and display it graphically, and store the data in a txt file. In Labview, direct serial port data communication is mainly achieved through VISA controls, and data communication is achieved through RS-232 serial interface and Labview.
The readstring control can be used for display. Data reception is not continuous, but with a certain delay. In order to achieve uninterrupted reception of serial data packets sent by the microcontroller, the previous write and delay must be removed. Because the data received by the serial port is character type, the data is converted to single-precision integer through forced conversion. Create an array to combine data and array initialization to obtain a complete array. The real-time display and recording of the host computer can be achieved through the Waveformgraph control and shift register.
4. Detection and control performance evaluation
The maximum constant frequency of the PS/2 interface is 33kHz. This experimental microcontroller uses a 12MHz crystal oscillator, which can easily complete the interface function. However, due to the characteristics of its chip, although the highest usable resolution of the OM02 mouse chip is 400DPI, when using a higher resolution, the error rate of the mouse transmission will increase, and its displacement accuracy will also be questioned. In order to ensure the accuracy of the displacement, a resolution of 200DPI is used, and with a watchdog, the accuracy error and program stability will be greatly improved.
5. Conclusion
Using an optical mouse as a speed sensor for detecting belt movement It is cheap, accurate and easy to use. Combined with the digital PID control of the microcontroller and the graphic detection of the labview software, it can be well modified for equipment with low speed requirements and not very high precision, so that it can achieve stable output speed. Because the optical mouse technology has become mature, the requirements for the detection surface are not high under the condition of general resolution, and it can still ensure smooth operation under relatively harsh working conditions. The laser mouse launched in recent years has a resolution of up to 0.01 mm, which is very effective. The experiment was tested on-site in a semiconductor company in Beijing, and the effect was ideal.
Previous article:Design and implementation of single chip caller display
Next article:Design of Temperature and Humidity Detection System Based on AT89S52
Recommended ReadingLatest update time:2024-11-16 15:54
- Popular Resources
- Popular amplifiers
- Analysis and Implementation of MAC Protocol for Wireless Sensor Networks (by Yang Zhijun, Xie Xianjie, and Ding Hongwei)
- Introduction to Internet of Things Engineering 2nd Edition (Gongyi Wu)
- 西门子S7-12001500 PLC SCL语言编程从入门到精通 (北岛李工)
- Modern Motor Control Technology (Wang Chengyuan, Xia Jiakuan, Sun Yibiao)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- What is the function of this circuit in ESP32_Audio_kit?
- Please ask about the problem in TI official application manual - boost principle
- TFT touch screen power supply problem
- STM32CubeMX uses LL library to set timer to control gpio flip
- What's the meaning of "Red umbrellas and white poles, lie down on the board together after eating"?
- 【Jiajiabao】 esp32s2 tcp+mqtt running
- I encountered several problems in the multisim simulation of the bandpass filter circuit, as shown in the figure. Which forum friend can give me some advice?
- No padsnet.err file is generated during synchronization. What is the reason?
- I would like to ask for some knowledge about voltage regulator diodes
- Android BLE low-power Bluetooth slave device application