introduction
In an autonomous walking robot system, the robot must collect environmental information in real time to avoid obstacles and navigate in an unknown and uncertain environment. This must be achieved by relying on a sensor system that can perceive environmental information. Visual, infrared, laser, ultrasonic and other sensors are widely used in walking robots. Ultrasonic ranging methods are widely used because they are simple, cheap, small, simple in design, easy to control in real time, and can meet industrial practical requirements in terms of measuring distance and measurement accuracy. The robot introduced in this article uses a three-way ultrasonic ranging system, which can provide information about the movement distance for the robot to identify the environment in front, left and right of its movement.
1 Principle of Ultrasonic Distance Measurement
The ultrasonic generator is composed of two piezoelectric chips and a resonance plate. When a pulse signal is applied to its two poles and its frequency is equal to the natural oscillation frequency of the piezoelectric chip, the piezoelectric chip will resonate and drive the resonance plate to vibrate, thus generating ultrasonic waves. On the contrary, if no external voltage is applied between the two poles, when the resonance plate receives ultrasonic waves, it becomes an ultrasonic receiver. There are generally two methods for ultrasonic ranging: ① Take the average voltage value of the output pulse, which is proportional to the distance, and the distance can be measured by measuring the voltage; ② Measure the width of the output pulse, that is, the time interval t between transmitting and receiving ultrasonic waves, and obtain the measured distance based on the measured distance s=vt?2. Since the ultrasonic velocity v is related to temperature, if the temperature changes greatly, it should be corrected by temperature compensation.
This measurement system adopts the second method. Since the measurement accuracy requirement is not particularly high, the temperature can be considered to be basically unchanged.
This system uses PIC16F877 microcontroller as the core, and realizes real-time control of peripheral circuits through software programming, and provides the required signals to the peripheral circuits, including frequency vibration signals, data processing signals, etc., thereby simplifying the peripheral circuits and having good portability. The block diagram of the system hardware circuit is shown in Figure 1.
Since this system only needs to know whether there are obstacles in front, on the left, or on the right of the robot, and does not need to know the specific distance between the obstacle and the robot, there is no need for a display circuit. It only needs to set a distance threshold so that when the distance between the obstacle and the robot reaches a certain value, the microcontroller controls the robot's motor to stop. This can be achieved through software programming.
2 Ultrasonic transmitting circuit
The center frequency of ultrasound is 40kHz, which can be generated by the following program (part of the source program):
2.1 Ultrasonic transmitting circuit
The ultrasonic transmitter circuit is based on PIC16F877. When the microcontroller is powered on, the microcontroller generates a 40kHz ultrasonic signal from the RA0 port. However, the signal cannot enter the amplifier circuit through the NAND gate to enable the ultrasonic transmitter to transmit the ultrasonic wave. Only when the switch S1 is closed, a gate signal with a frequency of 4kHz is transmitted from the RA1 port. At the same time, the timer TMR1 inside the microcontroller is started to start counting. For each cycle of the waveform emitted by the gate signal, the ultrasonic wave will emit 10 complete waveforms, which can be obtained from their frequencies. The period of the ultrasonic wave is 1 (40kHz) = 01025ms, and the period of the gate signal is 1 (4kHz) = 0125ms. Finally, the distance between the obstacle and the mobile robot is calculated according to s = vt2. When the ultrasonic receiver receives the reflected ultrasonic wave, the counter stops counting, and the time t can be calculated according to the counter count and the period of the gate signal. The RA2 port is connected to the RS trigger, which can automatically control the emission and stop of the ultrasonic wave. The circuit of this system also includes a manual reset circuit, which is controlled by connecting the MCLR pin of the microcontroller to S2. The ultrasonic transmission circuit diagram is shown in Figure 2.
2.2 Gate control circuit (RS trigger)
In order to realize automatic control of ultrasonic emission and reception, a gate circuit must be added to the circuit. The frequency of the gate signal is 4kHz. If the output pulse is used as the gate signal and the pulse of known frequency fc is allowed to pass through the gate, then t=NTc, where Tc is the period of the known pulse and N is the number of pulses.
The gate circuit is composed of an RS flip-flop. When the input terminal R=1 (S=0), it is reset, that is, the output terminal Q=0; when R=0 (S=1), it is set, that is, Q=1. The RS flip-flop is connected to the RA2 port of the microcontroller.
2.3 Ultrasonic Amplifier Circuit
The ultrasonic amplification circuit is composed of transistors, etc. Since the RA port of the microcontroller has a maximum pull-up current of only 20mA to 25mA, and the ultrasonic transmitter requires a minimum current of 60mA, an amplifier circuit is added after the NAND gate to amplify the current to complete the ultrasonic emission. The ultrasonic amplification and transmission circuit is shown in Figure 3.
3 Ultrasonic receiving circuit
3.1 Ultrasonic receiving amplifier circuit
Since the ultrasonic signal received by the ultrasonic receiving head is very weak, an ultrasonic receiving amplifier circuit needs to be added after it. This circuit uses two integrated operational amplifiers, which are designed as two stages. Both stages are in-phase inputs. Because the voltage amplification factor of the in-phase input is 1+RfR, the amplification factor of each stage is 10, and the two-stage amplification factor is close to 100 times, so that the subsequent circuit can easily detect the input signal. The integrated operational amplifier is powered by dual power supplies. The ultrasonic receiving amplifier circuit is shown in Figure 4.
3.2 Signal filtering circuit
The sound waves coming out of the signal amplifier circuit have certain interference. In order to remove the interference signal, a filter circuit is needed. The signal filter circuit uses a bandpass filter circuit with a center frequency of 40kHz and a bandwidth of 2kHz. A zero-crossing comparator is added to convert the output signal into a square wave signal. The signal filter circuit is shown in Figure 5.
3.3 Signal Shaping Circuit
The square wave signal coming out of the signal filtering circuit is very irregular, so a shaping circuit is added after it. The shaping circuit consists of two stages of NOT gates connected in series and a resistor in parallel. After shaping, it is sent to the single-chip microcomputer for processing. The signal shaping circuit is shown in Figure 6.
4 Software Programming
The software adopts modular design and consists of a main program, a launch subroutine, etc. The software program flowchart is shown in Figure 7.
5 Conclusion
The ultrasonic distance measurement system designed in this paper adopts single chip microcomputer programming technology and completes the system requirements with hardware. Its accuracy can meet most engineering needs. Compared with the traditional distance measurement system, it has the characteristics of simple structure, low price and good portability.
Previous article:CAN bus controller IP core code analysis
Next article:Remote Communication System Designed Based on Single Chip Microcomputer 8251 and MODEM
- Popular Resources
- Popular amplifiers
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- CGD and Qorvo to jointly revolutionize motor control solutions
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Nidec Intelligent Motion is the first to launch an electric clutch ECU for two-wheeled vehicles
- Bosch and Tsinghua University renew cooperation agreement on artificial intelligence research to jointly promote the development of artificial intelligence in the industrial field
- GigaDevice unveils new MCU products, deeply unlocking industrial application scenarios with diversified products and solutions
- Advantech: Investing in Edge AI Innovation to Drive an Intelligent Future
- CGD and QORVO will revolutionize motor control solutions
- 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
- Suspicious signal from outer space
- Download gift: USB Type C related development and test materials, read it when you have nothing to do, and you will become a master by accident
- Qorvo explains WIFI and 5G clearly
- SPIN3201 (STSPIN32F0) three-resistance control board: FOC motor drive schematic/code/debugging documents and other detailed information...
- Should segment display screens be backlit? How to add it?
- Installation and setup of CCS StarterWare, successfully compiling a project with CCS7.3
- EEWORLD University ---- Operational Amplifier Video Tutorial
- Have you ever encountered the problem of USB drive repair? Is there any good tool you can recommend?
- Several major wireless technologies
- How to modify the video recorder startup screen