0% found this document useful (0 votes)
80 views

Object Following Robot

This document presents the design of an object following robot. It discusses the mechanical, electrical, and programming requirements. The robot uses a Pixy camera for object detection, an Arduino microcontroller for processing, DC motors for movement, and an ultrasonic sensor for obstacle avoidance. It is powered by batteries. The design aims to allow the robot to autonomously follow objects by processing input from the camera and sensor and controlling the motors accordingly.

Uploaded by

Khuram Shahzad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
80 views

Object Following Robot

This document presents the design of an object following robot. It discusses the mechanical, electrical, and programming requirements. The robot uses a Pixy camera for object detection, an Arduino microcontroller for processing, DC motors for movement, and an ultrasonic sensor for obstacle avoidance. It is powered by batteries. The design aims to allow the robot to autonomously follow objects by processing input from the camera and sensor and controlling the motors accordingly.

Uploaded by

Khuram Shahzad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

OBJECT FOLLOWING ROBOT

Submitted By;

Khuram Shahzad (1450-116009)

Submitted to;

Dr. S.Tauseef Ur Rehman

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.

It gives me immense pleasure to express my deep sense of gratitude to my


supervisor Prof. Dr. S.Tauseef Ur Rehman for his invaluable guidance,
motivation, constant inspiration and above all his ever co-operating attitude
enabled me in bringing up this thesis in present elegant form.

I am extremely thankful to Head, Department of Electronics and the faculty


members of Electronics Department for providing all kinds of possible help and
advice during this work. it is a great pleasure for me to acknowledge and express
my gratitude to my parent for their understanding, unstinted support and endless
encouragement during my study.

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

Chapter 1 INTRODUCTION .......................................................................................................... 1


1.1 Sensing .................................................................................................................................. 2
1.2 Movement ............................................................................................................................. 3
1.3 Energy ................................................................................................................................... 3
1.4 Intelligence ............................................................................................................................ 3
Chapter 2 DESIGNING THEORY ................................................................................................. 4
2.1The time perspective principle; .............................................................................................. 4
2.2 The principle of frame oforientation; .................................................................................... 5
Chapter 3 MECHANICAL REQUIREMENTS ............................................................................. 6
Chapter 4 ELECTRICAL REQUIREMENTS................................................................................ 9
4.1Pixy Cam;............................................................................................................................. 10
4.1.1 Key Features; ............................................................................................................... 10
4.1.2 Pixy overcomesdualdifficulties;................................................................................... 11
4.1.3 UART;.......................................................................................................................... 13
4.1.4 SPI; ............................................................................................................................... 13
4.1.5 𝐈𝟐C SCL;...................................................................................................................... 13
4.1.6 5V (in/out);................................................................................................................... 13
4.1.7 GND; ............................................................................................................................ 13
4.1.8 PixyMon;...................................................................................................................... 14
4.2 Arduino pro mini; ............................................................................................................... 14
4.3 Motors; ................................................................................................................................ 16
4.4 Ultrasonic HC-SR04 module; ............................................................................................. 17
4.1.1 Working; ...................................................................................................................... 19
4.1.2 Timing Control; ........................................................................................................... 19
4.5 Motor driver L298N;........................................................................................................... 20
4.5.1 Controlling of DC Motors;........................................................................................... 22
4.6 Battery and power; .............................................................................................................. 22
4.7 Male-female jumpers and wires; ......................................................................................... 23

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

Figure 3-1 Chassis .......................................................................................................................... 6


Figure 3-2 Tire of Chassis .............................................................................................................. 7
Figure 3-3 Chassis Assembling ...................................................................................................... 7
Figure 3-4 Assembled Chassis ........................................................................................................ 8
Figure 4-1 Pixy Cam Front view .................................................................................................. 10
Figure 4-2 Labeled back view ....................................................................................................... 12
Figure 4-3 Arduino pro mini......................................................................................................... 14
Figure 4-4 Geared Motors ............................................................................................................ 17
Figure 4-5 Ultrasonic Module/Sonar ........................................................................................... 18
Figure 4-6 Timing Diagram.......................................................................................................... 19
Figure 5-1 Complete Circuit Diagram ......................................................................................... 25
Figure 5-2 PCB Layout ................................................................................................................. 27
Figure 5-3 Layout ......................................................................................................................... 27
Figure 6-1 Mini Bread Board ....................................................................................................... 34
Figure 6-2Soldering Iron .............................................................................................................. 35
Figure 6-3 Internet PC.................................................................................................................. 35
Figure 6-4 Wire Stripper .............................................................................................................. 36
Figure 6-5Multimeter.................................................................................................................... 36
Figure 6-6 Proteus professional ................................................................................................... 37
Figure 6-7 PCB Layout ................................................................................................................. 38
Figure 6-8 MS word ...................................................................................................................... 38
Figure 7-1 Bluetooth Module........................................................................................................ 40
Figure 7-2 Wireless Module ......................................................................................................... 40

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 automatic systems, tracking and sensing is a problem to generate an interface about


