Control Lab
Control Lab
By
Student Name Registration No.
Gul Nawab Ahmad BME193062
Sheikh Muhammad Suleman BME193081
of the degree of
BACHELOR OF SCIENCE MECHANICAL ENGINEERING
Faculty of Engineering
Capital University of Science and Technology
Islamabad
January 2023
Copyright 2023 by CUST Student
1
All rights reserved. Reproduction in whole or in part in any form requires the prior
written permission of , GUL NAWAB AHMAD - BME193062 & SHEIKH
MUHAMMAD SULEMAN - BME193081 or designated representative.
2
DECLARATION
January 2023
3
CERTIFICATE OF APPROVAL
It is certified that the project titled “Object Following Robot” carried out by Gul
Nawab - BME193062 and Sheikh Muhammad Sulaiman - BME193081, Capital
University of Science and Technology, Islamabad, is fully adequate, in scope and in
quality, as a semester project for the course of Control Engineering Lab
Supervisor:
Sir Attabik Tabib
Lab Instructor
Department of Mechanical Engineering
Faculty of Engineering
Capital University of Science and Technology, Islamabad
4
Abstract
In today’s world robotics are an expeditious growing and fascinating field. The robot
has sufficient smartness to cover the maximum area of provided space. It has
ultrasonic sensors and infrared sensors which are trained to sense the obstacles
coming in between the path of the robot. Autonomous smart robots are robots that can
perform desired tasks in unstructured environments without constant human guidance.
The minimum number of gear motor measures the moving robot to minimize the
power consumption while constructing a program that can create a coordination of
multi-degree of freedom for the kinetics of the robot.
The project calls for the use of an appropriate controller to control a system. For this
very purpose we have fabricated a human following robot using an Arduino controller
to control the movements of the robot. Additionally, we have compiled it with
ultrasonic sensors which can detect an object in its way.
5
Table of Contents
1 INTRODUCTION..............................................................................9
1.1 Overview........................................................................................9
1.2 Purpose of this Project...................................................................9
1.3 Report Organization.......................................................................9
2 LITERATURE REVIEW.................................................................10
2.1 Related Terminologies.................................................................10
2.1.1 Arduino UNO.....................................................................10
2.1.2 IC L293D............................................................................10
2.1.3 Ultrasonic Sensor (HC-SR04)............................................11
2.1.4 DC Gear Motor...................................................................12
2.1.5 Wheel..................................................................................13
2.1.6 Robot Chassis.....................................................................13
2.1.7 Jumper Wire.......................................................................14
2.2 Tools Used...................................................................................15
3 PROJECT DESIGN AND IMPLEMENTATION...........................16
3.1 Schematic Diagram......................................................................16
3.2 Arduino Programming.................................................................17
3.2.1 Arduino Code.....................................................................17
4 RESULTS.........................................................................................21
4.1 Limitations of the Project............................................................21
4.2 Further Improvements & Future Scope.......................................21
5 CONCLUSION................................................................................22
6
LIST OF FIGURES
Figure 1: Schematic Diagram of Arduino UNO...............................................................
Figure 2: Pin Diagram of IC I293D.................................................................................
Figure 3: Pin Diagram of Ultrasonic Sensor (HC-SR04).................................................
Figure 4: DC Geared Motor.............................................................................................
Figure 5: Robot Wheels.....................................................................................................
Figure 6: Robot Chassis....................................................................................................
Figure 7: Jumper Cables...................................................................................................
Figure 8: Schematic Diagram of Human Following Robot..............................................
Figure 9: Block Diagram of Human Following Robot.....................................................
Figure 10: Arduino Logic Entity Relationship Diagram..................................................
7
CHAPTER 1
1 INTRODUCTION
This part of the text provides a general review of the report. The main aim to write
this report is the design and working of Human Following Robot.
1.1 Overview
AI and robotics are the future. For that purpose, we have coupled a feedback
controller (Arduino) with a couple of motors and a drive train and with the help of
different sensor, the robot can follow and stop following an object automatically.
8
CHAPTER 2
2 METHODOLOGY
This chapter provides a better understanding of all the engineering terms that will be
used through-out the report. It is to give reader a better judgement on the analysis of
the wing
2.1.2 IC L293D
The L293D is a dual H-bridge motor driver IC (Integrated Circuit). This motor driver
IC acts as a current amplifier as it takes low current control signals and provides
higher current signals. This higher current signal is utilized to run the motor. The IC
9
L293D consists of two built-in H-bridge driver circuits. The common mode of in its
operation, two DC motors can be operated concurrently both in forwards and
backward direction. The operation of the two motors can be regulated by input logic
pin 2,7 and 10,15. The input logics 00 or 11 will pull up the corresponding motor. The
input logics 01 and 10 will rotate the motor in clockwise and anticlockwise directions
sequentially. The enable pin 1 and 9 (like 36 for two motors) must be high for two
motors to start working. When the enable input pin is high, the correlated driver
becomes enabled. As a result, the output gets activated and work in phase with its
input. When the enable input pin is low, the driver is disabled, and its output is off and
in the high impedance state.
10
The ultrasonic sensor (HC SR04) is a four pins module as shown in Fig 3.5 above
whose pin names are Vcc pin, Trigger pin, Echo pin, and Ground pin sequentially.
This sensor is the most famous sensor applied to various purposes where distance
measurements or sensing elements are needed. This sensor (HC SR04) has two
devices like a human eye which acts as an ultrasonic transmitter and receiver. This
sensor acts with easy high school formulas that are
Now, we measure the distance by utilizing the formula above and have to know the
speed and time. Whereas we are utilizing the ultrasonic wave we know the general
speed of the ultrasonic wave at room conditions that is 330 m/s. The device built-in on
the module that will measure the time taken for the ultrasonic wave to get back and
witch on the echo pin high for that equal certain amount of time. In this way, we can
also realize the time taken. Now we can easily measure the distance by utilizing a
microcontroller or microprocessor.
11
more sizable voluminous portion of the gear additional turns the more minuscule
twice port. The compressed twice port receives the torque but not the haste of its
ancestor which shifts to a more sizable voluminous part of other gear and so on. The
third gears twice part has more teeth than others and so it adds extra torque to the gear
that is attached to the shaft.
2.1.5 Wheel
A wheel is the main components to move an object adherent robot. Here we utilize
plastic wheel covered by quantifying rubber tire whose diameter is 1.65" (42 mm) and
it is set the output shafts on our gear motors. Those gear motors should mount on the
side of the hub with the overhanging teeth. The output shaft will shift into the socket
easily at first but achieve a snug fit when pushed through the other side of the hub.
12
2.1.6 Robot Chassis
Chassis play a vital role to hold all hardware of Object follower such as
microcontroller, power unit, motor, motor driver, etc. For this project, there used
chassis which is known as magician chassis because it is suitable for all types of
mobile robot hardware. The Chassis is the latest robot platform from Dagu. It can
hold a couple of gear motors with 65 mm wheels and a ball caster. The chassis plate is
made of acrylic with a spacious range of mounting slots or holes for controllers,
sensors, motor drivers, battery, camera etc. We can easily bolt the two pre-cut
platforms mutually and possible to attach some desired robotics controller. This
chassis can hold 4x AA battery holder and have sufficient space to keep any other DC
battery
13
Figure 7: Jumper Cables
Soldering Iron
Glue gun
Wire Cutter
Knife
Digital Multimeter
Screwdriver
Tweezer
14
CHAPTER 3
15
3.2 Arduino Programming
The basic logic for the working of ultrasonic sensors can be described using the
following diagram
#include<NewPing.h>
#include<Servo.h>
#include<AFMotor.h>
#define RIGHT A2
#define LEFT A3
#define TRIGGER_PIN A1
#define ECHO_PIN A0
16
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);
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;
void setup() {
Serial.begin(9600);
myservo.attach(10);
myservo.write(pos);
delay(15);
myservo.write(pos);
delay(15);
myservo.write(pos);
delay(15);
pinMode(RIGHT, INPUT);
pinMode(LEFT, INPUT);
void loop() {
delay(50);
Serial.print("distance");
Serial.println(distance);
Serial.print("RIGHT");
Serial.println(Right_Value);
17
Serial.print("LEFT");
Serial.println(Left_Value);
Motor1.setSpeed(120);
Motor1.run(FORWARD);
Motor2.setSpeed(120);
Motor2.run(FORWARD);
Motor3.setSpeed(120);
Motor3.run(FORWARD);
Motor4.setSpeed(120);
Motor4.run(FORWARD);
Motor1.setSpeed(200);
Motor1.run(FORWARD);
Motor2.setSpeed(200);
Motor2.run(FORWARD);
Motor3.setSpeed(100);
Motor3.run(BACKWARD);
Motor4.setSpeed(100);
Motor4.run(BACKWARD);
}else if((Right_Value==1)&&(Left_Value==0)) {
Motor1.setSpeed(100);
Motor1.run(BACKWARD);
Motor2.setSpeed(100);
Motor2.run(BACKWARD);
Motor3.setSpeed(200);
Motor3.run(FORWARD);
Motor4.setSpeed(200);
Motor4.run(FORWARD);
}else if((Right_Value==1)&&(Left_Value==1)) {
Motor1.setSpeed(0);
Motor1.run(RELEASE);
Motor2.setSpeed(0);
Motor2.run(RELEASE);
Motor3.setSpeed(0);
Motor3.run(RELEASE);
18
Motor4.setSpeed(0);
Motor4.run(RELEASE);
Motor1.setSpeed(0);
Motor1.run(RELEASE);
Motor2.setSpeed(0);
Motor2.run(RELEASE);
Motor3.setSpeed(0);
Motor3.run(RELEASE);
Motor4.setSpeed(0);
Motor4.run(RELEASE);
19
CHAPTER 4
4 RESULTS
In this project, the object following robot has been made to follow the object or
human. This robot has an ultrasonic sensor which detects the object and sends the
information to the comparator (L293D) and H-bridge which controls the process of
the wheels and microcontroller controls the whole operation. The object following
robot was lastly finished by a lot of effort. For this robot, we spent a lot of time in
designing, implementing, writing, and debugging the code sitting in front of the
computer. The robot was eventually working with a little error hither and thither.
which were sorted in the later reviews of the firmware. The object following robot has
a few weaknesses yet but gains most of the purposes.
20
CHAPTER 5
5 CONCLUSION
Today we are in the world of robotics. Knowingly or unknowingly, we have been
using different types of robots in our daily life. In this project, we have planned an
object follower robot. This robot does not require any remote controller like GSM,
Wi-Fi, Bluetooth, driver etc. It will automatically be run with tracking an object or
human. This robot is affordable but highly effective for the different purpose. Our
project can be utilized in many areas like delivering medicine in hospitals, delivering
products in several places, spying, and inspection and so on. In the future, we can
attach various sensors and cameras to get more features. In this way, we believe that
our project will be helpful for many purposes & hence our purpose will be successful.
21
References
1. (Shahid, 2021) “Human Following Robot Using Arduino”
2. Hassan, M. S., Khan, M. W., & Khan, A. F. (2015). Design and Development of Human
Following Robot. Student Research Paper Conference, 2(15), 79–86.
22