roboin.in@gmail.com
(91) 9830068336

Obstacle Avoiding RC on Breadboard

Obstacle Avoiding RC on Breadboard

Obstacle Avoiding Robot is an intelligent device which can automatically sense the obstacle in front of it and avoid them by turning itself in another direction. This design allows the robot to navigate in unknown environment by avoiding collisions, which is a primary requirement for any autonomous mobile robot. The application of Obstacle Avoiding robot is not limited and it is used in most of the military organization now which helps carry out many risky jobs that cannot be done by any soldiers.

In this project we have used Arduino Nano and Ultrasonic Sensor to build an Obstacle Avoider and L293D motor driver chip. The Ultrasonic sensor is used to sense the obstacles in the path by calculating the distance between the robot and obstacle. If robot finds any obstacle it changes the direction and continue moving.

img

Obstacle Avoiding RC

Hardware Requirement

  • Microcontroller: Arduino Uno board, USB Cable
  • Motor driver: L293DN Motor Driver IC
  • Motor: DC 3-6v BO Gear Motor & Servo Motor
  • Sensor: HC-SR04 Ultrasonic Sensor
  • Breadboard 400 Pin
  • External Power: Battery - 9V
  • Robot Chassis
  • img

    Electronics Component

    Hardware Specification

    Arduino Nano

  • The Arduino Nano is a small, complete, and breadboard-friendly board based on the ATmega328P (Arduino Nano 3.x).
  • It has more or less the same functionality of the Arduino Duemilanove, but in a different package. It lacks only a DC power jack, and works with a Mini-B USB cable instead of a standard one.
  • img

    Arduino Nano

    Specification

  • Arduino Nano is a small, compatible, flexible and breadboard friendly Microcontroller board, developed by Arduino.cc in Italy, based on ATmega328p ( Arduino Nano V3.x) / Atmega168 ( Arduino Nano V3.x).
  • It comes with exactly the same functionality as in Arduino UNO but quite in small size.
  • It comes with an operating voltage of 5V, however, the input voltage can vary from 7 to 12V.
  • Arduino Nano Pinout contains 14 digital pins, 8 analog Pins, 2 Reset Pins & 6 Power Pins.
  • Each of these Digital & Analog Pins are assigned with multiple functions but their main function is to be configured as input or output.
  • Each of these Digital & Analog Pins are assigned with multiple functions but their main function is to be configured as input or output.
  • They are acted as input pins when they are interfaced with sensors, but if you are driving some load then use them as output.
  • Functions like pinMode() and digitalWrite() are used to control the operations of digital pins while analogRead() is used to control analog pins.
  • The analog pins come with a total resolution of 10bits which measure the value from zero to 5V.
  • Arduino Nano comes with a crystal oscillator of frequency 16 MHz. It is used to produce a clock of precise frequency using constant voltage.
  • There is one limitation using Arduino Nano i.e. it doesn’t come with DC power jack, means you can not supply external power source through a battery.
  • This board doesn’t use standard USB for connection with a computer, instead, it comes with Mini USB support.
  • Tiny size and breadboard friendly nature make this device an ideal choice for most of the applications where a size of the electronic components are of great concern.
  • Flash memory is 16KB or 32KB that all depends on the Atmega board i.e Atmega168 comes with 16KB of flash memory while Atmega328 comes with a flash memory of 32KB. Flash memory is used for storing code. The 2KB of memory out of total flash memory is used for a bootloader.
  • DC 3-6v BO Gear Motor with Plastic Tire Wheel

  • A DC Geared DC motor is a simple DC motor with gear box attached to it
  • img

    DC 3-6v BO Gear Motor with Plastic Tire Wheel

    Features

  • Center hole: 5.3MM x 3.66MM
  • Wheel size: 65 x 26mm
  • Specification

  • Voltage: DC 3V-6V
  • Current: 100 MA-120MA
  • Reduction rate: 48: 1
  • RPM (With tire): 100-240
  • Tire Diameter: 65mm
  • Car Speed(M/minute): 20-48
  • Motor Weight (g): 29/each
  • Motor Size: 70mm X 22mm X 18mm
  • Noise: <65dB
  • Ultrasonic sensor

  • As the name indicates, ultrasonic sensors measure distance by using ultrasonic waves. The sensor head emits an ultrasonic wave and receives the wave reflected back from the target. Ultrasonic Sensors measure the distance to the target by measuring the time between the emission and reception.
  • img

    Ultrasonic sensor

  • An optical sensor has a transmitter and receiver, whereas an ultrasonic sensor uses a single ultrasonic element for both emission and reception. In a reflective model ultrasonic sensor, a single oscillator emits and receives ultrasonic waves alternately. This enables miniaturization of the sensor head.
  • The distance can be calculated with the following formula: Distance L = 1/2 × T × C
  • where L is the distance, T is the time between the emission and reception, and C is the sonic speed. (The value is multiplied by 1/2 because T is the time for go-and-return distance.)
  • img

    Distance Calculation

    Robot Chassis

  • You can use any Robot Chassis availble in the market to mount all the parts use in this project
  • img

    Robot Chassis

    Connection Diagram

    img

    Connection Diagram Obstacle Avoiding Robotic Car

    Limitations

  • As the range of the Bluetooth Communication is limited (a maximum of 10 meters for class 2 devices for example) the control range of Bluetooth Controlled Robot is also limited.
  • Make sure that sufficient power is provided to all the modules, especially the Bluetooth Module. If the power is not sufficient, even though the Bluetooth Module powers on, it cannot transmit data or cannot be paired with other Bluetooth devices.
  • Application

  • Low range Mobile Surveillance Devices
  • Military Applications (no human intervention)
  • Assistive devices (like wheelchairs)
  • Home automation
  • Software Requirement

  • Arduino IDE
  • Programming Arduino Nano

    Complete program with a demonstration video is given at the end of this project. The program will include setting up HC-SR04 module and outputting the signals to Motor Pins to move motor direction accordingly. No libraries will be used in this project.

    First define trig and echo pin of HC-SR04 in the program. In this project the trig pin is connected to GPIO9 and echo pin is connected to GPIO10 of Arduino NANO.

    int trigPin = 9;      // trig pin of HC-SR04
    int echoPin = 10;     // Echo pin of HC-SR04

    Define pins for input of LM298N Motor Driver Module. The LM298N has 4 data input pins used to control the direction of motor connected to it.

    int leftmotrev4 = 4;       //Left motor REVerse rotation 
    int leftmotfor5 = 5;       //Left motor ForWarD rotation 
    int rightmotrev6 = 6;      //Right motor REVerse rotation 
    int rightmotfor7 = 7;      //Right motor ForWarD rotation

    In setup() function, define the data direction of utilised GPIO pins. The four Motor pins and Trig pin is set as OUTPUT and Echo Pin is set as Input.

    pinMode(leftmotrev4, OUTPUT);      // set Motor pins as output
    pinMode(leftmotfor5, OUTPUT);  // set Motor pins as output   
    pinMode(rightmotrev6, OUTPUT); // set Motor pins as output 
    pinMode(rightmotfor7, OUTPUT); // set Motor pins as output 
    pinMode(trigPin, OUTPUT);         // set trig pin as output
    pinMode(echoPin, INPUT);          //set echo pin as input to capture reflected waves

    In loop() function, get the distance from HC-SR04 and based on the distance move the motor direction. The distance will show the object distance coming in front of the robot. The Distance is taken by bursting a beam of ultrasonic up to 10 us and receiving it after 10us.

    digitalWrite(trigPin, LOW);
    delayMicroseconds(2);   
    digitalWrite(trigPin, HIGH);     // send waves for 10 us
    delayMicroseconds(10);
    duration = pulseIn(echoPin, HIGH); // receive reflected waves
    distance = duration / 58.2;   // convert to distance
    delay(10);

    If the distance is greater than the defined distance means there is not obstacle in its path and it will moving in forward direction.

                if (distance > 19)            
                {
                digitalWrite(rightmotfor7, HIGH);                    // move forward
                digitalWrite(rightmotrev6, LOW);                  // move backward 
                digitalWrite(leftmotfor5, HIGH) 					// move forward;  
                digitalWrite(leftmotrev4, LOW);           // move backward 
                }

    If the distance is less than the defined distance to avoid obstacle means there is some obstacle ahead. So in this situation robot will stop for a while and movebackwards after that again stop for a while and then take turn to another direction.

                  if (distance < 18)
                 {
                 digitalWrite(rightmotfor7, LOW);  //Stop                
                 digitalWrite(rightmotrev6, LOW);
                 digitalWrite(leftmotfor5, LOW);                                
                 digitalWrite(leftmotrev4, LOW);
                 delay(500);
                 digitalWrite(rightmotfor7, LOW);      //movebackword         
                 digitalWrite(rightmotrev6, HIGH);
                 digitalWrite(leftmotfor5, LOW);                                
                 digitalWrite(leftmotrev4, HIGH);
                 delay(500);
                 digitalWrite(rightmotfor7, LOW);  //Stop                
                 digitalWrite(rightmotrev6, LOW);
                 digitalWrite(leftmotfor5, LOW);                                
                 digitalWrite(leftmotrev4, LOW);  
                 delay(100);  
                 digitalWrite(rightmotfor7, HIGH);       
                 digitalWrite(rightmotrev6, LOW);   
                 digitalWrite(leftmotrev4, LOW);                                 
                 digitalWrite(leftmotfor5, LOW);  
                 delay(500);
                }

    So this is how a robot can avoid obstacles in its path without getting stuck anywhere. 

    Comment Section

    Please Comment about this project