Object Following Robot
Object Following Robot
Submitted By;
Submitted to;
Preston University
Islamabad Campus Kohat
(2018)
I
II
DECLARATION
This is to certify that the thesis entitled Object Following Robot submitted
by Khuram Shahzad (Reg# 1450-116009) in partial fulfillment of the
requirements for the award of Master in Electronics in the department of
Electronics, Preston University Islamabad is an authentic work carried out under
my supervision and guidance.
To the best of my knowledge, the matter embodied in the thesis has not been
submitted to elsewhere for the award of any degree.
_____________________________
Prof. Dr. S.TauseefUrRehman
Faculty of Technology
Preston University
Islamabad Campus, Kohat
______________________
Prof. Syed Shahid Afzal
Dean, Faculty of technology
Preston University
Islamabad Campus, Kohat
I
ACKNOWLEDGEMENT
All praise to the almighty ALLAH, who deserves all praises alone. It is only
His blessing, which enable us to reach this level of knowledge in our field.
I am greatly thankful to all the staff members of the department and all my
well-wishers, class mates and friends for their inspiration and help.
Lastly, I sincerely thank to all those who have directly or indirectly helped
for the work reported herein.
_____________________________
KhuramShahzad
Registration NO: 1450-116009
Faculty of Technology
Preston University
Islamabad Campus, Kohat
II
Abstract
New Robotics designates an approach to robotics that, in contrast to
traditional robotics, applies ideas and principles from biology. While in the
traditional approach there are generally accepted methods (e.g. from control
theory), designing agents in the New Robotics approach is still widely considered
as an art. In recent years, experts have been developing a set of design principles
that on the one hand, capture theoretical insights about intelligent adaptive
behavior and on the other provide guidance in actually designing and building
systems. In this paper we provide an overview on the principles which concern the
relation between environment, morphology, materials, and control, and “sensory
motor Coordination. It concerns self-generated sensory stimulation as the agent
interacts with the environment and which is a key to the development of high-level
intelligence. But practical approach is taken more.
III
Table of Contents
IV
Chapter 5 CIRCUIT DETAIL ...................................................................................................... 25
5.1 Programming of Arduino; ................................................................................................... 25
5.2 Pixy connections; ................................................................................................................ 26
5.3 Ultrasonic module connections; .......................................................................................... 26
5.4 Driver module connections; ................................................................................................ 26
5.5 PCB designing and Etching; ............................................................................................... 26
5.2 Code; ................................................................................................................................... 28
Chapter 6 TOOLS AND EQUIPMENTS ..................................................................................... 34
6.1 Hard tools; ........................................................................................................................... 34
6.1.1 Mini bread board; ......................................................................................................... 34
6.1.2 Soldering Iron; ............................................................................................................. 35
6.1.3 Internet PC; .................................................................................................................. 35
6.1.4 Wire stripper & cutter; ................................................................................................. 36
6.1.5Multimeter; ................................................................................................................... 36
6.2 Soft tools; ............................................................................................................................ 37
6.2.1 Proteus professional; .................................................................................................... 37
6.2.2 Microsoft Office Word; ............................................................................................... 38
Chapter 7 CONCLUSION & ADVAMCEMENTS ..................................................................... 39
7.1 Possible modifications; ....................................................................................................... 40
Chapter 8 REFERENCES ............................................................................................................ VII
V
Table Of Figures
VI
Chapter 1 INTRODUCTION
World is now going to automations and
system are controlled automatically. Automatic systems use different types of sensors to control
its variables and parameters for its proper functions.
In ancient days, the focus was oncontrolling. Now therehas been enhancing interest in
adaptivity.
First major purpose is todevelop the useful design but it’s not the ending. The main thing
is that it has a better understanding about the principle. Experiences have shown thatbuilding a
robotic model considerablyenhances our understanding power.
A thirdapproach is the consideration about the smart performance, which is the major
topic of concern.
In count, much of the efforton manipulative adaptive schemeson software that isthe
programming of the robotic system butthe programming aspects are not only importantbut
designing the entire system is also important.
Infect most of the prose isalmost programming but some of the exploration precisely
connected with the whole structure and includefeatures of analysis.
Interference in image.
Shape of object.
A most advanced type of automatic system is robotics. It may be defined as the current
culmination of advanced development. Robotics is a science of continuing advancements of
mechanical engineering, material designing, sensing techniques using advanced algorithms.
Robotics can be defined as the science of the automations. In all fields of industry, now
robots are used as major part of automation system.
In automobile industry, robots are used for making parts, binding different parts of
automobile and also tightening the bolts to a fixed level of torque.
1.1 Sensing
First of all, robot would have to be able to sense its surroundings. It would do this
in different ways according to its environment. Robot may use different types of sensors: light
sensors, touch sensors, pressure sensors, ultrasonic sensors for awareness of its environment.
Some advanced types of sensors are PIR(passive infrared), microwave and tomographic
motion detectors etc.
2
1.2 Movement
A robot must be able to move its parts or itself according to its function
and working. The robot is object tracking so it must be able to move for tracking the specified
object.
1.3 Energy
1.4 Intelligence
3
Chapter 2 DESIGNING THEORY
Opposite to engineering design situation we
do not have industrial designing concepts. So design of a multipurpose robot consists of ordinary
things. The design of object following robot consists of many thing including mechanical
structure, electrical equipment, soft code and others.
Designs are made according to requirements. General purpose robots have general
designs. Industrial robots are because industrial requirements are different.
We have an ordinary design because our robot is dedicated and only a project in which
we have to show our capabilities, our potential and ability, our skills and efficiency and
competency.
The design theory has some fundamental steps. Complete and detailed study of
environment in which the robot is made and used is most important. The theory helps to
implement and to improve the quality of function of any system.
There are two different principles of designs named ‘designing principles’. They are
involved in general aspects of approach. Another is concerned with more near approach to real
design.
Due to lack of time, we used second set of principles that is speedier but less affective.
Some more principles to understand designing procedure are discussed here briefly.
Thesesteps are adopted by no means they areseparate. They are dependent to each other,
but it isvaluable to taste them apart for the determination of systematicinvestigation. Note it is
4
dependent to the principle ofdevelopment. If a time perspective can be ellaborated as
beingderived from another, we have a deeper kind of elaboration.
Although it assumes accessible that people lookdifferent to a robot than to a human as the
robot hasentirely different sensing structures than a human. Second, actioncannotbe entirely
captured, but is always the result of anenvironment system involvement.
The involvement of the situation plays animportantpart in the comportment and therefore
in the methods in whichthe elaboration is identified by aspectator.
We collected data from different sources as available in many kinds like books, internet
and friends that are keen to apply their knowledge in practical life.
After the design completed, the corrective approach is applied to design to make it error
less and more close to our assumptions.
5
Chapter 3 MECHANICAL REQUIREMENTS
There are some thing
used in its mechanical structure as supporting elements like For/Rev smart robot car chassis kit
that consists of tires, supporting rods and a platform joined by screws and bolts. The description
of each element is given below.
Chassis; 2 pcs
Fastener; 8 pcs
Separators; 6 pcs
The chassis is the main requirement for rover to move. This is the mechanical system that
is responsible to move and will follow the object in our object following robot system.
The ‘chassis kit’ as from its name, has many parts in discrete and are assembled using
screws. Motors are stuck by using fasteners. Wheels are directly connected to motors one for
each. Sometimes wheel codes are used on other side of motors for speed observations. The
chassis is shown.
6
There are four chassis wheels are used in the mechanical structure of this robot given as
under.
There are 6 separator pieces used to separate and bind the both chassis. Separator makes
the chassis a complete robot car.
There are four motors are used in the chassis to control the movement of car in different
directions. Each motor has two connection pins which are connected to a driver circuit. Four
motors make the car jerk resistant and keep the balance of car.
7
All parts of chassis are self-assembled. We studied the manual of this chassis and then
applied that information to assemble the car. There are many types of chassis available in market
like 3 wheels, 4 wheels and in different shapes. We used the 4 wheel chassis. The complete
assembled chassis is shown below.
8
Chapter 4 ELECTRICAL REQUIREMENTS
Many elements and
entities are used in robot as required for its structure like sensors, pixy cam, motors, and motor
driver circuit and Arduino board. Detail of each element is given with quantity;
Pixy cam 1
Motors 4
Pixy cam CMU5 is used for object sensing and Ultrasonic sensors to avoid obstacles.
CMU5 pixy cam is a very faster cam that takes the images of objects fifty times in a
second (20ms) and its module sends signals of that images. Its rate of image taking is enough to
sense an object for tracking.
Processing and decision making unit make decisions when any input it receives from
sensor.
Motor driving (LM298) unit is like an interface between low output of processing module
and high power motor as processing module cannot drive motor directly.
Motors are the final control elements that are responsible for the movement of robotic
system.
9
4.1Pixy Cam;
Pixy cam is a fast optic sensor and can be easily coach to find objects. It can be
connected directly toanArduino and other microprocessors.
10
Pixycampractices a chroma based huepurifying scheme to sensearticles.
Pixy detects the color and concentration of all RGB pixel from the image sensor
and uses this informationby way ofthe fundamental framework.
It recognizes up to seven distinct huesigns. Ifadditional than seven is need, color
codes maybe used.
This cam can catch precisely hundreds of entities at a while.
It processes whole image of 320x200frame every 20m of a second.
We can get a comprehensiveinformation of sensedobject’slocations every 1/50 of
a second.
This cam is distinctivefor the reason that you can actuallyclarify it what you are
attentive in detecting.
11
Figure 4-2 Labeled back view
12
4.1.3 UART;
UART interface provides 8 bits of data and 1 bit of stop, with no parity and no
handshaking signal. The rate maybe organized in the Interface tab of the “Configure Parameters
dialog” in PixyMon. Pin#1 isRXindication of 5V input. Bit#4 isTXpointer 0 to 3.3V of output.
Baud rates up to 230 kbaudaremaintained.
4.1.4 SPI;
The SPI interface works as a slave. It is deliberate for the Arduino's ICSP port. The
default data speed is 1 mbps, but this can be augmented by altering the Pixy.hfile(library of pixy
cam) in theArduino’s library. Thisproceduretakes checksums to reduce bit faults.
4.1.5 𝐈 𝟐 C SCL;
The I C bus as two lines; a serial data (SDA) and a serial clock (SCL). AllI C devices
uses only these two lines for data communication. Each of thedevice may be a transmitter, a
receiver or both. Masters devices produce line clock and starts communication on the data line,
others devices are slave and responsible to respond the instructions. To interconnect with specific
device, each slave device should have aunique address butI C master devices do not require any
address because slave device does not send commands to the master device.
The I C address bus can be configured by using Interface tab of the “Configure
Parameters” dialog in PixyMon.
4.1.6 5V (in/out);
4.1.7 GND;
Ground is used for reference required for power as well as signal cables.
13
4.1.8 PixyMon;
The Arduino boards are designed for students and keen of programming.
Arduino has made programming very easier and friendlier to students. Arduino boards are very
simple to use. All small electronic projects can be made by Arduino boards with simple
programming. I also used an Arduino pro mini board for my project of “object following Robot”.
The figure of Arduino pro mini board is given below.
14
Arduino pro mini board is a microprocessor based environment using ATmega328p and
has fourteen digital input and output buses. We can use 6 of pins to get PWM. It has 6 analog
input pins as well as a reset button. Its layout is compatible with Arduino mini.
Microcontroller; ATmega168
Flash memory; 16KB
SRAM; 1KB
EEPROM; 512 Bytes
Voltage; 3.3/5V
Digital I/O; 14 including PWM 6 pins
Analog input pins; 8
Current per pin; 40mA
Clock speed; 8MHz for 3.3V board and 16MHz for 5V board
15
Pin # A1; A1/D15/Analog I/P pin
Pin # A2; A2/D16/Analog I/P pin
Pin # A3; A3/D17/Analog I/P pin
Pin # A4; Analog I/P pin/I C SDA
Pin # A5; Analog I/P pin/I C SCL
Pin # A6; Analog I/P pin
Pin # A7; Analog I/P pin
Pin VCC; Power supply of board, 3.3/5V as per board required
Pin RST; Reset (Active Low)
Pin GND; Ground
Pin RAW; For supplying a raw (regulated) voltage to the board
Pin TX; to transmit TTL serial data
Pin RX; to receive TTL serial data
The major advantage of this board is less size and small power consuming ability. It uses
5V to power it. Arduino pro mini is powered by Atmega328p.
4.3 Motors;
There are four DC motors used in the development of mechanical assemblyof this
rover each of which operated individually. Motors are the final control elements which controls
the position and direction of movement of robot. Arduino board sends the PWM signals to the
L298N bridge module which finally empower the signal so that it can drive the motors. Each
motor has two pins that circulate the current to the motor. Each motor can be operated in forward
as well as reverse direction. The view of motor is given.
16
Figure 4-4 Geared Motors
Volts; 3-6V DC
Current; 120mA
Weigh; 50g
Size; 70mm×18mm×22mm
17
Figure 4-5 Ultrasonic Module/Sonar
Model; HC-SR04
Input Power; 5V DC
Frequency; 40kHz
18
GND; reference pin
4.1.1 Working;
The basic principle of work is that a trigger pulse is sent to the module at trigger
pin for at least 10microseconds by Arduino. This module then sends a burst of eight pulses of 40
KHz and receives echo pulse if an object is present in its range. The received pulse duration
describes the range of detected object.
This module should not be directly connected to supply. The ground terminal should be
connected first, otherwise it may affect the normal working of module.
19
4.5 Motor driver L298N;
There is also a built in regulator which provides 5V, hence if sourcepower up to 12V, 5V
may be taken from this panel.
20
Pin#1; DC motor +1 or stepper motor A+
Pin#3; 12V jumper. Eliminate this jumper if consuming a source voltage more
than 12V DC to enable built in 5V regulator.
Pin#4; Motor poweringvoltage, max of 35V DC. Eliminate 12V jumper if supply
is greater than 12V DC.
Pin#5; GND.
Pin#7; DC motor 1 enable jumper. Leave this in place when using a stepper
motor. Connect to PWM output for speed control of DC motor.
Pin#12; DC motor enable jumper. Leave this in place when using a stepper motor.
Connect to PWM output for controlofDC motor.
Module; L298N
21
Input and enable voltage; -0.3 to 7V
DC operation current; 2A
Now, connect it to power, positive pin to pin number 4 and negative to pin#5. If your
supply is less than or equal to 12V, leave in the 12V jumper and 5V will be available from pin 6
on board. Two PWM pins (available on Arduino board) may be used to control DC motors. Now
program Arduino to run motor.
Use analog Write(pin#, PWM) instead of digitalWrite(pin#, H/) to control the speed of
DC motors.
22
Figure 4-8Dry Battery
23
Figure 4-9 M-F Jumper wire
24
Chapter 5 CIRCUIT DETAIL
Complete circuit of Project and detail is provided in
this chapter. Pixy cam senses the color of object and sends signals to Arduino. Arduino checks
this signal and takes decisions on the basis of signal either to move or stop. Arduino also takes
decisions either to move forward/reverse or left/write. Ultrasonic sensor also sends signals to
Arduino to save form obstacles collisions. The diagram is shown.
Five pins of Arduino (shown at upper side of board) are used for programming of board.
These are TXD, RXD, Reset, VCC, GND.
25
5.2 Pixy connections;
Pixy has a built in ISP connector for powering and collecting data. We have used only
five pins. These pins are 1, 2, 3, 4, 6. Pin 2 and 6 are VCC and GND respectively. Pin 1, 3, 4 are
connected to a digital pins of Arduino board that are MIS, SCK and M09 respectively.
VCC and GND pins are attached to respective pins of board. Echo pin is connected to A2
pin of Arduino board. Trig pin is not connected.
The driver module is connected to I/O pins. There are six pins of module that should be
connected to the Arduino for forward and reverse control of motors. The six pins are 7, 8, 9, 10,
11, 12. These are connected to 9, 8, 7, 5, 4, 3 respectively. Pin 7 and 12 are enabling pins that are
connected to Vcc of module by using jumper for full speed. If speed is controlled, then these are
also connected to Arduino or other controller for PWM.
PCB designing require some hard as well as soft tools. With the help of Proteus software,
design is made and sketch drawn. By the function of auto routing of wires, layout is made. It is
then printed on a paper and pasted on copper sheet. After the sketch drawing, this piece of
copper sheet is dipped into copper sulphate solution. This process is called etching.
26
Figure 5-2 PCB Layout
After etching process, components are soldered on board. All the components are added
and connected and then checked and verified.
27
5.2 Code;
#include <SPI.h>
#include <Pixy.h>
int enb2 = 3 ;
int in4 = 4 ;
int in3 = 5 ;
intbuz = 6 ;
int in2 = 7 ;
int in1 = 8 ;
int enb1 = 9 ;
///////////////////////////////////
//////////////////////////////////
//////////////////////////////////
//////////////////////////////////
void setup(){
28
// define pin ststus
pinMode(enb2,OUTPUT);
pinMode(in4,OUTPUT);
pinMode(in3,OUTPUT);
pinMode(buz,OUTPUT);
pinMode(in2,OUTPUT);
pinMode(in1,OUTPUT);
pinMode(enb1,OUTPUT);
//////////////////////////////
Serial.begin(9600);
pixy.init();
///////////////////////////////////////////////
// Motor function
digitalWrite(in1,a1);
digitalWrite(in2,b1);
digitalWrite(in3,a2);
digitalWrite(in4,b2);
//////////////////////////////////
29
voidmove_forward(){ // move forward
motor(1,0,0,1);
motor(0,1,1,0);
motor(1,0,0,0);
motor(0,0,0,1);
motor(1,0,1,0);
motor(0,1,0,1);
motor(0,0,0,0);
//////////////////////////////////
voidmotor_speed(intlms,intrms){
analogWrite(enb1,lms);
30
analogWrite(enb2,rms);
///////////////////////////////////
void loop(){
// switch mode
uint16_t blocks;
charbuf[32];
// grab blocks!
blocks = pixy.getBlocks();
if (blocks){
// object x position
x_pos = pixy.blocks[0].x;
// object width
width = pixy.blocks[0].width;
if(x_pos>=150 &&x_pos<=170){
left_speed =255;
31
right_speed =255;
if(x_pos<=150){
left_speed = x_pos/3*5;
right_speed = 255;
if(x_pos>=170){
right_speed = right_speed/3*5;
left_speed = 255;
motor_speed(left_speed , right_speed);
Serial.print(left_speed);
Serial.print(" ");
Serial.print(right_speed);
if(width<=99){
move_forward();
Serial.print(" ");
Serial.println("forward");
delay(100);
if(width>=100){
move_back();
Serial.print(" ");
Serial.println("reverse");
32
delay(500);
}else{
motor_speed(0,0);
motor_stop();
33
Chapter 6 TOOLS AND EQUIPMENTS
There are many tools are used to
develop the circuit of robot. We divide them in mainly two categories, hard tools and soft tools.
Hard tools are used in hardware assembly and soft tools are used in soft way. Description of each
is given.
Various hard tools are used in assembling of this robot like soldering iron and PC
etc. some are given below.
Mini bread board is used for rough assembling and rough testing of components and
devices.
34
6.1.2 Soldering Iron;
Internet PC is used to get basic ideas and knowledge about robots. It is also used to
download datasheets of components. It is also used in circuit designing and in PCB layouts.
Finally, thesis is also written with the help of PC.
35
6.1.4 Wire stripper & cutter;
6.1.5Multimeter;
Multimeter is a main tool of Electronic and electrical departments. About on each step,
multimeter is used. It is used to check components. Outputs of modules are also checked with the
help of multimeter.
Figure 6-5Multimeter
36
6.2 Soft tools;
Proteus professional is used for making the design of PCB for project. A sketch of
proteus software is shown.
37
Figure 6-7 PCB Layout
38
Chapter 7 CONCLUSION & ADVAMCEMENTS
A subject
of robotics trains and educates in the field of artificial intelligence, computer aided designing,
integrated system, computational algorithms, robot motion capturing, digital electronics and
micro processing.
This robot helped us to understand the automation of systems. This project of Object
following robot taught us how basic robotic system worked.
This rover helped us to understand the how to control things, working automatic.
In this robot, more modules can be added to modify it. Bluetooth module maybe used to
control the robot by mobile in low range. Wi-Fi module can be used to extend its range.
This robot can be modified for auto driving using different types of module. These
modules include GPS module for directions, ultrasonic sensor module to avoid the chance of
accidents, motion sensors to detect the motion and direction of motion, color sensors to control
speed in populated and unpopulated areas, to sense traffic signals and more etc.
This robot can be used in automated supervision i.e. controlling any picture to
sensedoubtfulhappenings or unlikely circumstances.
This rover is an idea of vehicle tracking that is movie based reverseforecasting and
hurdleescapingabilities.
39
I consider that this article is a good survey on object tracking with well-heeled material
contents can give appreciatedvision into research topics and inspire new research.
Fine tuning variables to produce improved and sensitive real time tracking.
Modify system to make it capable to track two or more objects at same time with
accurate measures.
Bluetooth module can be installed to control wirelessly.
40
Chapter 8 REFERENCES
VII