motion of object. If we can track a moving object accurately, then we can make an accurate
record of its motion. Once a record is made, it might be used to drive any process. We can
modify the motion record to obtain slightly different motions.

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.

Three steps are more important to in the analysis attitude. It includes

A) Finding of moving stuffs of attention


B) Pursuing of the objects frame by frame
C) Andinvestigation of objects to identify itsperformance.

Tracking objects may be complex due to some reasons given below;


1
 Loss of dataproduced by estimate of the 3D domain on a 2D image.

 Interference in image.

 Gesture of the item.

 Shape of object.

 Change in enlightenment of scene.

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.

Briefly, robotics is a scientific field related to advancements of knowledge.

A robot has these basic essential parts:

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

A robot must be powered by some type of power source. Battery, solar


power, electrical line power may be used to power the robot for its functioning.

1.4 Intelligence

A robot should have artificial intelligence. For this purpose, a controller


may be used. It is the part of robot where it takes decisions depending upon the input structure.
Controller is programmed to make decisions. It may be called as brain of robot.

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.

2.1The time perspective principle;


A simple elaboration of behavior of any systemmust
combine three steps;

 Condition oriented, means “here and now”


 Learning and implementations
 Evolutionary attitude

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.

2.2 The principle of frame oforientation;


Three forms are here to differentiate, whenever
planningany system:

(a) The aspect, i.e. about the viewer’s, or originator’seye

(b) Performance is not reducible to insideapparatus

(c) Affectively, the compositeconduct of an objectdoes not suggestdifficulty of the


system.

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

 Universal wheels; 4 pcs

 Speed encoders; 4 pcs

 Fastener; 8 pcs

 Separators; 6 pcs

 Various nuts and bolts

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.

Figure 3-1 Chassis

6
There are four chassis wheels are used in the mechanical structure of this robot given as
under.

Figure 3-2 Tire of Chassis

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.

Assembling figure of chassis;

Figure 3-3 Chassis Assembling

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.

Figure 3-4 Assembled Chassis

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

 Arduino board Pro mini 1

 Motors 4

 Ultrasonic sensor module 1

 Motor driving module 1

 Mini bread board 1

 Battery and charging supply 1

 Female and male jumpers header terminals -

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.

Ultrasonic sensor module (HC-SR04) is used for taking information of obstacles. It is


used to avoid the accident of robot to anything. Sensors of other types may also be used here to
sense any object.

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.

It processes images byinstrumentanddirects the suitabledata to a microprocessor. Thisdata


is accessiblethrough one ofnumerousborders like UART, SPI, I C outputs, or analog outputs.
Arduino or microprocessors can communicatedefinitely with Pixycam and still have enough of
microprocessorfreefor other processing.

Figure 4-1 Pixy Cam Front view

4.1.1 Key Features;

The key features of Pixy Cam are;

 It is a fast camera as required. It captures 50 images in a second and process in


real time as well.

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.

4.1.2 Pixy overcomesdualdifficulties;

1. Image detectors produce data of MB/s.


2. Treating of this statistics requires many CPUs but by
couplingaauthoritativedevotedmainframe with the image detector is used to
address this problem.

The specifications of cam CMU5 are given under.

 Input power; 5V or unregulated 6V TO 10V


 Current consumption: 140 mA typical
 Statisticsproductions; UART sequential, SPI, I C, USB, digital, analog
 Flash; 1MB
 RAM; 264KB
 Lens viewing degrees; horizontal:75 degrees, vertical:47 degrees
 Type of Lens: typical M12 size but numerousdissimilarkindsareoffered
 Dimension (size) of lens: 2.1” x 1.75” x 1.4”

The labeled back side view of pixy cam is given.

11
Figure 4-2 Labeled back view

The pin name and functions of pixy is provided below.

1 SPI MOSI, UART, GP100


2. 5V (in/out)
3. SPI SCK, GP101
4. SPI MISO, UART, GP102
5. 12C SCL
6. GND
7. SPI SS, ADC IN, GP103
8. GND
9. 12C SDA
10. GND

The brief detail of some is provided here for acknowledgement.

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);

This is the power needed to work.

4.1.7 GND;

Ground is used for reference required for power as well as signal cables.

13
4.1.8 PixyMon;

PixyMon is an application software to run pixy on PC. It allowsvisualizing the Pixy


camera video. This video may be unprocessed or sorted out. Itlets us to configure Pixy.We can
set the output port and can addhuesigns. PixyMon communicates with Pixy viatypical mini
USBpot.

