You are on page 1of 14

I.E.E.E. R.A.I.T.

AN ATTEMPT TO EXPLAIN THE AUTONOMOUS


ROBOTICS (LINE FOLLOWING)……………………
By Santosh Sonawane
T.E.(COMP) R.A.I.T.
Index:
INTRODUCTION
-what is autonomous robotics
-hardware and software
- block diagram

HARDWARE
1)Components required (in general)

Steps of developing robot and the circuits:


2)Sensors
3)Microcontroller
4)Driver Board
Mechanical hardware
5)Motors
6)Chassis
7)Other (Task Specific)

SOFTWARE
1)Language Selection
2)Program logic-----explains complete basis of a Line Follower
3)Writing Code (C considered here)
4)Compiling
5)Writing our code into the Microcontroller
6)Debugging
7)Simulating

BUILDING A PROGRAMMER FOR YOUR MUC

PHOTOS OF MY LEVEL 3 AUTONOMOUS CAR


INTRODUCTION:

What is autonomous robotics-----------------

From longer times it has been an human attempt to automate every appliance to reduce
the tensions….Thus the desire to design a robot replacing humans in undesirable or
dangerous jobs, and reducing the expenditure on manpower has led to the branch of
autonomous robotics…Today we have been able to build Asimov –an autonomous full
fledged robot…. .

Basically robot can be defined as “A versatile mechanical device equipped with actuators
and sensors under the control of a computing system”. Russell and Norvig define it as "an
active, artificial agent whose environment is the physical world."

Our autonomous competitions aim at developing a “Self contained vehicle which when
kept on the track should completely by itself travel along the track correctly”

Hardware and Software----------


Since we have to build an intelligent robot we are bound to have some software which
will control the hardware..(we can make completely hardwired autonomous robots)
Taking it analogous to human beings “Consider our body as Hardware and the control
signals generated by our brains as software ..Thus when we see something(Silver line)
our Eyes (Sensors) receive rays of light (input) from the object.This input is fed to our
Brain(Microcontroller)…which analyses (software) these input and send signals(control
signals to output) to our legs(output device like motors)..This is how we (autonomous
vehicles) move…

Above discussion would have certainly explained how software and hardware are
required for autonomous robotics…
Block Diagram-------------------

Block 1:Here we have sensors which are sensitive to the presence or absence of the
object(here silver line or mirrors or fire) which produce output accordingly and are fed to
the next stage
Block 2:Output from sensors act as input to this stage.It basically consists of a device
able to analyse the input and generate output like microcontroller or computer.
Block 3:The output generated by microcontroller is suppose to drive motors(in our
case)but the power requirement of motors is higher than the output from muc..So we
want an external power supply to supply current to the motors in accordance with the
muc output.
Block 4:This is basically the mechanical part consisting of motors which drive the
system.
HARDWARE:

1)Components Required:
In general to make a line follower robot(car) we require following components:
Electronic components:
Sensors(Infra Red transmitter and receiver)
Op-amp (LM 324 Quad Comparator)
Microcontroller
Driver IC (L293D)

Resistors,Capacitors,Power Supply(batteries and/or Eliminator),Diodes,LEDs

Mechanical components:
Motors(2 for differential driving)
Chassis material
Wires and PCBs

NOW COMES THE ROBOT BUILDING PART WITH THE CIRCUIT


DIAGRAMS……………………………….

2)Sensors:

As said before sensors are used to detect the object …We will concentrate on line
follower robot…..Thus our object will be silver line and mirrors (also fire in some of the
competitions) ..

*First question that arises is “Which sensors?”


OK.We have a wide range and variety of sensors like Infra Red(IR) or SONAR or LDR
etc…For Line Following we prefer IR sensors as they are cheap and easy to interface ..
TO KNOW HOW A SENSOR LOOKS LIKE SEE THE SNAP OF MY ROBOT AT
END OF THIS FILE
*IR transmitter is a LED emitting IR rays.These rays are received by a
PhotoTransistor.(you may use L14F1 its costly but very sensitive)
The IR rays are reflected by any glossy surface but we can adjust their sensitivity by
using pot or preset.
Thus transmitted ray is reflected by a silver line or mirrors and the receiver can receive it.
Sensor configuration:

