No recent searches

  • to select
  • to navigate
  • to close

Design of a new ranging system based on infrared and ultrasonic sensors

Sensors are a very important part of artificial intelligence research, and if we want to make machines more intelligent, we need to use sensors to give them various senses like people. Combining the characteristics of infrared sensor with short distance measurement and high accuracy, and ultrasonic sensor with long distance measurement and low accuracy, this paper designs a new distance measurement system based on STM32 single chip microcomputer, which integrates infrared sensor GP2Y0A02YK0F and ultrasonic sensor HC-SR04, and optimizes the distance measurement algorithm. The experiment shows that the system can make up for the deficiency of single sensor, improve the ranging accuracy, and has the advantages of simple structure, low cost and convenient use. The new ranging system is applied to the control system of intelligent unmanned vehicle, and the obstacle avoidance performance of the vehicle can be improved, and the effect is remarkable.

0 Introduction

Infrared sensor has high measurement data accuracy but short measurement distance, while ultrasonic sensor has long measurement distance but low accuracy [1]. Therefore, this paper uses ultrasonic sensor and infrared sensor, which complement each other in performance, and combines the advantages and disadvantages of the two sensors to carry out algorithm fusion of the measured data. More accurate measurement data can be obtained over a longer range. The new ranging system can be applied to a variety of occasions, has the advantages of simple structure and low cost, and has a wide range of application value in unmanned vehicles, robots and other fields [2-3].

1. Overall design of new ranging system

Design scheme: A set of distance data is measured by infrared and ultrasonic sensors respectively, and the two sets of data are transmitted to the control system. The third set of data is calculated by fusion algorithm, and the algorithm parameters are modified by experimental values. The third set of corrected data is taken as the final ranging value, and the measurement range is 20 ~ 150cm. The data will be transmitted to the control terminal for monitoring, and the receiving part will process the data at the same time after receiving the data to finally form a visual output [4].

The master of the system is divided into three parts, It is divided into the control part of data processing with STM32F103ZET6 MCU, the distance measuring part of initial distance measurement with HC-SR04 ultrasonic sensor and GP2Y0A02YK0F infrared sensor, and the signal transmission part of connecting the host and the control system with HC-05 Bluetooth module. After receiving the signal, the host carries out data recording and monitoring, and uses the LCD1602 display screen to display the data.

2 System hardware design

2.1 Control Part

In this paper, STM32F103ZET6 chip is selected as the microprocessor. This chip has low cost and low power consumption, but it has powerful and numerous functions. It can execute interrupt program successively according to different priorities, which can meet the needs of this system.

2.2 Ranging Part

The ultrasonic wave will be reflected when it encounters the medium in the propagation process, and this characteristic of the ultrasonic wave can be used for ultrasonic ranging.

The design uses HC-SR04 ultrasonic sensor module as the ultrasonic ranging part, this module has stable performance, measuring range of 2 ~ 400cm, measuring distance is large, blind area is small, with up to 0.3cm ranging accuracy.

The transmitting end of the ultrasonic sensor is transmitted to the measured object, and after the receiving end of the ultrasonic sensor receives the reflected ultrasonic wave, the propagation distance of the ultrasonic wave can be calculated according to the time difference between the transmission and reception.

The infrared distance measurement part uses Sharp gp2y series infrared sensor, Sharp's infrared distance measurement sensor adopts the principle of triangulation. Triangulation is an indirect method of measuring the distance of a target, also known as trilateral measurement. The design sets the target as the third point of a triangle, and when the length of a side and the two angles of the emitted and reflected light are determined, the distance from the target can be calculated. The measurement principle of infrared sensor is shown in Figure 2. Using mathematical geometry knowledge, the distance D from the sensor to the object can be obtained by the following formula: D= (X/L) × f (1)

In formula (1), D is the distance to be measured, L is the offset value after the CCD detector receives the signal, X is the distance between the transmitter and the receiver center, and f is the focal length of the light receiving lens.

In the selection of the type, the range range and the target of the ultrasonic sensor are considered, and the GP2Y0A02YK0F infrared sensor is chosen as the final choice in this system. This infrared ranging sensor has a high measurement accuracy and a measuring range of 20 ~ 150cm.

2.3 Signal transmission part

The signal transmission part uses HC-05 Bluetooth module. The HC-05 Bluetooth module has 6 pins, in addition to the positive and ground pins and the LED pins used to detect the connection status of the Bluetooth module, there are TXD and RXD pins and KEY pins. The HC-05 supports the use of standard AT commands to enter special command mode when the device is started and then data mode, so that it can communicate wirelessly with other devices up to 10m. The control terminal receives infrared ranging data, ultrasonic ranging data and final data after data processing from the car through the HC-05 Bluetooth module, and records and monitors the results.

LCD1602 liquid crystal display is a character display, when displayed, there are two lines of content, each line has 16 characters of the display, a total of 16 pins. LCD1602 mainly displays the final data after the system data processing, that is, the measured distance between the car and the front obstacle.

2.4 Unmanned vehicle experiment platform

In order to verify the effectiveness of the ranging system, the system is installed on the four-wheeled intelligent unmanned vehicle experiment platform. Since the effective distance of the ultrasonic distance sensor is less than the effective distance of the infrared distance sensor, the minimum detection distance of the system is 2cm, and when the sensor is installed, it is necessary to ensure that the distance between the transmitting end and the most front end of the car is greater than 2cm.