4.2 Arduino pro mini;

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.

Figure 4-3 Arduino pro mini

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.

Arduino specifications are provided here.

 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

The pin configuration of Arduino pro mini board is given under.

 Pin TX0; D1/Data Bus


 Pin RX1; D0/Data Bus
 Pin # 02; D2/Data Bus
 Pin # 03; D3/Data Bus/PWM
 Pin # 04; D4/Data Bus
 Pin # 05; D5/ Data Bus/PWM
 Pin # 06; D6/ Data Bus/PWM
 Pin # 07; D7 Data Bus
 Pin # 08; D8Data Bus
 Pin # 09; D9/ Data Bus/PWM
 Pin # 10; D10/PWM/SPI SS
 Pin # 11; D11/PWM/SPI MOSI
 Pin # 12; D12/SPI MISO
 Pin # 13; D13/SPI SCK
 Pin # A0; A0/D14/Analog I/P pin

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

Motor specifications are given;

 Volts; 3-6V DC

 Current; 120mA

 Motor RPM; 240

 Weigh; 50g

 Direction; 2 way For/Rev

 Size; 70mm×18mm×22mm

4.4 Ultrasonic HC-SR04 module;

The ultrasonic HC-SR04 module uses sonar to


determine the distance of an object within range of 2cm to 200cm. Sonar is a technique uses
sound waves. It provides excellent noncontact object detection with high level of accuracy within
range. Its operation is not affected by sunlight. This module has a transmitter to send pulses and
a receiver to receive the transmitted pulse called echo.The diagram is shown below.

17
Figure 4-5 Ultrasonic Module/Sonar

The technical specifications of this module are provided below;

 Model; HC-SR04

 Input Power; 5V DC

 Normal Current; less than 2mA

 Working Current; about 15mA

 Frequency; 40kHz

 Effective Angle; less than 15˚

 Range; 2cm to 400cm

 Trigger Input pulse with; 10µs

 Dimension; 45mm × 20mm × 15mm

Pin description of HC-SR04 ultrasonic module is given;

 VCC; power of module +5VDC

 TRIG; input pulse

 ECHO; out of sensor module

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.

Using given formula, we can find the range of object.

Range = high level time * velocity (344M/S) / 2 ………………………..Equation 1

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.

4.1.2 Timing Control;

The timing is most important in controller circuits. The ultrasonic module


also uses timing to send and receive signal. We only have to supply it power and module will
send a signal. This signal is a stream of 8 pulses that is sent in air and module starts the timing.
The echo wave received has a proportion of width and range.

The timing control diagram is shown in figure.

Figure 4-6 Timing Diagram

19
4.5 Motor driver L298N;

The L298N is integrated module circuit in a single package used to


control small DC motors usually used along with Arduino boards. Thismodulepermitsus to
govern the speed as well as direction or to control stepper motor with much ease. This is a dual
motor controller with H Bridge that can provide two amperes of current. The L298N H (bridge
IC) works between 5V to 35V C.

There is also a built in regulator which provides 5V, hence if sourcepower up to 12V, 5V
may be taken from this panel.

Labeled image of L298N module is given below.

Figure 4-7 Driver Module

The pin function is written below.

20
 Pin#1; DC motor +1 or stepper motor A+

 Pin#2; 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#6; 5V output if 12V jumper is in place, ideal for powering Arduino.

 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#8; IN 1to make it 1 or 0/ it decides the direction of motor.

 Pin#9; IN 2, make it 1 or 0/ it decides the direction of motor.

 Pin#10; IN 3, make it 1 or 0/ it decides the direction of motor.

 Pin#11; IN 4, make it 1 or 0/ it decides the direction of motor.

 Pin#12; DC motor enable jumper. Leave this in place when using a stepper motor.
Connect to PWM output for controlofDC motor.

 Pin#13; DC motor +2 or stepper motor B+

 Pin#14; DC motor -2 or stepper motor B-

The technical specifications of this module are provided below;

 Module; L298N

 Power supply; 45V max

 Logic supply voltage; 7V

21
 Input and enable voltage; -0.3 to 7V

 DC operation current; 2A

 Sensing voltage; -1 to 2.3V

 Total power dissipation; 25W

 Junction operating temperature; -25 to 130˚C

4.5.1 Controlling of DC Motors;

To governDC motors is relatively easy. Attach each motor


to A and B pins of L298N unit. If two motors are used for a robot, confirm the polarity of motors
is same on both inputs.

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.

4.6 Battery and power;

Battery is a source of DC power. It stores chemical, not electricity.


It provides electricity by chemical reaction occurring inside the battery.A lead storage battery
can be discharged and recharged many times. Charging and discharging includes a chemical
reaction. The figure of a simple cell battery is given.

