Automatic Line Following and Obstacle Avoiding Robot

by tanvir10 in Circuits > Arduino

660 Views, 4 Favorites, 0 Comments

Automatic Line Following and Obstacle Avoiding Robot

IMG_20221027_161617.jpg
IMG_20221026_124909.jpg
IMG_20221026_125504.jpg
IMG_20221026_181115.jpg
IMG_20221026_181116.jpg
IMG_20221027_123740.jpg
IMG_20221027_155653.jpg
IMG_20221027_161606.jpg
IMG_20221027_161610.jpg

Line Follower Using Arduino And Its Applications


Line Follower Using Arduino And Its Applications

 

Abstract: -- This paper has been designed to build a Line following Robot using IR sensor to follow a

Designated path which is provided and runs over it. ROBOT has sufficient intelligence to cover the maximum area of space provided. It will move in a particular direction specified by the user to navigate the robot through a black line marked on the white surface. Automatic parking technology has become a popular research topic. Automatic parking technology can complete parking operations safely and quickly without a driver and can improve driving comfort, while greatly reducing the probability of parking accidents.

 

INTRODUCTION

Robot is a machine that is usually designed to reduce the amount of human work where it is applicable. It is usually developed for reducing risk factor for human work and increase comfort of any worker. High performance, high accuracy, lower labor cost and the ability to work in hazardous places have put robotics in an advantageous position over many other such Technologies. In this paper a line tracer or follower has been presented which will trace a black line on a white surface or vice-versa. We have make use of sensors to achieve this objective. The main component behind this robot is ATmega328 microcontroller which is a brain of this robot. The idea proposed in this paper is by using machine vision to guide the robot we have made a robot that has several works to perform besides following a line. This robot follows a line without going to other direction. The construction of the robot circuit is easy and small. This can also be used in many applications such as automatic valet parking in efficient way.

The rapid increase in urban car ownership not only increases the burden of urban traffic but also exacerbates the problem of insufficient parking spaces. The increased driving distance in the parking process increases energy consumption and exacerbates parking difficulties, which increasing the number of minor accidents, such as scuffing and collisions.

LINE FOLLOWER

Block Diagram of Line Follower

 

Here firstly, we chose a configuration to develop a line follower only using two infrared sensors with connection of Arduino Uno through motor driver IC. We followed a block diagram on the regard. The block diagram illustrates the connection for the development of the line follower which follows a black line on white surface. Block diagram of a line follower robot After that, we have used the following block diagram for connecting two sensors with our line follower for obstacle detection purpose for our line follower

 

EQUIPMENTS USED

1] THE CHASSIS AND THE BODY

The Chassis

Here some good materials can be used for designing robot chassis such as wood, plastic, aluminium and brass alloys. We used arduino 4 wheeler


2] ARDUINO UNO R3

 

What Is Inside an Arduino?

Although there are many different types of Arduino boards available, this manual focuses on the Arduino Uno. This is the most popular Arduino board around. So what makes this thing tick? Here are the specifications:

1.    Processor: 16 Mhz ATmega328

2.    Flash memory: 32 KB

3.    Ram: 2kb

4.    Operating Voltage: 5V

5.    Input Voltage: 7-12 V

6.    Number of analog inputs: 6

7.    Number of digital I/O: 14 (6 of them pwm)

 

Arduino is an open-source platform used for building electronics projects. Arduino consists of both a physical Programmable circuit board and IDE that runs on your computer, used to write and upload computer code to the physical board. The Arduino IDE uses a simplified version of C++, making it easier to learn to program. Arduino Uno pinout - Power Supply

 

 

There are 3 ways to power the Arduino Uno: 

Barrel Jack - The Barrel jack, or DC Power Jack can be used to power our Arduino board. The barrel jack is usually connected to a wall adapter. The board can be powered by 5-20 volts but the manufacturer recommends to keep it between 7-12 volts. Above 12 volts, the regulators might overheat, and below 7 volts, might not suffice.

 

