You are on page 1of 12

Introduction to obstacle detector The sensor element has two pins for power supply and an Output pin.

The output is a variable voltage between 0 and 5v depending on the type and distance of the obstacle. It tends to 5v as some obstacle comes near it.

The Working Concept I Transmitter will always transmit I light !Infrared"# it is not visible to human eyes. $ince the transmitter and receiver is being arrange side by side# theoretically# the receiver should not receive any or in most cases# it will receive small amount of infrared emitted by the I transmitter. The working concept of I receiver is similar to transistor or %& !%ight &ependent esistor". The I eceiver is like a transistor with the 'base( controlled by the I light received. When there is no I light received# i.e. there is no obstacle# the 'collector( of transistor does not allow current to sink to 'emitter( further to ground of circuit. It is like very high resistance from 'collector( to 'emitter(# blocking current going to ground. In this case# the voltage at output node will be high# near to 5). When the I receiver receives more I light#i.e when there is obstacle# it changes the resistance at 'collector( and allow more current to sink to ground# and this is similar to low resistance at the lower part of the circuit. The voltage at will drop. We utili*e this voltage changes to I light to +know, whether there is obstacle or not. -ecause when there is obstacle# I light get reflected to I receiver further changes the voltage# monitoring the voltage changes will get you an obstacle detection sensor

FLOWCHART FOR OBSTACLE DETECTION

Read Sensors od_1,od_2,od_3

yes

If od_1<th | od_2<th | od_3<th

no

obstacle_ avoidence()

main()

FLOWCHART FOR ADC

!"_res#lt$%

set !S" bit$1 start of conversion

yes

is !I&$%'

no

(ait for adc conversion to com)lete

!"_res#lt$ !"*

"lear !I& bit !I&$%

Ret#rn !"_res#lt to main()

&ifferential &rive
Adifferentialwheeledrobotisamobilerobotwhosemovementisbasedontwoseparately drivenwheelsplacedoneithersideoftherobotbody.Itcanthuschangeitsdirectionby varyingtherelativerateofrotationofitswheelsandhencedoesnotrequireanadditional steeringmotion. Differentialdriveisamethodofcontrollingarobotwithonlytwomotorizedwheels.What makesthisalgorithmimportantforarobotbuilderisthatitisalsothesimplestcontrolmethod forarobot. Theterm differential meansthatrobotturningspeedisdeterminedbythespeeddifference betweenwheels!eachoneithersideofyourrobot."ore#ample$keeptheleftwheelstill!and rotatetherightwheelforward!andtherobotwillturnleft..

%suedocodefordifferentialdrive
Inputsensorreading makedecisionbasedonsensorreadingdooneofbelowactions$ Todrivestraightbothwheelsmoveforwardatsamespeed Todrivereversebothwheelsmovebackatsamespeed Toturnlefttheleftwheelmovesinreverseandtherightwheelmovesforward Toturnrighttherightwheelmovesinreverseandtheleftwheelmoves forward

3 -

1 i$1%%%

00 1$+%% 1// 1$%

i$i/1$-%% 1$%

i$2%% // i$%

.lowchart for obstacle/avoidence

yes

Is od_12od_3'

no

obstacle is on ri3ht side

obstacle is on left side

t#rn left by 4% de3rees

t#rn ri3ht by 4% de3rees

read sensors od_3 and od_+

read sensors od_% and od_1

mov_st()5 //

mov_st()5 //

no

is od_3 2 th 6 od_+ 2 th

is od_% 2 th 6 od_1 2 th

no

yes

yes

t#rn ri3ht by 4% de3rees

t#rn left by 4% de3rees

read sensors od_3 and od_+

read sensors od_% and od_1

mov_st()5 1//

mov_st()5 1//

no

is od_3 2 th 6 od_+ 2 th

is od_% 2 th 6 od_1 2 th

no

yes

yes

t#rn ri3ht by 4% de3rees

t#rn left by 4% de3rees

Is $$%'

no

yes

mov_st() 00

main()

Initiali7e )orts for adc and ste))er motor

i$% $% 1$%

Is i<1%%%' yes obstacle_detection()

no

mov_st()

i$i/1 1$% i//

t#rn left 4% de3rees