Share this

Indoor mobile vehicle positioning system based on infrared ultrasonic photoelectric encoder

2026-04-06 04:49:29 · · #1

Currently, the use of ultrasonic technology for spatial measurement and positioning is quite common. Some methods utilize the reflection characteristics of ultrasound, while others combine infrared and ultrasonic sensors to adopt a trilateration positioning method. The former suffers from limitations in measurement accuracy due to the influence of the ultrasonic transmission medium, and the attenuation characteristics of ultrasound limit its propagation distance, which is further shortened by utilizing reflection characteristics. The latter method, while improving accuracy and increasing the measurement distance, introduces the problem of measurement blind zones. When more than three ultrasonic signals cannot be detected simultaneously at certain locations of the target, the system cannot locate the target. This paper, based on the second method, incorporates the photoelectric encoder ranging and positioning principle into the system to eliminate the positioning blind zone problem. 1 Positioning Principle 1.1 Infrared Ultrasonic Trilateration Positioning Principle First, a rectangular coordinate system is established indoors, defining the origin, X-axis, Y-axis, and Z-axis. Three reference points A, B, and C are set at fixed positions in the upper part of the room, with coordinates (x1, y1, z1), (x2, y2, z2), and (x3, y3, z3), respectively. The distances L, M, and N from the target point to the three reference points are measured using an infrared ultrasonic system as follows:

The coordinates (x, y, z) of the target point are obtained by solving equations (1) to (3). This is the positioning principle of infrared ultrasound, which is simple and easy to program. The following explains the principle of measuring the distance between the target point and the reference point. The large difference in magnitude between the speed of light and the speed of ultrasound is the basis for realizing the ranging function. The ranging principle is shown in Figure 1.

The propagation speeds of ultrasound and infrared light are constant, and their propagation distance versus time curves are both straight lines. The slope of the line represents the wave speed. It is easy to see that curve ① is the infrared light curve, and curve ② is the ultrasound curve. Given a specified distance D, suppose that infrared light and ultrasound start simultaneously from a reference point at time 0. The infrared light travels the specified distance in time t1, and the ultrasound travels the specified distance in time t2. Then D = vt2, where v is the speed of ultrasound. Let t = t2 - t1, we get D = v(t + t1). Given that the speed of infrared light is 3 × 10⁸ m/s and the speed of ultrasound in air is 3.4 × 10² m/s, within this distance range indoors, we can approximate t1 = 0, thus obtaining D = vt. The system installs microcontroller-controlled infrared and ultrasound transmitters at each reference point and infrared and ultrasound receivers at the target point, also connected to the microcontroller. At a certain moment, the reference point emits infrared and ultrasonic signals. The target point starts the internal counter of the microcontroller when it receives the infrared signal and stops the counter when it receives the ultrasonic signal. The time difference t between the two is recorded. Multiplying t by the ultrasonic speed gives the distance to be measured, D. In reality, signal processing always has a delay, and the resulting measurement error must be compensated. The final formula is: d = vt + n. Where: d is the distance measurement value; v is the ultrasonic speed; t is the time difference between the infrared light and ultrasonic wave reaching the target point recorded by the microcontroller; n is the system device delay error compensation term. 1.2 Principle of Optical Encoder Distance Measurement and Positioning An optical encoder is a sensor that converts the mechanical geometric displacement on the output shaft into pulses or digital quantities through photoelectric conversion. It is currently the most widely used sensor, consisting of a grating disk and a photoelectric detection device. The grating disk has several rectangular holes evenly spaced on a circular plate of a certain diameter. Since the photoelectric code disk (called the decoding wheel, see Figure 2) is coaxial with the motor, when the motor rotates, the grating disk rotates at the same speed as the motor. The detection device composed of light-emitting diodes and other electronic components detects and outputs several pulse signals. An optocoupler is composed of an LED and a photosensitive sensor. Inside the photosensitive sensor, two phototransistors, A and B, are arranged vertically. Due to the gap in the decoding wheel, when the decoding wheel rotates, the infrared light emitted by the LED sometimes shines on the photosensitive sensor and sometimes is blocked, causing the photosensitive sensor to output a pulse signal. The placement of phototransistors A and B results in a difference in the timing of their illumination and blocking, thus generating a phase difference between pulses A and B. Using this method, the rolling direction of the code disk roller can be measured. For each small angle the roller rotates, the wheel position counter increments by 1. At regular intervals, the microcontroller reads the value of the wheel position counter, calculates the displacement of the wheel (the length of the arc and the direction of the tangent when the vehicle turns), and then sends the displacement information to the host computer.

Based on the above principles, infrared ultrasonic positioning units are installed at points a and b, at a certain height directly above the two drive wheels of a coaxial two-wheel drive vehicle (the running trajectories of the two wheels of a coaxial two-wheel drive vehicle are always parallel), to absolutely locate the coordinates of each point. Photoelectric encoder ranging units are installed on the axles of each of the two wheels to measure the distance the wheels have traveled and their forward and backward movement between two positioning points. The positioning of the moving vehicle is divided into three cases: a) If, at a certain positioning moment, signals from three reference points can be detected simultaneously at points a and b (the ground is flat, and only two signals are needed for planar two-dimensional positioning), the position of the moving vehicle is calculated using the infrared ultrasonic absolute positioning method. The position of the midpoint between these reference points (i.e., the position of the moving vehicle) is calculated, and the running direction of the wheels relative to the established coordinate system is determined based on the coordinates of points a and b at the previous moment and the fixed distance between the two wheels. b) If only one point (a) or b) can simultaneously detect the signals of all three reference points, then the position and direction of the moving cart can be calculated based on the coordinates of points a and b at the previous moment, the distances traveled by the two wheels as measured by the photoelectric encoder, and the fixed distance between the two wheels. c) If neither point a nor b can simultaneously detect the signals of all three reference points, then the coordinates and direction of the cart can be calculated based on the coordinates of points a and b at the previous moment, the fixed distance between the two wheels, and the distances traveled by the two wheels as measured by the photoelectric encoder. The solution method for the second case is given below, as shown in Figure 3. By comparing the distances traveled by the two wheels as measured by the photoelectric encoder, it can be determined that the cart turns towards the side of the wheel with the shorter travel distance. Given the coordinates of points a′, b′, and b measured by infrared ultrasound, the distance d between the two wheels, the parallelism of line segments aa′ and bb′, and the perpendicularity of ab to the direction of the cart's movement, the coordinates of point a and the direction of the cart's movement can be calculated using geometric knowledge. The same applies to other cases.