VIN Pin - This pin is used to power the Arduino Uno board using an external power source. The voltage should be within the range mentioned above.

 

USB cable - when connected to the computer, provides 5 volts at 500mA. There is a polarity protection diode connecting between the positive of the barrel jack to the VIN pin, rated at 1 Ampere. The power source you use determines the power we have available for your circuit. For instance, powering the circuit using the USB limits you to 500Ma 5v and 3v3 -They provide regulated 5 and 3.3v to power external components according to manufacturer specifications.

 

GROUND - In the Arduino Uno pinout,

You can find 5 GND pins, which are all interconnected. The GND pins are used to close the electrical circuit and provide a common logic reference level throughout your circuit. Always make sure that all GNDs (of the Arduino, peripherals and components) are connected to one another and have a common ground.

 

RESET - resets the Arduino.

 

Arduino Uno Pinout - Analog IN

The Arduino Uno has 6 analog pins, which utilize ADC (Analog to Digital converter). These pins serve as analog inputs but can also function as digital inputs or digital outputs.

 

IC L293D

The most common method to drive DC motors in two directions under control of a computer is with an H-bridge motor driver. H-bridges can be built from scratch with bi-polar junction transistors (BJT) or with field effect transistors (FET), or can be purchased as an integrated unit in a single integrated circuit package such as the L293. The L293 is simplest and inexpensive for low current motors, for high current motors, it is less expensive to build your own H-bridge from starch.

 

 

L293D Module

Motor driver is basically a current amplifier which takes a low-current signal from the microcontroller and gives out a proportionally higher current signal which can control and drive a motor. L293D IC generally comes as a standard 16-pin DIP (dual-in line package). This motor driver IC can simultaneously control two small motors in either direction; forward and reverse with just 4 microcontroller pins.

 

 

 

4} IR SENSOR

Infrared Ray Sensors are used to find out the position of a line follower with respect to the robot position. For line sensing operation, IR sensors are the one which are widely used for the development of a line follower robot. There are some basic things to follow where white surface of the black line reflects light and the black line receives it after the transmission. Two resistors R1 and R2 are used which limits current. Other resistors (R3, R5, R6, R8) forms individual voltage divider networks which is in connection with the designed LDR’s. When the sensor is properly classified, both LED/LDR pairs will run over the white surface. In this condition, sufficient amount of light gets reflected back to the LDRs. So, their resistance will be low. So the voltage dropped across the LDR will be low. When the robot is drifted to one side, the sensor in the opposite side falls over the black line and the intensity of light reflected back to the corresponding LDR will be low. As a result, the resistance of the LDR shoots up and the voltage dropped across it will be high. The voltages dropped across the right and left LDRs (nodes marked R and L in the above circuit) are given as input to the analogue input pins A3 and A4 of the Arduino board. The line sensors are made using LDR and LED for making a line follower robot. A 1K resistor across the LED, a series connection of 10K resistor and 10K variable with the LDR are major resistive and sensor connections. These sensors are soldered in a board (Chassis) and then we use that for our system. It is powered by (4*1.5) V battery.

 

PROCEDURE OF SENSING THE LINE

The line follower robot is a kind of a design which is similar as a light follower robot. Here, besides sensing the light, the sensor is used for detection of a line. Therefore by individualizing the colour of line and its enclosing, any light sensitive sensor could be used for navigation of the robot to follow its designated track. The design of the robot was made like; it had one pair of Infrared ray sensor fitted underneath the robot. So Infrared ray sensor will first be sending a wavelength for detecting black line and then other infrared ray sensor will be receiving the information and take decision for following a black line on white surface. With the supply from a 9V DC power adapter the whole sensor and the motor driver IC and the motors and arduino are powered. Making the setup less prone to power failure the outputs of the sensor circuits are connected as in the analog inputs of the arduino board.

 

 


ROBOT


ALGORITHM

 

