Design of mobile robot navigation using ultrasonic wave

Publisher:kappa20Latest update time:2021-05-18 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Introduction


The SRF05 ultrasonic sensor imported from the UK was used in the project development. Its echo feedback and ranging method are special compared with the commonly used ultrasonic sensors, and it is slightly difficult to implement in ARM. However, the sensor has a high accuracy of up to 1cm. Therefore, the use of this sensor eliminates the infrared ranging module used for close-range ranging and saves hardware resources.


The minimum system of the robot is a touch screen module, an ultrasonic module, a camera image acquisition module, and a DC motor closed-loop control system. Distance measurement is the most important part of the entire system, which directly affects the accuracy of the motor's running distance and the image acquisition control within the effective range. The entire system is completed in the ARM9 and Linux platforms, and each module is implemented in a device driver manner to make the module control more convenient.


2 SRF05 Ultrasonic Distance Measurement Method


Provide a 10us pulse to trigger the ultrasonic sensor, SRF05 will emit 8 cycles of overclocked pulses with a frequency of 40khz. At this time, the level on the echo port becomes high, and the timer starts timing. When the echo becomes low, it proves that there is an obstacle and the timing is stopped. The width of the high pulse is proportional to the distance measured. The effective ranging range of the ultrasonic wave is 1cm~4m. Therefore, if there is no obstacle or the obstacle is greater than 4m, the echo will still become low and the timer time is 30ms. Therefore, when measuring the distance, the period of the timer should be greater than 30ms so that the distance can be effectively measured.


The principle is shown in Figure 1.



3. Ultrasonic ranging software implementation


Figure 2 is the flow chart of ultrasonic ranging.



3.1 Echo detection acquisition method


The detection of ultrasonic echo is difficult, because in ARM, a port interrupt can only set one trigger mode. If it is set to rising edge trigger, the timer can be turned on, but the falling edge cannot be captured, and the timer cannot be turned off, so the distance cannot be measured. Therefore, it is implemented in software. First, two time delay functions usdelay() and msdelay() are set, so that the ultrasonic trigger can be turned on after giving a high pulse of 10us, and then the timer is turned on. Then an external interrupt eint1 is set to connect to the echo port of the ultrasonic sensor and set to falling edge trigger. When the falling edge comes, the timer is turned off and the read value is the pulse width. Then the distance is obtained according to the distance of the obstacle = (ECHO high level time) * sonar speed/2. The relationship between v and temperature in air: v=331.5√1+T/273 m/s, T is Celsius temperature. In general, the ultrasonic velocity is close to the speed of sound, which is about 343.2m/s under the influence of indoor temperature.


3.2 Implementation of Ultrasonic Triggering


A software timing function usdelay() is accurately designed using a digital oscilloscope. The specific implementation is as follows.



Then usdelay(1) is 10us. This function is used to extend the pulse for 10us after giving the excitation high pulse and then turn off the pulse.


A msdelay() function is also designed to control the time value of the entire ranging cycle.


msdelay(1000) is used in the main function to delay by 1s, so that the timer can have enough time to detect the echo without interfering with the other three ultrasonic signals.


As follows.



3.3 Implementation of ultrasonic echo detection


The timer and external interrupt are needed to calculate the pulse width of echo detection. The external interrupt is connected to the ultrasonic echo and set to the falling edge trigger. The timer is initialized as follows.


rTCFG0=0x9595; //Prescaler value is 95




rTCFG1=0x00000; //Split value 1/2


rTCNTB0=10000; /


According to T = [TCNTB0 * (TCFG0 + 1) * (1 / TCFG1)] / 50MHZ, the period of the timer is 60ms, which is enough to calculate the echo time.


External interrupt 1 is initialized as follows


rGPFCON=0xaa; //GPF1 is set to EINT1


rINTMOD=0x0; //Set to normal interrupt


rGPFUP=0xf; //Disable GPF0 pull-up resistor


pISR_EINT1=(unsigned)Eint1Handler; //Create interrupt vector


EnableIrq(BIT_EINT1); //Enable interrupt


rEXTINT0 =0x492; // EINT1 falling edge trigger


According to T = [TCNTB0 * (TCFG0 + 1) * (1 / TCFG1)] / 50MHZ, the period of the timer is 60ms, which is enough to calculate the echo time.


3.4 Computer distance in external interrupt



3.5 Loop Control and Polling Ranging


Due to interference between ultrasonic waves, the ultrasonic waves are turned on in turn in a polling manner, and only one is measured at a time. This can effectively avoid interference. In order to improve real-time performance, the timer cycle can be controlled, for example, set to 35ms, so that the polling of four ultrasonic waves is about 140ms, which is enough to meet real-time requirements.


4 Implementation of robot control


Figure 3 is the overall structure diagram of the closed-loop system for controlling the robot's DC motor using ultrasonic feedback information.



The ultrasonic sensor in the Linux system is a read-only character device. The specific application is to open the ultrasonic device under the application, then measure the distance in the driver, and transmit the measured data to the application. The application has an ultrasonic obstacle avoidance algorithm. According to the algorithm, the position of the obstacle is determined and the DC motor control signal is given for obstacle avoidance navigation.


The graphical interface in the touch screen contains the robot's command settings, which can set the running speed, the opening and closing of image acquisition and ultrasonic modules, whether to turn on the robot's fuzzy algorithm running trajectory or use ordinary PID adjustment, which makes the robot have many options to choose from.


Each action of the robot is given the running time according to the value measured by the ultrasonic sensor and the current instantaneous speed of the robot. When encountering an obstacle (0

5 Conclusion


This paper uses a new type of ultrasonic sensor to realize ultrasonic ranging on a mobile robot based on ARM9 and embedded Linux platform, and uses ultrasonic sensors to control the motion system and image acquisition system. The robot has been successfully applied to the development of this project and achieved good results.


The innovation of this paper is to use a new type of high-precision ultrasonic sensor and use software methods to overcome the problem that it is not conducive to detecting echoes in ARM9. It is successfully applied to the trajectory control of the mobile robot, which greatly improves the robot's walking and image acquisition timeliness.


Reference address:Design of mobile robot navigation using ultrasonic wave

Previous article:ARM7 lpc2148 single-channel LED control experiment
Next article:ISP Design Based on ARM Embedded System

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号