3. Ranging algorithm design

According to the design objective, in order to make the system complete the high-precision measurement in 20 ~ 150cm, the ultrasonic distance sensor and infrared distance sensor should first be measured once, and then the data is transmitted to the control system for processing, and the parameters closest to the actual distance are obtained through the data model established by a large number of experiments, and the measurement distance is finally output.

3.1 Ultrasonic Ranging

HC-SR04 uses IO port TRIG contact to measure distance, provides a high level pulse trigger signal of more than 10us, and sends 8 40kHz periodic levels inside the module and detects echoes. When the signal return is detected, the echo signal is output. The pulse width of the reverberating signal is proportional to the measured distance. The pulse width of the reverberating signal is the high level duration, and T is the high level duration. The expression is as follows: L1= (V× ΔT) /2 (2)

In formula (2), V is the speed of the sound, specifically 340m/s, and T high level duration, that is, the time of the ultrasonic wave from transmission to return.

If the period of the transmitted signal is too short, then the transmitted signal will have an impact on the reverberation signal, so the transmission period of the pulse trigger signal is set to 100ms.

3.2 Infrared Ranging

The infrared module is usually affected by the material, temperature, surface roughness and optical color of the measured object in use. However, in this system, the influence of the measured object on the measurement accuracy of the sensor will be greatly reduced because of the difference of infrared sensors. There is a mapping relationship between the voltage output of the sensor and the measured distance, and the measured distance can be obtained by measuring the voltage value. Sharp's gp2y series infrared sensor has a different output curve for each model. The characteristic curve of GP2Y0A02YK0F sensor is shown in Figure 3, which is the reference characteristic curve of 0A02 sensor given by the manufacturer. As can be seen from Figure 3, the minimum detection distance of the sensor is 20cm.

1691645153266164

Figure 3GP2Y0A02YK0F sensor characteristic curve

3.3 Algorithm Design

After obtaining the infrared measurement data L-1 and ultrasonic measurement data L-1, the parameters k 1 and k 2 are obtained by comparing with the actual distance. The average algorithm is adopted to correct the distance value: L 3=k 1*L 1+k 2*L 2 (3)

Under different conditions of temperature, brightness, surface roughness of measured object and surface color of measured object, both k 1 and k 2 will change, so the average value is:

1691638822737451

In this case, we get a value of k 1 and k 2.

At the same time, the effective distance of the ultrasonic distance sensor selected by the system is slightly greater than that of the infrared distance sensor. Therefore, when the data of the ultrasonic sensor is received, the judgment is made again, and the result is less than 20cm or greater than 150cm, the data of the ultrasonic sensor is directly used as the final data. When the data range is 20 ~ 150cm, the final data is calculated by equation (3) combining the data of the two sensors. The key point of this system design is to measure the data within 20 ~ 150cm. The ranging system flow is shown in Figure 4.

1691645206168983

Table 1 Experimental measurement data within the measurable range

Note: k1=0.568; k2=0.422 Mean relative error =0.1154%

4 Experimental data and analysis

In order to verify the effect of the ranging system, this paper conducts a series of tests. 10 sets of test data are selected. L1 is the ultrasonic ranging sensor data, L2 is the infrared ranging sensor data, and L3 is the final data processed by the control system, that is, the final data obtained by measurement. The experimental measurement data within the measurable range are shown in Table 1.

It can be seen from Table 1 that the average relative error of the distance measurement by the fusion of ultrasonic sensor and infrared sensor is less than 0.3%, which meets the accuracy requirements of the detection system, indicating that the scheme of the distance measurement system is feasible.

Because ultrasonic ranging and infrared ranging will be affected by external factors, in order to further improve the measurement accuracy, you can set the k1 and k2 values in different environments. Through Bluetooth control, the system uses different k1 and k2 values in different situations.

5 Conclusion

A new ranging system based on infrared and ultrasonic sensors is designed in this paper. The system has the advantages of simple structure, low cost and high precision. It integrates the characteristics of infrared and ultrasonic sensors, improves the ranging algorithm, and thus improves the measuring accuracy and has a large measuring range. The application of this system in intelligent unmanned vehicles can improve the obstacle avoidance performance of unmanned vehicles, and also provides a new idea for the design of multi-sensor based ranging system.

Reference

[1] CAO Xiangbin, JIE Jiong. Design of Robot Ranging System Based on Multi-Sensor Data Fusion [J]. Electric Drive Automation, 2019,42(6):16-18.

[2] BAI Bingfeng, WEN Xiulan, ZHANG Zhonghui. Research on Obstacle Avoidance Algorithm of IN-RT Mobile Robot Based on Ultrasonic and Infrared Sensors [J]. Journal of Nanjing Institute of Technology (Natural Science Edition),2016,14(1):53-55.

[3] Zhang Lei, Zhou Jianquan, Ju Wenjie, et al. Research and Application of Distance Measurement System based on Ultrasonic and infrared technology [J]. Electrical Automation, 201,43(3):99-101. (in Chinese)

[4] HONG Yimin, QIAN Qingfeng, ZHANG Zhifei. Design of Tracking Obstacle Avoidance Distance Measurement for Intelligent Car based on STM32 [J]. Internet of Things Technology, 2012,12(1):12-13,17.


  
Copyright @banning 2024. All rights reserved.