1] When both sensors sees white both wheels spins at same speed and robot goes straight.

2] When “Left” sensor sees black and “Right” sensor sees white robot moves left.

3] When “Right” sensor sees black and “Left” sees white robot moves right.

 

//ARDUINO LINE FOLLOWING CAR//

//including the libraries

#include <AFMotor.h>

 

//defining pins and variables

#define left A0

#define right A1

 

//defining motors

AF_DCMotor motor1(1, MOTOR12_1KHZ);

AF_DCMotor motor2(2, MOTOR12_1KHZ);

AF_DCMotor motor3(3, MOTOR34_1KHZ);

AF_DCMotor motor4(4, MOTOR34_1KHZ);

 

 

 

void setup() {

 //declaring pin types

 pinMode(left,INPUT);

 pinMode(right,INPUT);

 //begin serial communication

 Serial.begin(9600);

}

 

void loop(){

 //printing values of the sensors to the serial monitor

 Serial.println(digitalRead(left));

 

 Serial.println(digitalRead(right));

 

 //line detected by both

 if(digitalRead(left)==0 && digitalRead(right)==0){

   //Forward

   motor1.run(FORWARD);

   motor1.setSpeed(50);

   motor2.run(FORWARD);

   motor2.setSpeed(50);

   motor3.run(FORWARD);

   motor3.setSpeed(50);

   motor4.run(FORWARD);

   motor4.setSpeed(50);

 }

 //line detected by left sensor

 else if(digitalRead(left)==0 && !digitalRead(right)==0){

   //turn left

   motor1.run(FORWARD);

   motor1.setSpeed(70);

   motor2.run(BACKWARD);

   motor2.setSpeed(70);

   motor3.run(FORWARD);

   motor3.setSpeed(70);

   motor4.run(BACKWARD);

   motor4.setSpeed(70);

   

 }

 //line detected by right sensor

 else if(!digitalRead(left)==0 && digitalRead(right)==0){

   //turn right

 

   motor1.run(BACKWARD);

   motor1.setSpeed(70);

   motor2.run(FORWARD);

   motor2.setSpeed(70);

   motor3.run(BACKWARD);

   motor3.setSpeed(70);

   motor4.run(FORWARD);

   motor4.setSpeed(70);

  

 }

 //line detected by none

 else if(!digitalRead(left)==0 && !digitalRead(right)==0){

   //stop

   motor1.run(RELEASE);

   motor1.setSpeed(0);

   motor2.run(RELEASE);

   motor2.setSpeed(0);

   motor3.run(RELEASE);

   motor3.setSpeed(0);

   motor4.run(RELEASE);

   motor4.setSpeed(0);

 }

}

 

FLOW CHART

 

 

OPERATION

 

The robot will do the following:

(i) Detect the type of the slot (Resident or Visitor) and the state of the slot.

(ii) Park itself at the appropriate available slot closest to the OUT sign (Exit)

(iii) Display the slot numbers that are available, on the LCD. At the starting the robot will be placed at the IN position.

• The robot will traverse the arena, sense the type and state of each slot.

• The robot will sound a buzzer for each occupied slot irrespective of its type.

• As soon as the robot reaches the OUT position it will turn and park itself at the visitor slot closest to the OUT position.

• After the robot successfully parks itself, i will do the following:

 

1. Display the available resident and visitor slot numbers on the LCD.

2. Sound the buzzer continuously.

 

•The robot will be started by only one switch. The robot will be self-contained and not externally

operated by wire or by remote radio control.

 

 

RESULT

The Robot follows a specific line path simultaneously. This line follower robot with multiple modes compatibility works perfectly fine as it is designed to do .And thus attempt will be made to solve the unplanned and unauthorized parking problems in the resident area using prototype valet parking robot. The slot type and state of the slot will been identified using Sharp IR Sensor. And simultaneously we can perform the operation of Buzzer beep operation, object identification, Lcd display, robot direction control operation and will finally execute parking near to the end