Download as pdf or txt
Download as pdf or txt
You are on page 1of 25

Simulation studies on line, light and human

following robots using Arduino in Proteus


Schematic
G. D. Anbarasi Jebaselvi (  anbarasi.enc@sathyabama.ac.in )
Sathyabama Institute of Science and Technology
R. Narmadha
Sathyabama Institute of Science and Technology
Vishwajeet Anand
Sathyabama Institute of Science and Technology
Harshit Tathagat
Sathyabama Institute of Science and Technology

Research Article

Keywords: Mobile Robot, Arduino, Infra-Red Sensor, Black Path, LDR, etc.

Posted Date: September 28th, 2022

DOI: https://doi.org/10.21203/rs.3.rs-2076251/v1

License:   This work is licensed under a Creative Commons Attribution 4.0 International License.
Read Full License

Page 1/25
Abstract
This technical paper describes about the robots which follows the path, light and human gestures and
their simulation using Arduino and Proteus. The line following robot is constructed to proceed in a
predefined path using IR sensor. The light following robot is designed to follow the light source LDR, the
light dependent resistor. The human following robot traces the human heat and moves in the direction of
human motion or gesture by means of IR, the infra-red sensor. Their applications involve in the fields of
remote sensing, mobile communications and biomedical instrumentation and so on. The key merits
include its’ lightweight, automated, cheap, easy to use, etc. Here the Proteus schematic has been drawn
and its simulation uses Arduino software.

1. Introduction
A robot is defined as an automated virtual agent/machine that is capable of replicating and performing
several tasks. The main utility of a robot is task automation and this aspect of it can be exploited in
various sectors like military, healthcare and industries and has endless applications. This research paper
gives a detailed schematic in Proteus platform and the complete coding in arduino for the three robots
namely, path following, light source following and the human gesture following robots. IR Sensors
mounted on the line following the robot are used to detect the black or white line to define the path. Light
following robot senses light emitted by the LDR and follows the light source. It uses a microcontroller for
processing the sensory signals and responds by controlling the motors in the direction of the light source.
Human following robot can sense obstacles and human movements automatically and follow or avoid
them within a specific range.

2. Materials And Methodology Used:


The components used to construct the respective schematic in proteus platform for the path, light and
human following robots are listed below in Table.1

Table.1

Page 2/25
Type of robot/actions performed Components used

Line following robot Arduino Uno

Multi-Cell Battery

Driver - L293D

Geared servo motors


IR Sensors

Resistors

Light following robot Arduino Uno


Multi-Cell Battery

Resistor

Geared Motors
Driver- L293D

Switch

Light Dependent Resistor

Servo Motor

Human following robot Arduino Uno

IR Sensor

Driver- L293D
Ultrasonic Sensor

Variable Resistor

DC and Servo Motor

Line following robot:

To facilitate the movement of robots, a path like a black line on a white surface or vice versa, has been
used. Here, IR sensors are used to sense this path, then process the robot to follow the path. As shown in
Fig.1, sensors are used to identify the line. The signal fetched from the sensor is sent to the Arduino UNO
microcontroller in order to process it and define the steps.

The circuit diagram depicting the line following robot is given below in Fig.2. It constitutes an operational
amplifier which receives signals from the IR LED and a photodiode. A +5V biasing supply is given.
According to the output LED emits light.

Page 3/25
In the Proteus schematic, all the required components are picked up and wire connected. The required
program coding is uploaded in the arduino and the path is defined and compiled. The code in the Arduino
IDE is debugged, and the motors starts rotating left and right alternatively.

Light following robot:

When the LDR mounted on the robot detects a light incident on it, its resistance changes which trigger the
servo motors which make the robot to move. The robot moves as long as it senses or detects the light.

Similarly, for the light following robot in the Proteus schematic, all the required components are picked up
and wire connected. The required program coding is uploaded in the arduino and the path is defined and
compiled.

After the debugging, the left motor starts running forward (like a front wheel) when the source light is
approaching LDR and the right motor runs backward (like a rear wheel) when the LDR is away from the
source light.

Human following robot:

In this human following robot, two IR sensors are used to detect the motion of human body or simply
gesture signals can be detected by the IR sensors and the ultrasonic sensor is to calculate the distance of
the robot from the human body. The two IR sensors and the ultrasonic sensor sense the presence of the
human body and move towards its direction.

