Precision measurement of belt speed based on photoelectric mouse sensor and its control system

Publisher:心愿实现Latest update time:2012-07-07 Source: 21ic Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Mouse chip installation diagram

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.

Fully closed loop control

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.

Communication between MCU and 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.

Specific format

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.

Control data sent by the microcontroller

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.

Detection and control performance evaluation

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.

Reference address:Precision measurement of belt speed based on photoelectric mouse sensor and its control system

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

Future Electronics launches Infineon's new product trial - innovative CO2 sensor based on photoacoustic spectroscopy (PAS) technology
Shanghai, China – August 2, 2024 – Increasingly efficient building insulation can help mitigate the effects of climate change. However, well-insulated but poorly ventilated buildings can lead to a buildup of carbon dioxide (CO2), and even moderate concentrations can have a negative impact on health and work effi
[sensor]
TI drives innovation in driver assistance technology with new AWR2944 automotive mmWave radar sensor
In order to promote the development of autonomous driving technology and improve vehicle safety, Texas Instruments ( TI ) (Nasdaq: TXN) held a press conference in China today and announced the launch of the new AWR2944 automotive millimeter-wave radar sensor , which can help automakers improve the object sensing ca
[Automotive Electronics]
TI drives innovation in driver assistance technology with new AWR2944 automotive mmWave radar sensor
How to Choose an Ambient Light Sensor
With recent advances in semiconductor analog sensors and packaging, end users now have a wider range of choices in light sensors. Today, designers are using more light sensors than ever before in consumer, automotive, medical and industrial applications. There are several reasons for this, including improved photopic r
[Industrial Control]
How to Choose an Ambient Light Sensor
Design of digital thermometer based on 51 single chip microcomputer and DS18B20 temperature sensor
As usual, without further ado, here are the renderings of the Proteus simulation. Components list and instructions DC18B20 display part reference source code: ds18b20.C file: /******************************************************************** Program name: Temperature measurement system based on DS18B20
[Microcontroller]
Design of digital thermometer based on 51 single chip microcomputer and DS18B20 temperature sensor
Pepperl+Fuchs F77 Series Compact Intelligent Ultrasonic Sensors Enable Autonomous Cleaning Robots
With the rapid development of the photovoltaic industry, large-scale photovoltaic systems have sprung up like mushrooms after a rain, especially in areas with abundant sunshine and dry climate, where large tracts of solar panels are neatly spread out, which is spectacular. However, the cleaning problem of
[robot]
Mouser Electronics Now Stocking TDK Sensor Series for a Variety of Industrial Applications
Mouser Electronics now offers a wide range of industrial applications TDK InvenSense SmartIndustrial Sensor Series May 28, 2021 – Mouser Electronics, Inc., an authorized global distributor focused on introducing new semiconductors and electronic components, now offers the SmartIndustrial™
[sensor]
Mouser Electronics Now Stocking TDK Sensor Series for a Variety of Industrial Applications
Vishay introduces miniature infrared sensor module with modulated carrier output for code learning applications
Devices feature new in-house designed ICs that are pin-compatible replacements for previous generation solutions, reducing power consumption by 50% while improving performance MALVERN, Pennsylvania, USA, Shanghai, China — September 1, 2023 — Vishay Intertechnology, Inc. recently announced the launch o
[Industrial Control]
Vishay introduces miniature infrared sensor module with modulated carrier output for code learning applications
In-depth analysis of smart car on-board sensor calibration technology
Smart cars refer to intelligent transportation tools that integrate various advanced technologies. They not only have driving assistance and automatic driving functions, but also can realize multiple functions such as intelligent networking, intelligent perception and intelligent interaction. As an important part of
[Embedded]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号