Upload
dangmien
View
243
Download
5
Embed Size (px)
Citation preview
Line Follower Robot
Robotics Workshop Currents 15th march 2008 EEE Department NIT Trichy
Developed By: Mayur Agarwal Prashant Agrawal Krishna Nand Gupta Hitesh Meghani
To Our Readers
We are glad to have had an opportunity to share our knowledge with interested robotics enthusiasts. In this book we have attempted to provide a brief compilation of our experiences in robotics (participating and winning in Technical Festivals all over the country), extending over last three years.
The prospect of practically implementing engineering concepts is the hallmark of robotics. By reading the basics in this book you will gain a significant insight into various tools employed in shaping a robot. However to participate in technical festivals with ever changing problem statements you will be required to apply these basics concepts and come up with innovative algorithms and superior designs.
Do not expect this book to be a panacea for all robotic problems, rather you will have to sit and work for hours to get a functioning robot. Transform each failure into a stepping stone instead of stumbling over it. We appreciate the beauty of diamond but little do we wonder how it became so bright? Its perseverance extending thousands of years transformed it into its present sparkling state.
We encourage you to plunge further into the field of robotics with dedicated perseverance, make your own mistakes and gain valuable experience from them.
ALL THE BEST
Your valuable suggestions and inquisitive doubts are welcome. You can contact us at
Mayur Agarwal ([email protected] )
Krishna Nand Gupta ([email protected])
Prashant Agarwal ([email protected] )
Hitesh Meghani ([email protected] )
~ 1 ~
Introduction The line follower is a self operating robot that detects and follows a line that is
drawn on the floor. The path consists of a black line on a white surface (or vice versa). The control system used must sense a line and maneuver the robot to stay on course, while constantly correcting the wrong moves using feedback mechanism, thus forming a simple yet effective closed loop System. The robot is designed to follow very tight curves.
Sample Paths The path is a black line on a white background with width of 3 cm (except at
bends where a little variation may be present). It may contain paths laterally displaced by around 3 cm and also gap of at most 5 cm. (All these specifications may vary from one competition to another).
Figure 1: Basic Sample Arena
Figure 2: Sample Arena of Kurukshetra’08 (Anna University)
Figure3: Sample Arena of Pragyan’07 (NIT Trichy)
Figure4: Sample Arena of Robo‐Relay of Kishitij’08 (IIT KGP)
From above images we can conclude that in most of line follower competitions, some additional task has to be performed apart from following the line.
Robo
tics W
orks
hop
N
IT T
richy
Basic The
consistingand contrtracking topto-coupIR LED of compainput toMicrocon
Basic The 1. C
Fis
2. Sth
Block D
Let’s see
design robot is bg of a toy rolling whtape. Line plers moun
and an arator, LM3o the micntroller AT
operatbasic oper
Capture linFor this a cs used. The
Steer robot his we use
Diagram
all the sys
and rebuilt usincar chassi
heels. It hposition i
nted at the IR Senso
324 is lowcrocontrol
Tmega8L a
tion rations of thne position ombinatione line sensi
to track ttwo motor
stem in det
quiremg ATmegis (or hand
has infraredis capturedfront end
or). Whenw, while fo
ler for aand Motor d
he line follwith optic
n of IR LEing procesthe line wirs that gov
ail.
~ 2 ~
ments ga8L, L29d made Ald sensors d with the of the robo
n the senr white suaccurate cdriver L29
lower are acal sensors
ED and Phos requires hith a suitab
vern the mo
3D, IR seluminum son the bohelp of th
ot. (Each onsors detecrface the ocontrol a
93D are use
as follows:s mountedoto Transishigh resoluble steerinotion of the
ensors, LMsheet chassottom for hese opticaopto-couplct black output is hand steerined to drive
: d at front estor called ution and h
ng mechanie wheels on
M324, plasis), two mdetecting
al sensors er consistssurface, o
high. It is sng of m
e the motor
end of the an opto-co
high robustism. To acn either sid
atform motors
black called
s of an output sent as
motors. rs.
robot. oupler tness. chieve de.
Robo
tics W
orks
hop
N
IT T
richy
INPUTSensor
Eacor photo d
If wsensed byhence rec
Photo dio(from saydivider ci
T SYSTErs ch opto-codiode. white surfay the receivceiver does
ode has a py 150kΩ ircuit (as sh
EM
oupler has
ace is presever, while s not sense
property thto 10kΩ).hown in fig
one emitte
ent beneathin case of bIR rays.
hat if IR lig For sensgure below
~ 3 ~
er (IR LED
h the IR LEblack surfa
ght falls oning the ch
w).
D) and one
ED, IR rayace, the lig
n it, its elechange in r
receiver (P
ys are reflecght gets abs
ctrical resisresistance
Photo-Tran
cted and arsorbed and
stance decwe use v
nsistor
re d
reases voltage Ro
botic
s Wor
ksho
p
N
IT T
richy
~ 4 ~
Sample Calculation: Say Receiver has resistance- Rs=150kΩ without light (on black surface) Rs=10kΩ with light (on white surface) The voltage that goes to comparator Without light: (on black surface) Vp= *5 V=4.6875 V With light: (on white surface) Vp= *5 V=2.500 V
Thus we get the variation in voltage, which is sensed by the comparator IC (LM324). The comparator then, gives logical high or low according to input. Comparator Comparator is a device which compares two input voltages and gives output as high or low. In a circuit diagram it is normally represented by a triangle having-Inverting (negative) Input (-), Non-Inverting (positive) Input(+), Vcc, Ground, Output.
Properties of comparator:
If V+ > V- then Vo=Vcc (Digital High 1 output)
If V+ < V- then Vo=0 (Digital Low 0 output)
Robo
tics W
orks
hop
N
IT T
richy
~ 5 ~
Let’s see some examples
Use of comparator in IR sensor As above we see that two inputs are required for comparator. One input is from photo-receiver (like photo-diode), other is generated by us using potentiometer (preset). The second voltage is also called as reference voltage for that sensor. Setting of reference voltage (Vref) We can vary reference voltage by using potentiometer, such that it can vary from 0V to Vcc. We set the reference voltage as mean value of the sensor outputs measured with and without light.
From above example Vref = . . = 3.5875 V
Lets connect Inverting Input of Comparator to photo- receiver, Non-Inverting Input to potentiometer (as shown in figure) and output to micro controller.
Sample Calculation: Let V+ = 3.5875 V With light :(on white surface) V- = 0.9090 V Thus V+>V- and Vo= Vcc = 5 V Thus we get digital HIGH output. Without light:(on black surface) V- = 3.333 V Thus V+<V- and Vo = 0 V Thus we get digital LOW output.
Robo
tics W
orks
hop
N
IT T
richy
Note: If wInvertingwe get Lo
IC LM IC
You can
ArranAn
the frontWe
then thesharp tusmooth programsensors.
T
we connectg Input to pow output a
M324 LM324 co
see the da
ngemenn array oft of the roe can use e robot murns. If we
and relmming and
he distan1. Numb2. Width3. Distan
logic).
t Inverting photo- receand for bla
ontains fou
tasheet of
t of Senf sensors bot. It is u any num
movement e use highliable fod more ha
nce betweeber of sensh of straignce betwe.
Input of Ceiver, the oack surface
ur compara
IC LM324
nsors
arranged used to lo
mber of sen will not
her numbeor sharp ardware. T
en sensorsors used ht line
een sensor
~ 6 ~
Comparatonly differe
e we get Hi
ators.
4 for more
in a stracate the pnsors. If w be smooer of sens
turns, Thus we m
rs depend
rs may no
or to potentence observ
High output.
e details.
ight row position ofwe have leoth and itors robot however must choo
ds on
ot be cons
tiometer (pved is that .
pattern isf line beloesser numt may fac movemen it requose optim
stant (it d
preset) andat white su
s bolted uow the robmber of sece problemnt will be
uires commum numb
depends o
d Non-urface
under bot. ensors ms at ecome mplex ber of
on the
Robo
tics W
orks
hop
N
IT T
richy
Sample f
Tips f
figure:
for Inp Significonnec
Set prdiffere
You haon rou
The adcase wambien
To getwe gen
Propergood vthe oth
If an oacrossphoto d
Left
put Syscant probctions use Preset valuently and mave to adju
ughness of sdvantage ofwe use LDRnt light. t a good vonerally user orientatiovoltage swiher opto-coopto-coupl IR LED idiode for b
Figur
tem blems arePCB. e for each
may give difust presetsurface.
of IR sensoR as photo
oltage swie 10kΩ resson of the Iing. Also Ioupler. ler is not is 1.1-1.2 black and w
e 2: Align
~ 7 ~
faced in
h sensor, fferent voltvalue for
or is that ito detector,
ing, the vasistance. IR LED anIR rays of
working thV, then chwhite surfa
ment of S
R
input syst
because etage on thenew surfa
t is less affits sensiti
alue of R1
nd Photo done opto-c
hen first ceck the vo
aces, then s
ensor in a
Right
tem. So to
each sense same surfce, as refl
ffected by avity will h
must be c
diode is mucoupler sh
check whetoltage variaset the refe
an opto-cou
o make re
sor may brface. lectivity de
ambient ligighly depe
carefully ch
ust so as toould not d
ther the voation acro
erence volt
upler
eliable
behave
epends
ght. In end on
hosen,
o have disturb
oltage oss the tage.
Robo
tics W
orks
hop
N
IT T
richy
VoltaVoltage rcommonlvoltage is They helinput volt If input vmay be 5maximum To identiwriting tovoltage re
age Reregulators ly used ons in betwee
lp to maintage variat
voltage is <5V or 4.8Vm output cu
fy the leado your sidegulator.(1
Fig a Figcoufor useThe
egulatoconvert f
nes are 780en 7.5V to
ntain a steations.
<7.5 V thenV, but theurrent capa
ds of the 78de, (see th1-input,2-g
b shows h
upling capait in norm capacitor,e mainly av
or 78xfixed DC 05 and 7820V.
ady voltag
n regulationere are somability, line
805, you hhe figure bgnd,3-outp
how to useacitors are
mal case. B, otherwisevailable 78
~ 8 ~
xx output vo12. 7805
ge level de
n won't beme paramee regulation
have to keebelow). Yoput).
e 7805 voltused for g
But if 7805e the noise8xx IC's are
oltage fromgives fixed
espite vary
proper i.eeters for thn etc.. , tha
ep the lead ou can see
Fig b tage regulagood regula5 is used ine in the oue 7805, 78
m variable d 5V DC
ying curren
e. if input ishe voltageat won't be
downwarde the heat
ator. Here ation. But n analog ciutput volta809,7812,7
DC. Thevoltage if
nt demand
s 6V then oe regulatore proper.
d (Fig a) ansink abov
you can sethere is noircuit we s
age will be815,7824.
most f input
ds and
output rs like
nd the ve the
ee that o need should e high.
Robo
tics W
orks
hop
N
IT T
richy
POTEPotentiomshaft. Pot
Potentiomthen you used to geNote: To resistance
ENTIOMmeter is a vtentiometer
meter is a vcan get v
enerate refreduce th
e.
METERvariable rers are avai
voltage divvoltages froference vole value of
R (‘POsistor whiclable from
vider. If weom 0 to Vltage for Lf current dr
~ 9 ~
OT ' ) ch is used
m 100 ohm t
e connect LVcc by at LM324. rawn, use
to vary theto 470Koh
Lead A to VLead W. M
the preset
e resistancehm (or mor
Vcc and LMainly po
ts that hav
e by rotatinre).
Lead B to gtentiomete
ve higher o
ng the
ground ers are
overall Robo
tics W
orks
hop
N
IT T
richy
Above fipotentiomoccasionaSecond afixed. Thbody of th
igure showmeters are ally while and third ohey are alsohe potentio
ws differenmainly usethe first o
ones are eao called Pometer.
nt types oed when yone is usedasy to inse
Preset. R
~ 10 ~
of potentioou only w
d when weert in brea
Resistance i
meters avant to chane have to vadboard anis varied b
vailable. Senge the valvary resistnd PCB, aby rotating
econd andlue of resiance frequ
also they rg the shaft
d third stance
uently. remain in the
Robo
tics W
orks
hop
N
IT T
richy
PROCE Procorresponseveral Microchiprobot. It i
Why A algorithmit has fol
1. It (BuNocod
2. It h16
3. It 4. It c
A)
ESSINGocessing synding inpucompaniesp, Intel, Mis an ATM
ATmegLine f
ms. We canllowing exis an ISPurning) of
ote: Progrde from cohas on chiand 17). Whas an inbuconsumes l
Hardw
G SYSTystem acts uts. For ths that m
Motorola etMEL produc
ga8L follower ron use any m
xtra featureP (In SysATmega8
ramming (Bmputer to p PWM (
We have exuilt RC osclesser pow
ware De
TEM as the Bra
hat we usemanufacture
tc. We wilct. It is also
obot requimicrocontr
es: stem ProgL IC can b
(Burning) microcontPulse Widxplained PWcillator. (O
wer than oth
etails
~ 11 ~
ain of roboe microcone microcoll be usingo called AV
ires simpleroller for th
grammablbe done witof a micr
troller .Burdth ModuWM in appOscillator iher microco
t, which gentrollers. Iontrollers, g ATmegaVR.
e microconhat. But w
le) devicethout remo
rocontrollerning is exp
ulation) cirpendix secis a clock gontrollers.
enerates deIn present
for exama8L microc
ntroller aswe use ATm
. It meanoving it froer means plained latrcuit at thrtion. generator c
esired outpdays, the
mple ATcontroller
s it uses smega8L, be
ns programom the systtransferrinter. ree pins (P
circuit).
put for re are
TMEL, in our
simple ecause
mming tem. ng the
Pin 15,
Robo
tics W
orks
hop
N
IT T
richy
~ 12 ~
Basic hardware connections of ATmega8L Pin 1 (Reset):
The use of reset pin is to reset the ATmega8L microcontroller. This can be done by connecting this pin to ground. In normal mode of execution it should have at least 2.7V. Thus it is connected to +5 V through 10k ohm resistance .We should make sure that its potential be above 2.7 for proper execution of code. Pin 7 and 20 (Vcc):
Pin 7 and 20 should be connected to Power supply. (2.7 to 5.5 volt for ATmega8L) Pin 8 and 22 (Ground):
Pin 8 and 22 should be connected to Ground. This ground should be common to for the entire circuit.
Input and Output Ports
• In ATmega8L we have three I/O (input/output) ports viz. Port B, Port C and Port D.
• One can configure any pin of each of these ports as input or output pin by appropriate programming.
Pin PORT Connection PWM 14 PB0 Negative of right NO 15 PB1 Positive of right YES 16 PB2 Positive of Left YES 17 PB3 Negative of Left NO
Thus we can use Port C or Port D or remaining Pins of Port B as input. But for the sake of simplifying hardware connections we choose Port D pins as input pins.
Make sure Ground and Vcc do not get interchanged and Vcc should not exceed 5.5 V. If you connect supply wrongly, ATmega8L will suffer permanent damage.
We will be using Port B pins (PB0 to PB3) as output pins because at pinPB1 and PB2 we have on-chip PWM output that can control the speed of motors.
Robo
tics W
orks
hop
N
IT T
richy
BurneBurner (omicroconavailable We will b
stk200Requi
Pa 5 P 5 w
Th
er (or por program
ntroller ICEg stk200
be using st
0 Progrirements arallel PortPin RMC cwired Bus hey are show
rogrammmer) is t
C. For pro0, stk500, jtk200 prog
rammer
t DB 25 coconnector (
wn in follo
mmer)
the circuit ogrammingtag2 etc.
grammer.
r:
onnector (c(connects t
owing figu
~ 13 ~
used to tg AVR th
onnects to to AVR PC
ure.
transfer thhere are d
the compuCB).
he code frodifferent ty
uter )
om compuypes of bu
uter to urners
Robo
tics W
orks
hop
N
IT T
richy
Conne Co
Explanat
ections onnections
tions of Pi
R
are given b
ins of ATm
SCK MOSI
RESET MISO GND
by the follo
mega8L
SM
M
~ 14 ~
owing figu
SPI Bus MMaster Ou
ReMaster Inp
G
ure.
aster clockutput/Slaveeset pin
put/Slave OGround
k Input Input
Output
Robo
tics W
orks
hop
N
IT T
richy
~ 15 ~
B) Software Details: Programming and Simulating The program code acts as the decision-maker embedded in the micro-
controller i.e. it decides what will be the outputs for particular set of input combination.
Programs for the AVR series of microcontrollers can be written in assembly (AVR ASM), C and BASIC. AVR Studio, WinAVR, etc. are some free development softwares for programming the AVR Microcontrollers. We will be using winAVR for programming and AVR Studio for simulating (Simulation means debugging the code on software, one can virtually give the input and check the output for that code).
In winAVR programmers Notepad we write our C code, after compilation it generates ‘.hex’ file which is a hardware level code.
Sample Code: To blink a LED connected at pin 6 (PD4) of ATmega8L. #include <avr/io.h> //header file to include input output port #include <util/delay.h>//header file to include delay function #define LED PD4 int main(void) DDRD = (1 << LED); /* DDR=Data Direction register... its to define PD4 OUTPUT pin rest bits of DDRD can be 0 or 1 does not make any significance */ while (1) PORTD = (1 << LED); // switch on _delay_ms(200); PORTD = (0 << LED); // switch off _delay_ms(200); return 0;
Robo
tics W
orks
hop
N
IT T
richy
MOTOFor moviWhy DC DCits operatsupply acUse of Thconnectinof its speeMathema
Ro Th
Pr is coninversely
Thus to inNote:
• In • Ge
R OUTPing a robotC motorsC motors artion. If wecross it. Wegears
he DC mong wheels ed. atical inte
otational poPr=Tor
hus
stant for D proportion
ncrease the
toy car, theared moto
PUT SY we have ts re most eae want to e can vary
otors don’in it. Gear
erpretationower (Pr) irque (T) *
DC motor wnal to spee
e value of t
here is a geor has a gea
YSTEM:wo dc mot
asy to contrchange itsspeed by v
’t have enrs used to i
n: s given byRotationa
with consed (ω).
torque we
ar box thatar box at it
~ 16 ~
: tors attache
rol. One dcs directionvarying the
nough torincrease th
y: l Speed (ω
stant input
have to sa
t contains ts front end
ed to whee
c motor reqn just revee voltage a
rque to drhe torque o
ω)
electrical
crifice spe
several comd.
els and gea
quires onlyerse the poacross moto
rive a robof dc motor
power. Th
eed.
mbinations
ar system.
y two signaolarity of por.
bot directr on the ex
hus torque
s of gears.
als for power
tly by xpense
(T) is
Robo
tics W
orks
hop
N
IT T
richy
Why tw BymechanisLet’s che
wo moty using twsm of robotck how it w
tors o motors t is called dworks
Fi
F
we can mdifferentia
gure. Descri
Figure. Mo
~ 17 ~
move the roal drive.
iption of var
ovement of
obot in an
rious parts
f Robot
ny direction. This ste
eering
Robo
tics W
orks
hop
N
IT T
richy
The tableLeft MotStraight Stop Reverse Straight Straight Reverse
Use of Fromicrocona currentmotor dri Mocorrespon IC L293 Thhow we u
e: tor
f Motorom microntroller cant enhanciniver betweeotor drivending outp
3D his is a mouse this IC.
RSSSSRR
r Driverocontroller n not give sng device; en the motr takes thut for moto
otor driver .
Right MotoStraight Straight Straight Stop Reverse Reverse
r we can
sufficient cit can als
tor and miche input or.
IC that ca
Figure. Pin
~ 18 ~
or
n not cocurrent to dso act as acrocontrollsignals fr
an drive tw
n Details of L
RobStraLefShaRigShaRev
onnect a drive the Da Switchinler. rom micro
wo motor
L293D
bot Movemaight ft arp left ght arp Right verse
motor diDC motors.ng Device.
ocontroller
simultane
ment
irectly be. Motor drThus we
r and gen
ously. Let
ecause iver is insert
nerates
t’s see
Robo
tics W
orks
hop
N
IT T
richy
~ 19 ~
Electrical Characteristics of L293D
Symbols
Parameter Testing Condition
Min. Max. Units
Vss Logic Supply Voltage Pin 16 4.5 36 V Vs Supply Voltage Pin 8 Vss 36 V Ven L Enable Low Voltage Pin 1 and 9 ‐0.3 1.5 V Ven H Enable High Voltage Pin 1 and 9 Vss<=7
Vss>7 2.3 2.3
Vss 7
V
VIL Input Low Voltage Pin 2, 7, 10 and 15 ‐0.3 1.5 V VIH Input High Voltage Pin 2, 7, 10 and 15 Vss<=7
Vss>7 2.3 2.3
Vss 7
V
Points regarding L293D
Supply voltage (Vss) is the Voltage at which we wish to drive the motor. Generally we prefer 6V for dc motor and 6 to 12V for gear motor, depending upon the rating of the motor.
Logical Supply Voltage will decide what value of input voltage should be considered as high or low .So if we set Logical Supply Voltage equal to +5V, then -0.3V to 1.5V will be considered as Input Low Voltage and 2.3 V to 5V will be considered as Input High Voltage.
L293D has 2 Channels .One channel is used for one motor. • Channel 1 - Pin 1 to 8 • Channel 2 - Pin 9 to 16
Enable Pin is used to enable or to make a channel active. Enable pin is also called as Chip Inhibit Pin.
All Inputs (Pin No. 2, 7,10and 15) to L293D IC are the respective outputs from microcontroller (ATmega8L).
E.g.-We connected Pin No. 2, 7, 10 and 15 of L293D IC to Pin No. 14, 15,16and 17 of ATmega8L respectively in our robots, because on pin 15 and 16 of ATmega8L we can generate PWM.
All Outputs (Pin No. 3, 6,11and 14) of L293D IC goes to the inputs of Right and Left motors.
Output Connections
• OUTPUT 1 (Pin No 3) --- Negative Terminal of Right Motor • OUTPUT 2 (Pin No 6) --- Positive Terminal of Right Motor • OUTPUT 3 (Pin No 10) --- Positive Terminal of Left Motor • OUTPUT 4 (Pin No 14) --- Negative Terminal of Left Motor
Robo
tics W
orks
hop
N
IT T
richy
~ 20 ~
For one motor:
Positive Terminal Negative Terminal Motor Output 0 0 No movement Vss 0 Straight 0 Vss Reverse Vss Vss No Movement
One channel can control one motor. Enable pin should be high for activating
the corresponding channel. Input 1 corresponds to Output 1.
If Enable 1=High (1) Input1 =High (1), Output1=Vss Input1 =Low (0), Output1=0 If Enable 1=Low (0) Input1 =High (1), Output1=0 Input1 =Low (0), Output1=0 if Enable pin low, the output will always be 0. If its high output depends on input
Let’s check the sample outputs for some sample inputs (when both the Enable pins are high):
Input 1
Input2
Input 3
Input 4
Output 1
Output 2
Output 3
Output 4
Motors Output Movement Right Left
Low High High Low 0 Vss Vss 0 Straight Straight Straight Low High Low Low 0 Vss 0 0 Straight No mov Left Turn Low Low High Low 0 0 Vss 0 No mov Straight Right Turn Low High Low High 0 Vss 0 Vss Straight Reverse Sharp Left High Low High Low Vss 0 Vss 0 Reverse Straight Sharp Right High Low Low High Vss 0 0 Vss Reverse Reverse Backward
You can see the datasheet of that IC for more details.
Robo
tics W
orks
hop
N
IT T
richy
~ 21 ~
Algorithm for Line Follower There are various line follower algorithms. The main use of the algorithm is to
move the robot on the line in a smooth fashion. Apart from the task, the algorithm also depends on hardware including number of sensors, type of motors, chassis etc. Same problem can be approached by different algorithms. Readers are encouraged to develop their own algorithms.
Robo
tics W
orks
hop
N
IT T
richy
~ 22 ~
Appendix: 1. Printed Circuit Board
When making the circuit with the electronic parts of the resistors, the capacitors, the transistors, the ICs and so on, it is necessary to connect the lead line of each part appropriately. Also, each part must be fixed, too. The printed circuit board is used to do the wiring among the parts and the fixation of the part.
Advantages: • Reliability and durability due to compact nature of the circuit especially needed
for mobile applications like robotics. • Easy debugging. • Large number of circuits can be made with a greater accuracy and at a cheap
cost. • Chances of loose connections get eliminated.
Disadvantages
• Once the circuit is made on a PCB its layout cannot be changed. • PCB leads can burn at higher values of current rendering it useless for further
use • PCB designing can be a tedious and time consuming process.
Robo
tics W
orks
hop
N
IT T
richy
Bottom
PCBm View
B layou:
Figure:
ut that w
PCB Layou
Figu
Figure: A
~ 23 ~
will be
ut designe
ure: Photo
After Solde
given i
d by Softw
o
ering
in Work
ware
kshop
Robo
tics W
orks
hop
N
IT T
richy
Top VView:
Figure:
Figure
Mirror im
: After pla
~ 24 ~
mage of B
acing all C
ottom La
Compone
ayout
ents
Robo
tics W
orks
hop
N
IT T
richy
Explanation of all compponents:
~ 25 ~
:
Robo
tics W
orks
hop
N
IT T
richy
Bottom
Explan
1) Senm Layou
2) Bo
3) To
nation:
nsor PCut:
ottom Vi
op View
B
iew:
:
~ 26 ~
Robo
tics W
orks
hop
N
IT T
richy
PWMPulse Wivarious fr Thfrequency
DefinitioFrom abo
M idth Modurequencies
he periodic y and duty
ons: ove figure w
Time pis calle
Frequ On Tim Off Ti Duty C Avera
ulation (PWs (time perisquare wa-cycle.
we can defperiod (T)ed as Timeency (f): me (Ton):ime (Toff)Cycle (δ): ge Value(V(Vm is val
WM) is a miod) or dutyave has two
fine some t): The mine period.
=1/T Time for : = T-Ton=(Ton)/TVavg): =Vlue of high
~ 27 ~
method to y-cycles. o levels (hi
terms. nimum tim
which fun
Vm*δ h voltage)
generate P
igh or low)
me after wit
ction is at
Periodic Sq
), with som
tch functio
high voltag
quare Wav
me constan
n repeats i
ge.
e of
t
tself
Robo
tics W
orks
hop
N
IT T
richy
~ 28 ~
Examples
Ro
botic
s Wor
ksho
p
N
IT T
richy
USE of
Foronly has cresistance
Th1. 2.
No
pulse, hencan be va
In average v We
PWM inr example:constant Ve in series
he drawbacThe resistThere will
ow “By adjnce the 'PWaried, and hother word
voltage (Vae can desig
n DC Mot: If a perso
Voltage supwith the m
ks of this ctance valuel be unnec
justing the WM') i.e., thence the mds by varyiavg) acrossgn the syste
tor on wants topply. As anmotor (As s
connectione cannot beessary pow
duty cyclethe time framotor speeing the duts the motorem as show
~ 29 ~
o drive a Dn alternativshown in fi
n are: e varied dywer loss ac
e of the sigaction for w
ed.” ty cycle wer resulting wn in the f
C motor wve for PWMigure).
ynamically ross the re
gnal (moduwhich it is
e are gettinin differen
following f
with variablM he can ad
(automatiesistor.
ulating the s "on", the
ng differentnt speeds. figure:
le speed budd a variab
on is diffic
width of thaverage po
t values of
ut he ble
cult).
he ower
f
Robo
tics W
orks
hop
N
IT T
richy
~ 30 ~
DC Motor Speed α δ
Now
And
Thus
Advantages of PWM:
1. Here the switch is either on or off unlike normal regulation(using variable resistance), so less power is wasted as heat and smaller heat-sinks can be used.
2. Since no resistor is used, there is no power loss. 3. Can be easily automated by programmable control.
Disadvantages: 1. We require extra circuitry to implement PWM (in AVR we have in built
PWM-circuitry on chip). 2. Some authorities claim the pulsed power puts more stress on the DC motor
bearings and windings, shortening its life.
Implementation of PWM: For developing PWM, we require two properties:
1. Time Period (T) 2. On-Time Period (Ton)
Implementation of PWM in microcontroller: In microcontroller we use clock of several Mega Hz. Thus time of one clock
E.g. In ATmega 8 clock frequency is approximately 1 Mega Hz.
Tclk=1/(1M Hz)=1 µs
Vavg α δ
DC Motor Speed α Vavg
Tclk =1/(clock frequency) Robo
tics W
orks
hop
N
IT T
richy
For imple Nt=
OC
Ni=cyc
ementation= Number
CR= Numb
= It is a indcle.
When i
And if
n of PWM of clock c
Nt=ber of cloc
OCRdex of cou
if Ni ≥ Of Ni < O
in micrococycles for o=T/Tclk ck cycles foR= Ton/T
unter, that c
OCR th
OCR th
~ 31 ~
ontroller wone time pe
or On TimeTclk counts from
hen PWhen PWM
we require teriod of PW
e of PWM
m Nt to zer
WM OutpM Outp
these variaWM
ro and Zero
put=Lowput=Hig
ables:
o to Nt in e
w gh
each
Robo
tics W
orks
hop
N
IT T
richy