T R
\ /
\ /
\/
---------------Silver Line

Physical Arrangement:

*The 2 sensor config can be used for simple line following.


The Sensors can be x cm apart where x is the width of the line
Thus when both sensors are receiving rays it means the car is on line.
If anyone sensor goes out of track then we have to move the car accordingly to bring it
online(ie both sensors should be receiving rays always).
*The 4 sensor config can be used for cross detection. The extreme sensors may be used
for this purpose.
Circuit Diagram:
Explaination:
NOTE:LM324 acts as a DC comparator and generates Logic 0 or 1 for specific inputs to
sensors.
Initially a reference voltage is given to the +ve terminal of comparator.When IR is not
reflected no rays are received so the phototransistor is off (as Ib =0).Therefore the voltage
at –ve terminal is >= voltage at +ve ,so the output is 0.Now when the rays are reflected ;a
current Ib flows and Transistor is ON thus Ic flows and the voltage at –ve terminal drops
down .Thus the output of comparator is 1.
This switching of 0 to 1 helps us detect the transition.
This output act as input muc.

3)Microcontroller (muc):
Now , you all know that Microcontroller is used to process the input and produce the
output accordingly……Huh it sounds like computer definition….yeah you are correct it’s
a microprocessor with on chip RAM, flash memory, clock, ROM, PORTS etc.
It stores a program to control the hardware as desired.

*So which all muc are available.?


Different companies manufacture a variety of muc with varying number of ports ,flash
size, ROM, RAM etc.
For example :PIC 16f84a ,AT90S2313etc.
(I used AT90S2313 around Rs.125)

*What are PORTS


These are nothing but pins on muc which can be used for receiving input or as
output.
To one of these ports we may connect output of sensors (Thus this is an input port)
We can connect motors(through L293D) to other port.(Thus this is an output port)

Our program resides in the flash memory of the microcontroller.Writing the


program into the muc(burning) is explained in software section.
Circuit Diagram:
This circuit diagram covers circuit diagram of muc and L293D.

Here the muc used is AT89C2051.


A crystal is connected to pin 4 and 5 which is used to provide timing.
RST is reset pin which when active the muc is reset (stopped).
To the first 4pins(0-3) of port P3 input from sensors is connected.Thus P3 port acts as
input port.
L293D is connected to port P1.Thus P1 is output port.
A decision is made from P1.6 whether the system should start execution.
NO need to explain GND(ground).
3)Driver IC

Depending on the types of motors we may use a driver IC.


For stepper motors ULN 2803(costs around 15 Rs.),ULN 2003 may be used.
For DC motors L293D(90Rs.),L298D may be used.
Driver IC has 2 Active Sources connected. One for driving the IC and other for the
External circuit to be driven.(We may use single source and then use regulator ICs)
L293D receives input from the output of the muc .
According to this input the corresponding output channel(to which motors are connected)
of L293D gets active .

Circuit Diagram is covered in above diagram..

Mechanical Hardware:
5)Motors:
Depending on the requirement we select motors..
A variety of stepper motors with different degrees and forces are available
Generally people go for DC motors ..these motors are available with different rpm and
torque rating. A 60 rpm motor suits well for our Line Follower.
Geared motors are available providing better torque.

6)Chassis:
We may use any material for chassis .Generally that material which is tuff but light is
preferred.One can use plywood,acrylic,mechano,plastic etc.

7)Other (Task Specific):


We may require to topple an object or push a block down .Here we may use some
mechanical design(simple) to achieve this job. Even additional motors may be required .
SOFTWARE
1)Language Selection:
The intelligence or the software in the Microcontroller is basically a set of instruction in
binary form. But it becomes quite easy to write the program using high level languages.
We may use C, Java, Asm, Delphi VB etc.for writing the code.
As we know we can write structured programs through C ,it becomes quite easy to code
using C.

For writing the Programs for specific muc in specific language various IDEs and
compilers/interpreters/assemblers are available.