22
Figure 4-8Dry Battery

4.7 Male-female jumpers and wires;

Wires are used to connect the points. A jumper


wire also known as jumper cableso-called for its manufacturer is an electrical line or group of
cable with a connector or pin at each end. It is used to connect the entities on a breadboard or in
testing module. It connects one component to other devices or components without soldering.

Figure 4-8 F-F Jumper wire

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.

Figure 5-1 Complete Circuit Diagram

5.1 Programming of Arduino;

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.

5.3 Ultrasonic module connections;

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.

5.4 Driver module connections;

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.

5.5 PCB designing and Etching;

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.

The layouts used in etching process are shown.

26
Figure 5-2 PCB Layout

Figure 5-3 Layout

After etching process, components are soldered on board. All the components are added
and connected and then checked and verified.

After the verification of all components, Arduino is programmed.

Code implemented for this circuit is also provided below.

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 ;

///////////////////////////////////

intx_pos; // object xposition

int width; // object width

intleft_speed ; // left side

intright_speed; // right side

Pixy pixy; // pixy variable

//////////////////////////////////

longrandom_value ; // random value

//////////////////////////////////

//////////////////////////////////

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);

//initialize the variables we're linked to

pixy.init();

///////////////////////////////////////////////

// Motor function

void motor(bool a1, bool b1, bool a2, bool b2){

digitalWrite(in1,a1);

digitalWrite(in2,b1);

digitalWrite(in3,a2);

digitalWrite(in4,b2);

//////////////////////////////////

29
voidmove_forward(){ // move forward

motor(1,0,0,1);

voidmove_back(){ // move back

motor(0,1,1,0);

voidmove_right(){ // turn right

motor(1,0,0,0);

voidmove_left(){ // turn left

motor(0,0,0,1);

voidspin_right(){ // spin right

motor(1,0,1,0);

voidspin_left(){ // spin left

motor(0,1,0,1);

voidmotor_stop(){ // motor stop

motor(0,0,0,0);

//////////////////////////////////

voidmotor_speed(intlms,intrms){

analogWrite(enb1,lms);

30
analogWrite(enb2,rms);

///////////////////////////////////

void loop(){

// switch mode

// get pixy blocks

uint16_t blocks;

charbuf[32];

// grab blocks!

blocks = pixy.getBlocks();

// If there are detect blocks,and no obstacle in range !

if (blocks){

// do this (print) every 50 frames because printing every

// frame would bog down the Arduino

// 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 = 319 - x_pos;

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.

6.1 Hard tools;

Various hard tools are used in assembling of this robot like soldering iron and PC
etc. some are given below.

6.1.1 Mini bread board;

Mini bread board is used for rough assembling and rough testing of components and
devices.

Figure 6-1 Mini Bread Board

34
6.1.2 Soldering Iron;

Soldering iron is used to sold the components on PCB.

Figure 6-2Soldering Iron

6.1.3 Internet PC;

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.

Figure 6-3 Internet PC

35
6.1.4 Wire stripper & cutter;

Wire stripper is used in stripping of wires.

Figure 6-4 Wire Stripper

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;

Some soft tools are also used in assembling of this project.

6.2.1 Proteus professional;

Proteus professional is used for making the design of PCB for project. A sketch of
proteus software is shown.

Figure 6-6 Proteus professional

The PCB layout is also given.

37
Figure 6-7 PCB Layout

6.2.2 Microsoft Office Word;

MS word is used to write the thesis for project.

Figure 6-8 MS word

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 to understand the working, programming, interfacing of different


modules to Arduino.

This rover helped us to understand the how to control things, working automatic.

This project of robot of following objects helped us to understand the rectification


process of error that may cause to fault.

It also helped us to develop ideas to control any system automatically.

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 may be used in human to computer intercommunication, expression detection,


eye lookfollowing for data input to processors etc.

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.

7.1 Possible modifications;

 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.

Figure 7-1 Bluetooth Module


 Wireless module can be installed to increase the wireless range.

Figure 7-2 Wireless Module

40
Chapter 8 REFERENCES

1. Intelligent Optimal Adaptive Control for Mechatronic Systems


2. Modeling, Analysis and Control of Hydraulic Actuator for Forging
3. Stability and Stabilization of Linear and Fuzzy Time-Delay Systems
4. Pipe Inspection Robots for Structural Health and Condition Monitoring
5. Electromagnetic Actuation and Sensing in Medical Robotics
6. Topology Design of Robot Mechanisms
7. Robot Builders Bonanza, 4th Edition
8. Robot Building for Beginners, Third Edition
9. Introduction to Autonomous Mobile Robots
10. Robotics, Vision and Control: Fundamental Algorithms In MATLAB, 2e
11. Arduino Cookbook, 2nd Edition

VII

You might also like