2. System Hardware Structure The system mainly consists of an ultrasonic beacon node (reference point), an infrared transmitter, an ultrasonic transmitter head and their respective drive circuits, and an SST89E564RD (hereinafter referred to as 564RD) 8-bit microcontroller. The ordinary node (target point) consists of an infrared ultrasonic receiving unit composed of 8 infrared receivers, 8 ultrasonic receiver heads and their respective drive circuits, and 8 564RDs. Each infrared receiver and ultrasonic receiver is paired, controlled by one 564RD, divided into 2 groups of 4 pairs each, distributed at a certain height above each wheel at a 90° interval and at a 45° angle to the horizontal plane. Because the target point being measured is a moving object, a multi-channel simultaneous reception method is used to shorten the time required for each measurement and improve positioning accuracy. The photoelectric encoder ranging unit consists of a decoding wheel, an optocoupler, and one 564RD. One 564RD is used as the main control chip, communicating with the 8 ultrasonic receiving units and 2 photoelectric encoder ranging units via a serial port. The main controller acquires the measurement data from each unit, completes the positioning calculation, and simultaneously synchronizes the operation of each unit. The crystal oscillator of the 564RD is 40MHz. Figure 4 shows the single infrared tube and ultrasonic transmitting circuit, and Figure 5 shows the single infrared tube ultrasonic receiving circuit. The ultrasonic transmitting tube is T40-16 (corresponding receiving tube is R40-16), with a center frequency of 40kHz. The infrared transmitting tube is SE303A (corresponding receiving tube is PH302). The 564RD uses two I/O ports to output square wave signals with a carrier frequency of 40kHz and a frequency modulation of 5kHz to drive the infrared transmitting tube, and square wave signals with a carrier frequency of 40kHz and a frequency modulation of 2kHz to drive the ultrasonic transmitting tube.

3. System Software Design After the system is powered on, each unit initializes, and the operation of each part is as follows: a) The ultrasonic beacon nodes continuously emit infrared and ultrasonic signals. The infrared and ultrasonic signal codes of each node correspond and are different from the signal codes of other nodes. b) Ordinary nodes perform positioning every 1 second (this can be changed, but cannot be too long, otherwise the running trajectory may not be parallel when the car turns). The main controller sends positioning signals to each unit through the serial port and starts the internal timer. After a delay of 100 ms, it sequentially reads the distance information from points a and b to the reference point measured by the 8 ultrasonic ranging units and the displacement information recorded by the 2 photoelectric encoder ranging units, and calculates the position and running direction of the moving car. This process is repeated after the timer reaches 1 second. The software flow of the main controller is shown in Figure 6. c) After the 2 photoelectric encoder ranging units are initialized, they immediately start recording the displacement of the wheels. After receiving the positioning signal through the serial port, they store the recorded displacement information in the designated location, wait for the main controller to read it, and continue recording the displacement from 0. d) After detecting a positioning signal, a normal node receives infrared and ultrasonic signals, records the ultrasonic transmission time of a set of corresponding infrared and ultrasonic signals, stores it in a designated location, and waits for the main controller to read it. If such a signal is received within the first 100 ms of the serial port receiving the positioning signal, the corresponding time of the first reception is stored in the designated location, and no further reception is detected. If no corresponding signal is detected within 100 ms, data 0 is sent to the designated location.

4. System Error Analysis and Experimental Ranging Results The positioning errors mainly consist of the following five aspects: the shape and installation position of the ultrasonic device causing positional deviations between the coordinate system reference point and the target point; errors caused by delays in the system circuit components; the trolley is constantly moving, and due to the relatively slow ultrasonic transmission speed, the trolley has already moved a certain distance by the time positioning is requested; when sufficient reference point signals cannot be continuously detected, the position determination relies on the measurement of the previous moment, resulting in cumulative errors; and the influence of temperature conditions on ultrasonic waves. Figure 7 shows a trajectory measured in a two-dimensional planar positioning experiment at room temperature (20℃), ultrasonic speed (340 m/s), distance between the two wheels of the trolley (0.2 m), and moving speed (0.2 m/s). Through error compensation calculations for the first three aspects, the positioning accuracy reached 3 cm.

5. Conclusion Because photoelectric encoders rely on information from the previous measurement point for ranging and positioning, they inevitably lead to the accumulation of positioning errors. In contrast, infrared ultrasonic trilateration is an absolute position positioning method that relies solely on information from the current measurement point. This system combines these two methods, eliminating accumulated errors and solving the problem of positioning blind spots, thus providing a more accurate positioning for the mobile vehicle.

Read next

CATDOLL Jo Soft Silicone Head

You can choose the skin tone, eye color, and wig, or upgrade to implanted hair. Soft silicone heads come with a functio...

Articles 2026-02-22