If the left IR sensor detects the motion, then the robot moves towards the left and if the right IR sensor
detects the motion, then the robot moves towards the right. The circuit diagram for the human following
robot bas been given underneath in Fig.7. It includes two IR sensors for detecting the human motion,
ultrasonic sensor to measure the distance of robot from the human beings, arduino as a microcontroller,
a driver unit L298 and motors for front wheels and rear wheels.

The corresponding Proteus schematic is given below as in Fig.8

3. Algorithm Interpretation
Line following robot:

1. Start

2. Set the output pins in the setup () function

3. Read LS (left signal) and RS (right signal) in the loop () function

4. When both the signals are high (1), use the digitalWrite command in order to move forward.

Page 4/25
5. When the left signal is high (1) and the right signal is low (0), turn left while and turn right in the
opposite scenario.

6. The actuator stops the movement when both the LS and RS signals are low.

7. Stop

Light following robot:

1. Start
2. Set the output pins in the setup () function
3. First read the Left Steering, Right Steering and Forward Steering in the loop () function
4. If LMRead value is greater than the Tolerance Value while the RMRead and FMRead are less than the
Tolerance Value, it is made the robot to move left
5. If FMRead and RMRead value is greater than Tolerance Value and the LMRead value is less than the
Tolerance Value, it is made the robot move right
6. If the LMRead and RMRead value is less than Tolerance Value and FMRead value is greater than the
tolerance value, it is made the robot to move forward.
7. The above commands have kept working as long as the light persists on the LDR.
8. Stop

Human following robot:

1. Start
2. We set the output pins in the setup () function
3. We read the right_value and left_value in the loop () function
4. If both right_value and left_value is 1 and the distance is between 10 to 30 units then it moves
forward
5. If right_value is 0 while left_value is 1, then it turns right
6. If right_value is 1 while right_value is 0, then it turns left
7. If both right_value and left_value 1, then the robot stops
8. Stop

4. Codes In Arduino
The microcontroller Arduino UNO is programmed with the following instructions:

Line following robot:

The codes used are given below:

Page 5/25
void setup ()

pinMode (8, OUTPUT);

pinMode (9, OUTPUT);

pinMode (10, OUTPUT);

pinMode (11, OUTPUT);

pinMode (12, OUTPUT);

pinMode (13, OUTPUT);

