Wheeled mobile robot is an important content in the field of robot research. It integrates machinery, electronics, detection technology and intelligent control. It is a typical intelligent control system. The intelligent robot competition integrates high technology, entertainment and competition, and has become a high-tech confrontation activity widely carried out in the world. Now take ARM7 processor as the control core, adopt wireless communication technology, and transplant the embedded real-time operating system μC/0S-II to design a set of intelligent robot control system.
2 Hardware Design
According to the functional requirements of the competitive robot, the overall design is carried out, and each function is modularized. The hardware block diagram of the control system is shown in Figure 1. The central processing unit adopts a microcontroller structure to control the coordinated operation of peripheral devices. The steering gear controls the movement direction of the robot; the drive motor motor uses a small DC motor with an output shaft equipped with a photoelectric encoder to drive the wheel to rotate. The electromagnet acts as the actuator clamped by the manipulator. Set up two ultrasonic sensors, 8 photoelectric detection inputs and 8 switch detection interfaces. The running status and running parameters of the whole robot are dynamically displayed through LCD.
2.1 Selection of Microcontrollers
The robot has many actions and functions, and needs multiple sensors to detect the outside world and control the position, action and running state of the robot in real time. All tasks in the system are ultimately hung on the real-time operating system μC/0S-II, so not only the internal resources of the microcontroller, but also its portability and expansibility must be considered. LPC2129 is a 32-bit ARM7TDMI-S microprocessor produced by Philips, embedded with 256 KB high-speed Flash memory. It adopts 3-stage pipeline technology, and performs instruction fetching, decoding and execution at the same time, and can process instructions in parallel to improve CPU performance. running speed. Due to its very small size, extremely low power consumption and strong anti-interference ability, it is suitable for various industrial controls. 2 32-bit timer counters, 6 PWM outputs and 47 general-purpose I/0 ports, so it is especially suitable for industrial control and small intelligent robot systems with lower environmental requirements. Therefore, choosing LPC2129 as the main controller can obtain an intelligent robot control system with a simple design structure and stable performance.
2.2 Wireless Communication Interface Design
The system adopts the PTR2000 wireless communication data transceiver module produced by Xuntong. The circuit interface is shown in Figure 2. This module is developed based on the radio frequency device nRF401 produced by NORDIC Company. Its characteristics are: ① There are two channels to choose from, and the working rate is up to 20 Kb/s; ② The receiving and transmitting are integrated, which is suitable for duplex and simplex communication, so the communication mode It is more flexible; ③ It is small in size, requires few peripheral components, and the interface circuit is simple, so it is especially suitable for the miniaturization requirements of robots; ④ It can be directly connected to the serial port module of the single-chip microcomputer, and the control is simple; ⑤ Strong anti-interference ability; ⑥ Low power consumption and stable communication.
2.3 Design of photoelectric detection module
2.3.1 Photoelectric detection process
Design a photoelectric detection module to enable the robot to detect white guide lines on the ground. The photoelectric detection circuit mainly includes a transmitting part and a receiving part, and its principle is shown in Figure 3. The waveform modulation of the transmitting part adopts the frequency modulation method. Due to the fast response speed of the light-emitting diode, its working frequency can reach several megahertz or ten megahertz, and the modulation frequency of the detection system is in the range of tens to hundreds of kilohertz, so it can meet the requirements. The light source driver is mainly responsible for amplifying the modulation waveform to sufficient power to drive the light source to emit light. The light source adopts infrared light-emitting diodes with high operating frequency, which is suitable for modulated light emission with square wave waveform.
The receiving part uses a photodiode to receive the modulated light and convert the light signal into an electrical signal. This electrical signal is usually weak and needs to be filtered and amplified before it can be processed. The amplification of the modulated signal adopts the form of AC amplification, which can separate the modulated optical signal from the background light signal, which provides convenience for signal processing. The modulated signal processing part identifies the amplified signal and determines the characteristics of the detected object. Therefore, the essence of this module is to separate the “AC”, useful modulated optical signal from the “DC”, useless background light signal, so as to achieve the purpose of anti-interference.
2.3.2 Photoelectric probe
A photoelectric probe is installed at the front of the robot chassis, and a total of 5 detection points are set up. The structure is shown in Figure 4.
In theory, the more and denser the detection points, the higher the accuracy and reliability of the recognition. But the hardware overhead and software complexity also increase accordingly. Adopting the line-hunting system ensures the detection accuracy and saves the hardware cost. The modulated light emitted by the LED is reflected to the photodiode through the ground. The photocurrent generated by the photodiode varies linearly with the intensity of the reflected light. When this change is detected, it can be judged whether a certain detection point is above the white guide line, thereby judging the relative position of the robot and the white guide line.
2.4 Design and Implementation of Ultrasonic Ranging Sensor
Two ultrasonic sensors are used to control the robot to avoid obstacles, and to predict the distance of the robot relative to the destination, which plays a role in navigation. The receiving part is connected to the capture and timing pins of the microcontroller. The whole ultrasonic testing system is composed of ultrasonic transmitting, ultrasonic receiving and single-chip control. The transmitting part is composed of high frequency oscillator, power amplifier and ultrasonic transducer. After being amplified by the power amplifier, ultrasonic waves are emitted through the ultrasonic transducer.
Figure 5 shows the ultrasonic oscillation circuit composed of digital integrated circuits. The high-frequency voltage signal generated by the oscillator removes the DC in the signal through the capacitor C2 and supplies it to the ultrasonic transducer MA40S2S. Its working process: U1A and UlB generate a high-frequency voltage signal corresponding to the ultrasonic frequency, the signal is converted into a standard square wave signal through the inverter U1C, and then power amplified, C2 separates the DC signal and then adds it to the ultrasonic transducer. The MA40S2S performs ultrasonic transmission. If a DC voltage is applied to the ultrasonic transducer for a long time, its characteristics will be significantly deteriorated, so the AC voltage is generally separated from the DC. U2A is 74ALS00 NAND gate, control_port (control port) pin is control port, when control_port is high level, ultrasonic transducer transmits ultrasonic signal.
FIG. 6 shows an ultrasonic receiving circuit. The ultrasonic receiving transducer adopts MA40S2R, and the integrated operational amplifier LM324 is used to amplify the signal received by the transducer. After three-stage amplification, the sinusoidal signal is converted into a TTL pulse signal through the voltage comparator LM339. INT_Port is connected with the interrupt pin of the single-chip microcomputer. After receiving the interrupt signal, the single-chip computer immediately enters the interrupt and processes and judges the ultrasonic signal.
3 Transplantation of real-time operating system μC/OS-II
μC/OS-II is an embedded real-time operating system kernel, which includes basic functions such as task scheduling, task management, time management, memory management, and communication and synchronization between tasks. When μC/OS-II performs task scheduling, it will store the CPU register of the current task in the task stack, and then restore the original working register from another task stack to continue running another task.
According to each control function and the resource structure of the microcontroller, the tasks are divided into 7 application tasks. The division process is shown in Figure 7. The wireless serial communication adopts the interrupt receiving method to ensure the real-time nature of data receiving.
The establishment of μC/OS-Ⅱ task includes four parts: defining task stack, setting task priority, initializing system hardware required by the task and realizing specific control process. Now take task 1 as an example to introduce the establishment process of the application task.
The development of real-time applications in the embedded real-time operating system environment makes it easy to design and expand the program, and new functions can be added without major changes. By dividing the application program into several independent task modules, the design process of the application program can be greatly simplified; and events that are demanding in real time can be fast and reliable. Through effective system services and embedded real-time operating systems, system resources can be better utilized.
4 Debug and run
When the robot control system starts, μC/OS-II initializes the stack space, each control register and the hardware of the peripheral devices, and sets the initial state of each functional component at present.
Under the real-time robot system, after the robot starts normally, the system monitors the running status of the robot on the field in real time, and gives an error message if a certain action or function is invalid. During normal operation, the coordinate value and action status of the robot on the field are displayed in real time, as shown in Figure 8.
According to the control requirements of intelligent robots, an embedded robot control system based on wireless communication is designed. In the software design, the embedded real-time operating system μC/OS-Ⅱ is transplanted. Using the photoelectric detection module and the ultrasonic navigation module to perceive the external information, the control of the intelligent robot is realized.
Responsible editor: gt