1 Introduction
Mobile robots must have automatic navigation and obstacle avoidance functions to operate in uncertain environments. Sensors play a vital role in the navigation system of mobile robots. Vision, laser, infrared, ultrasonic sensors, etc. have been widely used in practical systems. Among them, ultrasonic sensors are widely used as ranging sensors for mobile robots due to their simple information processing, fast speed and low price, so as to achieve functions such as obstacle avoidance, positioning, environmental modeling and navigation. The design of the CAN bus intelligent node introduced in this article is based on the PIC18F2580 control core of Microchip. Since the PIC18F2580 has a built-in CAN controller and provides many dedicated hardware functions for CAN applications, it is used as the CAN bus controller of the system, which greatly saves the resources of the main control system. The transceiver of the CAN bus uses TJAl040. The overall structure diagram of the system is shown in Figure 1.
Figure 1 System overall structure block diagram
The robot system control core is implemented by ARM or DSP. Its main function is to process information that requires complex calculations, send the processed information back to the CAN bus, and manage the entire network. The main function of the ultrasonic intelligent node control system is to determine the location of obstacles, and transmit the obstacle information that hinders the forward direction of the mobile robot back to the main control system through the CAN bus. The main control system will make corresponding processing and perform obstacle avoidance actions. This article will focus on the ultrasonic intelligent node control system.
2 Ultrasonic ranging principle
The principle of ultrasonic ranging is relatively simple. Generally, the transit time method is used, that is:
D=ct/2 (1)
Where D is the distance between the mobile robot and the obstacle to be measured, and c is the transmission rate of sound waves in the medium. The transmission rate of sound waves in air is:
c=co
(2)
Where T is the absolute temperature, co =331.4m/s. In the case where the ranging accuracy is not required to be very high, c can generally be considered as a constant. The transit time method mainly measures the time interval t from the ultrasonic emission to the ultrasonic return, that is, the "transit time", and then calculates the distance according to formula (1).
3 Hardware Design of Ultrasonic Intelligent Node Control System
The hardware circuit of the ultrasonic intelligent node control system is shown in Figure 2.
3.1 Control Circuit
The control part of the ultrasonic sensor uses the PIC18F2580 produced by Microchip. It is a single-chip 8-bit high-performance microcontroller that adopts the Harvard bus structure, has high operating speed, low power consumption, strong anti-interference ability, and an on-chip CAN controller.
As the system control core, PIC18F2580 has two main tasks. The first is to serve as the control core of the ultrasonic sensor, expanding the receiving and transmitting circuits of the ultrasonic sensor on its ordinary I/O port, using the microcontroller software function to generate a 40 kHz signal and transmit it through the drive amplification, and then using the receiving circuit for reception. In addition, the remaining port lines can continue to expand the ultrasonic sensor to realize the design of multiple ultrasonic sensor systems. The second is to use the on-chip CAN controller of the PIC18F2580 to connect to the CAN bus. This design changes the previous design of ultrasonic ranging system on the robot control core. It not only transfers the ultrasonic detection and processing work to the single-chip microcomputer, greatly saving the system resources of the robot control core, but also transfers most of the control work of the CAN bus intelligent node to the single-chip microcomputer, saving hardware resources. At the same time, the use of CAN bus greatly improves the system's anti-interference ability and makes the robot control system work more stably.
Figure 2 Ranging node control circuit diagram [page]
3.2 Ultrasonic sensor transmitting circuit design
Figure 3 Ultrasonic emission circuit diagram
In Figure 3, LM386 is an audio integrated amplifier with the advantages of low power consumption, adjustable voltage gain, large power supply voltage range, few external components and low total harmonic distortion. It is widely used in recorders and radios. It is a three-stage amplifier circuit. The hardware circuit of this part is relatively simple. It mainly uses the drive amplification function of LM386 to amplify and output the 40 kHz square wave generated by the single-chip microcomputer. Because the work of the single-chip microcomputer in the intelligent ultrasonic node control system is relatively small, in order to save hardware, it is better to hand over the generation of the 40 kHz square wave to the CCP module of the single-chip microcomputer. TX1 is the ultrasonic transmitter.
3.3 Ultrasonic sensor receiving circuit design
The circuit uses the integrated circuit CX20106A. This is an infrared detection receiving integrated circuit, which is commonly used in infrared remote control receivers for televisions. Considering that the commonly used carrier frequency of 38 kHz for infrared remote control is close to the ranging ultrasonic frequency of 40 kHz, it can be used as an ultrasonic detection circuit. Experiments have shown that it has high sensitivity and strong anti-interference ability. By changing the value of C11 appropriately, the sensitivity and anti-interference ability of the receiving circuit can be changed. R12 and C11 control the internal amplification gain of CX20106A, and R14 controls the center frequency of the bandpass filter. Generally, R12=4.7Ω, C11=1μF. The values of the other components are as shown in Figure 4. RX1 is the ultrasonic receiving head. When receiving ultrasonic waves, a falling edge is generated and connected to the external interrupt INTO of the microcontroller.
Figure 4 Ultrasonic receiving circuit diagram
When the ultrasonic receiving head receives a 40 kHz square wave signal, it will drive and amplify the signal through the CX20106A and send it to the external interrupt 0 port of the microcontroller. After receiving the interrupt request of external interrupt 0, the microcontroller will transfer to the interrupt service program of external interrupt 0 for processing. In the obstacle avoidance work of the mobile robot, the shortest distance that needs to be processed by the microcontroller can be set in the interrupt service program, such as 0.4m. For obstacles with a distance greater than 0.4m, the interrupt service program can be directly jumped out without processing; for obstacle information with a distance less than or equal to 0.4m, it will be processed in the interrupt service program and reported to the robot system control core through the CAN bus, and the robot system control core will issue commands to guide the robot's obstacle avoidance action. For a multi-ultrasonic sensor system, each ultrasonic sensor can perform simple processing on the obstacle information in its interrupt service program when it determines that there is an obstacle to the robot's movement. The information reported to the robot system control core can be relatively simple. The robot system control core only needs to control the actual action of the robot, such as turning right 20°, without the need for the robot system control core to calculate again, which will save a lot of system resources to do other more complex work.
3.4 CAN bus design part
TJAl040 is a high-speed CAN bus transceiver produced by Philips Semiconductor. The device provides an interface between the CAN protocol controller and the physical bus, as well as differential transmission and reception functions for the CAN bus. TJAl040 has excellent EMC performance and ideal passive performance when not powered on; it also provides low power management and supports remote wake-up. It is worth mentioning that TJAl040 has an automatic fail-safe function. The STB pin is grounded in normal mode, and the pin TXD provides a pull-up to VCC to keep the pin TXD at a recessive level when not in use. If VCC loses power, the pins TXD, STB and RXD will become suspended to prevent reverse current from flowing through these pins.
6N137 is a photocoupler. The purpose of using the photocoupler 6N137 is to enhance the anti-interference ability of the CAN bus nodes. This design can well achieve electrical isolation between the CAN nodes on the bus. However, it should be noted that the two power supplies VCC and VDD used in the optocoupler circuit must be completely isolated, otherwise the optocoupler loses its meaning.
As a CAN bus transceiver, TJAl040 also takes anti-interference measures in the interface part with the CAN bus. The CANH1 and CANL1 pins of TJAl040 are each connected to the CAN bus through a 5Ω resistor. The resistor can play a certain current limiting role and protect TJAl040 from overcurrent shock. [page]
4 Software Writing of Ultrasonic Intelligent Node Control System
The software writing work mainly consists of two parts: the ultrasonic ranging part and the CAN bus communication part.
4.1 Software Design of Ultrasonic Ranging Part
When the ultrasonic receiver receives the echo, the hardware circuit generates a pulse level to trigger the external interrupt 0 port of PIC18F2580. The main idea of software writing is to pre-set a value by the register in the interrupt service program. This value is the shortest distance for the robot to avoid obstacles. From the time the ultrasonic transmitter emits a square wave to the time the ultrasonic receiver receives the echo, this time is converted into a distance and compared with the above shortest distance. If it is greater than the shortest distance, no processing is done and the interrupt service routine is exited; if it is equal to or less than the shortest distance, the corresponding action is executed. Figure 5 is the flow of this part of the program.
Figure 5 Ultrasonic ranging software flow chart
4.2 Software writing of CAN bus communication part
This part of software writing mainly consists of the following parts: initialization, receiving processing, sending processing, interrupt processing and error handling functions. Since any node in the system can actively communicate with other nodes at any time, the communication programs of each node are roughly the same. For the specific program writing, please refer to the user manual of PIC18F2580.
5 Conclusion
This paper discusses the basic idea of expanding multi-channel ultrasonic sensors with CAN bus, and introduces a CAN bus intelligent ultrasonic ranging system with Microchip's PIC18F2580 as the ultrasonic sensor control core and CAN bus controller. TJAl040 is used as the CAN bus transceiver. The expansion of multi-channel ultrasonic sensors is transferred to the intelligent node part, which simplifies the work of the mobile robot system control core; a relatively simple hardware design is adopted, mainly to concentrate the control core of the ultrasonic sensor and the CAN bus controller together, and use PIC18F2580 as a device to complete the work of two chips, saving hardware. In addition, the expansion of the CAN bus will also make the subsequent development of the mobile robot system more flexible.
Previous article:LED display circuit based on PIC12C508
Next article:Design of intelligent charger based on UCC3895 and PIC microcontroller
- Popular Resources
- Popular amplifiers
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
- Have you noticed the LPDSP32 audio codec inside RSL10? Does your project use this resource?
- Will the push-pull circuit be straight through?
- Award-winning live broadcast: Third-generation TI C2000 new features resource update
- EEWORLD University - Industrial Internet of Things using CC1310 sub-1 GHz wireless MCU
- A simple way to distinguish between broadband FM and narrowband FM
- Wireless Connectivity Technology Selection Guide
- Learning FPGA Embedded System Design-1
- Qorvo 5 GHz iFEM Helps Accelerate Wi-Fi 6 Home Mesh Networking
- Automotive/Industrial mmWave Radar Sensors
- DAC3283 conversion formula