void loop() {

int LS=digitalRead (7);

int RS=digitalRead (6);

if (LS==1 && RS==1) //move forward

//motor 1

digitalWrite (13, HIGH);

digitalWrite (12, LOW);

analogWrite (11,255);

//motor 2

digitalWrite (8, HIGH);

digitalWrite (9, LOW);

analogWrite (10,255);

if (LS==1 && RS==0) // turn Right

Page 6/25
{

//motor 1

digitalWrite (13, HIGH);

digitalWrite (12, LOW);

analogWrite (11,255);

//motor 2

digitalWrite (9, HIGH);

digitalWrite (8, LOW);

analogWrite (10,255);

if(LS==0 && RS==1) // turn Left

//motor 1

digitalWrite (12, HIGH);

digitalWrite (13, LOW);

analogWrite (11,255);

//motor 2

digitalWrite (9, HIGH);

digitalWrite (8, LOW);

analogWrite (10,255);

if(LS==0 && RS==0) // stop

//motor 1

Page 7/25
digitalWrite (13, LOW);

digitalWrite (12, LOW);

analogWrite (11,255);

//motor 2

digitalWrite (9, LOW);

digitalWrite (8, LOW);

analogWrite (10,255);

Light following robot:

#include<Servo.h>

int E1 = 5; //Enable pin for Right gear motor

int E2 = 6; //Enable pin for Left gear motor

int M1 = 4; //Left Motor pin 1

int M2 = 7; //Left Motor pin 2

int M3 = 8; //Right Motor pin 3

int M4 = 9; //Right Motor pin 4

Servo MyServo ;

int sp=12;

int angle = 90; //initial Servo Angle

int butpin = 10;

int butState;

int LS = A2; //left Sensor

int RS = A1; //Right Sensor

Page 8/25
int FS = A0; //Forward Sensor

int a = 400; // Tolarance Value

int LMRead; //Left Motor Reading

int RMRead; //Right Motor Reading

int FMRead; // Forward Motor Reading

void setup() {

Serial.begin(9600);

pinMode(M1,OUTPUT);

pinMode(M2,OUTPUT);

pinMode(M3,OUTPUT);

pinMode(M4,OUTPUT);

pinMode(butpin,INPUT);

MyServo.attach(sp);

digitalWrite (E1, HIGH); //These pins are always High in H-Bridge so those were made 'High'

digitalWrite(E2,HIGH);

void loop() {

// Light Following

butState = digitalRead(butpin);

if(butState == LOW) {

LMRead = analogRead(LS);

RMRead = analogRead(RS);

FMRead = analogRead(FS);

// Moving Robot to Left Position

Page 9/25
if (LMRead >a && RMRead<a && FMRead<a)

MyServo.write(angle+60); // Moving Servo to 120 Degree

digitalWrite(M1,HIGH); //left motor pin1

digitalWrite(M2,LOW); //Left motor pin2

digitalWrite(M3,HIGH); //Right Motor pin 3

digitalWrite(M4,LOW); //RM pin 4

// Moving Robot to Right Position

else if (RMRead >a && LMRead<a && FMRead<a)

MyServo.write(angle-60); // Moving Servo to 60 Degree

digitalWrite(M1,HIGH); //left motor pin1

digitalWrite(M2,LOW); //Left motor pin2

digitalWrite(M3,HIGH); //Right Motor pin 3

digitalWrite(M4,LOW); //RM pin 4

// Moving Robot to Forward Position

else if (FMRead > a && RMRead < a && LMRead < a)

MyServo.write(angle); // Moving Servo to 90 Degree

digitalWrite(M1,HIGH); //left motor pin1

digitalWrite(M2,LOW); //Left motor pin2

digitalWrite(M3,HIGH); //Right Motor pin 3

Page 10/25
digitalWrite(M4,LOW); //RM pin 4

// If Enough Light is Detected from Left & Centre Sensor then

else if (FMRead > a && RMRead < a && LMRead > a)

MyServo.write((angle+60)/2); // Moving Servo to 90 Degree

digitalWrite(M1,HIGH); //left motor pin1

digitalWrite(M2,LOW); //Left motor pin2

digitalWrite(M3,HIGH); //Right Motor pin 3

digitalWrite(M4,LOW); //RM pin 4

// If Enough Light is Detected from Right & Centre Sensor then

else if (FMRead > a && RMRead > a && LMRead < a)

MyServo.write(170); // Moving Servo to 90 Degree

digitalWrite(M1,HIGH); //left motor pin1

digitalWrite(M2,LOW); //Left motor pin2

digitalWrite(M3,HIGH); //Right Motor pin 3

digitalWrite(M4,LOW); //RM pin 4

// Now IF Lght is Detected from eiter left ,right or Center Sensor

else

MyServo.write(angle);

Page 11/25
digitalWrite(M1,LOW); //left motor pin1

digitalWrite(M2,LOW); //Left motor pin2

digitalWrite(M3,LOW); //Right Motor pin 3

digitalWrite(M4,LOW); //Right Motor pin 4

// Light Avoiding

if(butState == HIGH)

LMRead = analogRead(LS); //LMRead mean Left Motor Reading

RMRead = analogRead(RS); //RMRead mean Right Motor Reading

FMRead = analogRead(FS); //FMRead mean Forward Motor Reading

// Moving Robot to Right Position

if (LMRead >a && RMRead<a && FMRead<a)

MyServo.write(angle-60); // Moving Servo to 30 Degree

digitalWrite(M1,HIGH); //left motor pin1

digitalWrite(M2,LOW); //Left motor pin2

digitalWrite(M3,HIGH); //Right Motor pin 3

digitalWrite(M4,LOW); //RM pin 4

// Moving Robot to Left Position

else if (RMRead >a && LMRead<a && FMRead<a)

Page 12/25
MyServo.write(angle+60); // Moving Servo to 120 Degree

digitalWrite(M1,HIGH); //left motor pin1

digitalWrite(M2,LOW); //Left motor pin2

digitalWrite(M3,HIGH); //Right Motor pin 3

digitalWrite(M4,LOW); //RM pin 4

// Moving Robot to Back Position

else if (FMRead >a && RMRead<a && LMRead<a)

MyServo.write(angle); // Moving Servo to 90 Degree

digitalWrite(M1,LOW); //left motor pin1

digitalWrite(M2,HIGH); //Left motor pin2

digitalWrite(M3,LOW); //Right Motor pin 3

digitalWrite(M4,HIGH); //RM pin 4

// Now IF Light is Detected from either left ,right or Centre Sensor

else if((FMRead >a && RMRead>a && LMRead<a) || (FMRead <a && RMRead>a && LMRead>a) ||
(FMRead >a && RMRead<a && LMRead>a) || (FMRead >a && RMRead>a && LMRead>a))

MyServo.write(angle);

digitalWrite(M1,LOW); //left motor pin1

digitalWrite(M2,HIGH); //Left motor pin2

digitalWrite(M3,LOW); //Right Motor pin 3

digitalWrite(M4,HIGH); //Right Motor pin 4

}
Page 13/25
}

Human Following Robot:

#include<Servo.h>

#include<AFMotor.h>

#define LEFT A0

#define echopin A1 // echo pin

#define trigpin A2 // Trigger pin

#define RIGHT A3

AF_DCMotor Motor1(1,MOTOR12_1KHZ);

AF_DCMotor Motor2(2,MOTOR12_1KHZ);

AF_DCMotor Motor3(3,MOTOR34_1KHZ);

AF_DCMotor Motor4(4,MOTOR34_1KHZ);

Servo myservo;

int pos =0;

long time;

void setup()

Serial.begin(9600);

myservo.attach(10);

for(pos = 90; pos <= 180; pos += 1)

myservo.write(pos);

delay(15);

Page 14/25
}

for(pos = 180; pos >= 0; pos-= 1)

myservo.write(pos);

delay(15);

for(pos = 0; pos<=90; pos += 1)

myservo.write(pos);

delay(15);

pinMode(RIGHT, INPUT);

pinMode(LEFT, INPUT);

pinMode(trigpin, OUTPUT);

pinMode(echopin, INPUT);

void loop()

unsigned int distance = read_cm();

int Right_Value = digitalRead(RIGHT);

int Left_Value = digitalRead(LEFT);

Serial.print("R= ");

Serial.print(Right_Value);

Serial.print(" L= ");

Page 15/25
Serial.print(Left_Value);

Serial.print(" D= ");

Serial.println(distance);

if((Right_Value==1) && (distance>=10 && distance<=30)&&(Left_Value==1)){for

ward();}

else if((Right_Value==0) && (Left_Value==1)){turnRight();}

else if((Right_Value==1) && (Left_Value==0)){turnLeft();}

else if((Right_Value==1) && (Left_Value==1)){stop();}

else if(distance > 5 && distance < 10){stop();}

else if(distance < 5){backword();}

delay(50);

long read_cm(){

digitalWrite(trigpin, LOW);

delayMicroseconds(2);

digitalWrite(trigpin, HIGH);

delayMicroseconds(10);

time = pulseIn (echopin, HIGH);

return time / 29 / 2;

void forword(){// turn it on going forward

Motor1.setSpeed(120);

Motor1.run(FORWARD);

Motor2.setSpeed(120);

Page 16/25
Motor2.run(FORWARD);

Motor3.setSpeed(120);

Motor3.run(FORWARD);

Motor4.setSpeed(120);

Motor4.run(FORWARD);

void backword(){ // the other way

Motor1.setSpeed(120);

Motor1.run(BACKWARD);

Motor2.setSpeed(120);

Motor2.run(BACKWARD);

Motor3.setSpeed(120);

Motor3.run(BACKWARD);

Motor4.setSpeed(120);

Motor4.run(BACKWARD);

void turnRight(){ // the other right

Motor1.setSpeed(200);

Motor1.run(FORWARD);

Motor2.setSpeed(200);

Motor2.run(FORWARD);

Motor3.setSpeed(100);

Motor3.run(BACKWARD);

Motor4.setSpeed(100);

Page 17/25
Motor4.run(BACKWARD);

void turnLeft(){ // turn it on going left

Motor1.setSpeed(100);

Motor1.run(BACKWARD);

Motor2.setSpeed(100);

Motor2.run(BACKWARD);

Motor3.setSpeed(200);

Motor3.run(FORWARD);

Motor4.setSpeed(200);

Motor4.run(FORWARD);

void stop(){ // stopped

Motor1.setSpeed(0);

Motor1.run(RELEASE);

Motor2.setSpeed(0);

Motor2.run(RELEASE);

Motor3.setSpeed(0);

Motor3.run(RELEASE);

Motor4.setSpeed(0);

Motor4.run(RELEASE);

5. Conclusion

Page 18/25
Here in all the simulation, a + 5V power source has been used in order to power the DC motors/Servo
motors of the robots as well as the device driver units. In all the simulation works carried out here, the
motors run according to the directions it is intended to. In human following robot, the IR sensor detects
the presence/absence of human beings which has been shown by either ‘0’ or ‘1’in the test flag. The
distance covered by the robots is directly proportional to speed. These types of robots find its application
in various applications such as transportation services, industrial uses such as pick and place facility or
moving payload from a source to destination, healthcare sectors such as providing medicines to COVID-
19 positive patients, military operations, etc. When actually implemented in real life, there will be some
practical faults like inconsistent power supply, wear and tear of moving parts, might be less efficient than
the expected results and hardware flops.

6. Declarations
Ethical Approval:

As this research work does not include any real time data and its related parameters, it is not necessary to
provide an ethical approval certificate at present. Only simulation work has been carried out and virtual
running of servo motors has been observed when IR sensor detects the presence of a human body. In
addition, no harm incurred to the human beings when IR sensor are likely to get in touch them directly or
indirectly.

Note: PIR sensors are used in thermal sensing applications, such as security and motion detection. The
Passive Infrared (PIR) sensor is used to detect the presence of human in real time. Moreover, this sensor
detects the human only if they are in motion. Every human radiates some amount of infrared energy of
specific wavelength range. The absorbed incident radiation changes the temperature of a material.

Competing interests/ Conflicts of interest:

As this research work cited in the manuscript is only intended for education purpose and all the authors
are accountable to disclose details of any and all interests that are relevant to this study and there in no
such conflicts with their roles and responsibilities in a grant selection process.

Authors' Contributions:

In this particular manuscript, G D Anbarasi Jebaselvi has acted as a Corresponding Author and gave this
idea and wrote the main research contents, R. Narmadha helped in Codings, Vishwajeet Anand and
Harshit Tathagat contributed their efforts in paperwork and also in figures.

All authors reviewed the manuscript thoroughly.

Funding:

Page 19/25
The article processing fee has not been given and We didn’t receive any funding from our Institution for
publication and solely it’s authors’ interest to publish this article in your esteemed journal.

Availability of data and materials:

The availability of data and materials have been obtained by referring a few technical articles and papers
which are listed in the references. Since we have used Proteus Schematic, all the schematics of the
required experimentation have been drawn, codes written in Arduino, complied, debugged and verified for
its output.

7. References
1. Jagruthi Chaudhari, Asmita Desari, Gavarskar, ‘Line Following Robot Using Arduino for Hospitals’,
2nd International Conference on Intelligent Communication and Computational Techniques ICCT,
2019.
2. Mehran Pakdaman; M. Mehdi Sanaatiyan; Mahdi Rezaei Ghahroudi, 'A Line Follower Robot from
design to Implementation: Technical issues and problems’ The 2nd International Conference on
Computer and Automation Engineering, ICCAE, 2010
3. Md Takiul Hasan Sakib, ‘Line Following Robot Using Arduino’, December 2019
4. Yosuke Nagumo, Akihisa Ohya ‘Human following behavior of an autonomous mobile robot using
light-emitting device’, Proceedings of 10th IEEE International Workshop on Robot and Human
Interactive Communication, DOI: 10.1109/ROMAN.2001.981906
5. Jishnu S1, Diwakar Babu Y1, Sampath Kumar, ‘Human following robot’, International Advanced
Research Journal in Science, Engineering and Technology, Vol. 8, Issue 7, July 2021, DOI:
10.17148/IARJSET.2021.8751
6. Utsho A Arefín, Md. Hasib Iqbal, Maksuda Jahan, ‘Design & Implementation of Light Following
Robot’, Project Report, DOI: 10.13140/2.1.3301.9209, March 2014
7. Gandla, Mano Tejaswini, Human Following Robot (May 15, 2021). Available at SSRN:
https://ssrn.com/abstract=3917847 or http://dx.doi.org/10.2139/ssrn.3917847

Figures

Page 20/25
Figure 1

Block diagram for line following robot

Figure 2

Circuit diagram for line following robot

Page 21/25
Figure 3

Proteus Schematic for line following robot

Figure 4

Block diagram for light following robot

Page 22/25
Figure 5

Proteus Schematic for light following robot

Page 23/25
Figure 6

Block diagram for human following robot

Figure 7

Circuit diagram for human following robot

Page 24/25
Figure 8

Proteus Schematic for human following robot

Page 25/25

You might also like