Company Language Available Environment/compilers/interpreter


Atmel AVR C Code Vision AVR studio
PIC C PICC
MPLAB
HITECH C
PIC BASIC PICBASIC

2)Program Logic: Complete basis of Line Following and cross detection


Now, we have say 4 sensor config with all sensors in horizontal straight line..
Lets label them as follows

ltm lt rt rtm
0 0 0 0 where 0 is a sensor pair
ltm =leftmost
lt=left
rt=right
rtm=rightmost

when car is on line the lt and rt will be receiving IR rays by reflection


| |
| |
|0 0|
| |
| |
| |
0| 0|
| |
when lt sensor is out of line it wont receive IR only rt will receive , so move the car to
right till both the sensors are on line.

| |
| |
|0 |0
| |
when rt sensor is out of line it wont receive IR only lt will receive , so move the car to left
till both the sensors are on line.

A condition when both the sensors will be out of track wont arise if properly
programmed.
If it appears then write the program accordingly trying to bring it on line by trial and
error.

Cross Detection:
Its very simple to detect a cross by using the ltm and rtm sensors as follows
| |
____________ | |_______________
0 0 0 0
____________ _______________
| |
| |
when a sensor is detected all sensors ltm ,rtm,lt ,rt receive IR.

3)Writing Program (C considered here)


Now we have come to a stage where we can write the code for our car.
For any muc in general there are functions like inport or in to accept data
and outport or out to output data.

A simple pseudocode for line following will be

/*Consider Port B as input and Port D as output and lt and rt sensors only*/
int status=inport(B);
if(status&lt==1 && status&rt==1) //lt and rt receiving IR
gostraight(); //forward motion
if(status&lt==0 && status&rt==1) // rt receiving IR
goright_till_on_line(); //move right till online
if(status&lt==1 && status&rt==0) //lt receiving IR
goleft_till_on_line (); // move left till online
Thus we have written a simple Line follower code.
We may extend the same logic to suit our needs

To drive motors either PWM or delay is needed to be used.

4)Compiling:
So we are done with writing the piece of code as per our need BUT this code is in high
level language so we need to compile the code.
On compiling by using any of our favourite compilers we get the output file as a .hex
(Intel) file.
The .hex file stores the opcodes of the instructions in a normal text file.
Now ,we wish to write the hex file into the Flash of the muc…..As our programs on
computer reside on the hard disk ,in muc the programs reside in flash.

5)Writing our code in the muc:


When our hex file is ready what are we looking for?.....yeah we want to write the file in
to the muc..Fine for doing that we can have readymade kits(Costly but full fledged) OR
we can build a programmer hardware (within 50Rs.) Building of programmer
hardware is explained at the last section of the file.
So now we have our programmer hardware (example consider my muc AT90S2313
hardware SP12).connect the hardware to the serial programming port or parallel port as
required by our hardware.Use serial programming software like SP12 or ICPROG to
write the muc with the hex file.
CONGRATULATIONS!!!OUR PROGRAM IS INSIDE THE MICROCONTROLLER
We may put the muc on our circuit board of muc on the car.

6)Debugging
Well I congratulated you for your successful write but lo you found that the program isn’t
working upto expectation………So you need to debug….But you think that its not as
easy to debug as on our PC .So better use LEDs ……….LEDs act as watches….. each
LED representing each sensor input (as watch tracks each variable)..thus you are able to
see which Sensor is not receiving IR and what should be expected output at such a
stage..Then you can enter your code and check in appropriate place and modify..

7)Simulation:
As far as I know there is NO such software that can directly simulate the Line Follower.
BUT you can use softwares like Proteus to simulate the code by giving manual
triggering to input as required.
BUILDING YOUR OWN PROGRAMMER FOR MUC
To build a programmer you need some capacitors , resistors ,crystal and that’s all…
These programming Hardwares use the concept of serial programming and drives the
muc in other mode (Write)....
The circuit diagram for SP12 for AT90Sxxxx is
PHOTOS OF MY LEVEL 3 AUTONOMOUS CAR

You might also like