Pages

Monday 15 September 2014

Obstacle Detection System for Vehicle Reverse

Avoiding the Crash

The importance of obstacle detection finds applications in industries, robotics and automobile sector. An Ultrasonic Range Finder was used as the distance sensor for detecting obstacles so that a destructive crash can be avoided by vehicles.


Analysis of problem

The vehicle reversing system was required to operate in two different modes, non reversing mode and the reversing mode. The non reversing mode is considered the system default mode, i.e. when the car is not in reverse. When the car is in the non reversing mode, the display system will just display a simple “WELCOME” message on a display system.

The reversing mode will be automatically activated whenever the car enters reverse! In this mode, the reversing system should be able to detect any obstacle within the range of 0 – 4 meters at the back of the car, and the object distance from the car displayed in centimetres.

When the system reports a distance less than 50cm, it is assumed that an obstruction has been detected. If no object is detected, a green indicator should be illuminated in order to give an indication that the car is reversing safe. Also a buzzer should beep slowly indicating that reversing is in progress.


Once an object is detected, the green indicator should start blinking. As the distance from the object decreases, the buzzer beeping rate should increase accordingly. Once an obstruction distance to the car is less than 30cm, it is considered unsafe distance, hence a red indicator should be illuminated and a buzzer sounding continuously indicating danger of an imminent crash. An optional switch should be provided in order to allow the buzzer to be switched ON or OFF depending on the choice of the user at any point in time.  


The system block diagram is shown in figure 1 just below.



Figure 1:  System block diagram for vehicle reversing system


Implementing the system

The system schematic is shown in figure 2 which is seen next. The system controller adopted for the design was mbed NXP LPC1768 while the ultrasonic ranger was SRF05. The LPC1768 was desirable due to its rapid prototyping features!


Figure 2:  System schematic

The system schematic was implemented on a Vero board and the system software developed using the mbed online compiler. The final software developed for the system is documented in the scroll box below. Side comments are provided to make clear what is happening at each stage of the program.


/* System code for the Reversing System!
 * Copyright (c) 2014, e-cracked, Uche 
 * 
 * Permission is hereby granted, free of charge! 
 */

#include "mbed.h"

#include "TextLCD.h"
#include "SRF05.h"
#include "beep.h"

TextLCD lcd(p20, p22, p27, p28, p29, p30); // rs, e, d0-d3


DigitalOut led1 = (p25);    //green LED on pin25

DigitalOut led2 = (p26);    //red LED on pin26

DigitalIn rev_SW(p5); // reversing switch on pin5


Beep buzzer(p21); //Piezo on P21 to GND


SRF05 srf(p13, p14); //range finder pins


int main() {

   
   rev_SW.mode(PullUp);
   
   lcd.printf("HELLO WELCOME!!!\n");
   
     while(1)
    {
        if (rev_SW == 1)    //Reverse off
        {
            lcd.printf("HELLO WELCOME!!!\n"); 
            wait(0.01); 
            } 
        
        if (rev_SW == 0)    //Reverse on
        {
            lcd.printf("Distance=%.1f\n", srf.read());  
               
        if (srf.read()>50)   //NO Obstruction 
        { 
            led1 = 1; 
            buzzer.beep(5000,0.5); 
            wait(1.5); 
            led1 = 0; 
            }
      
        if (srf.read()<50)  //Obstruction!!!
        {                 
        
        if (srf.read()<50 && srf.read()>40) 
        {
            led1 = 1; 
            buzzer.beep(5000,0.5); 
            wait(0.5); 
            led1 = 0; wait(0.5);
            }
        
        if (srf.read()<40 && srf.read()>30) 
        {
            led1 = 1; 
            buzzer.beep(5000,0.6); 
            wait(0.5); 
            led1 = 0; 
            wait(0.5);
            }
        
        if (srf.read()<30) 
        {
            led2 = 1; 
            buzzer.beep(5000,1.0); 
            wait(1.0); 
            led2 = 0;
            }
        
                        }            
                }
    lcd.cls();
  
        } //while
    
    }   //main
    


Results

During the system testing, the following results were obtained in order to verify the correct functionality of the system based on the initial system requirements. 


Figure 3: Just message display when car is not in reverse with components shown.


Figure 4: Safe distance detected by ranger and displayed on LCD with green LED ON.

Figure 5: Unsafe distance detected and displayed with red LED ON indicating danger.

Reflection

It can be seen from results that the system was correctly implemented!

No comments:

Post a Comment