You are on page 1of 26

LlnL lCLLCWL8

WC8kSPC
ParshlL CulaLl
Caurav uuggal
ulglLal l/C plns
ulglLal l/C plns are used for dlglLal lnpuL or ouLpuL 1he
Ardulno has 13 l/C plns
D1
LED
PN 13
R1
680 ohms
Ground
1hls clrculL ls already bullL ln
on your Ardulno
ulglLal l/C plns
WrlLe Lhe followlng code ln Ardulno
vold seLup()

plnMode(13 Cu1u1)

vold loop()

dlglLalWrlLe(13 PlCP)
delay(1000)
dlglLalWrlLe(13 LCW)
delay(1000)

uC MoLors roLaLe ln opposlLe dlrecLlons and lf Lhe dlrecLlon of currenL ls


reversed Lhe dlrecLlon of roLaLlon ls also reversed
P 8rldge MoLor urlver lmplemenLaLlon uslng 4 swlLches
Lnab|e (|n 1) Input 1 (|n2) Input 2(|n7) Cutput 1(|n3) Cuput2(|n7)
Low All lnpuLs and CuLpuLs are ulsabled
Plgh Low Plgh Plgh Low
Plgh Plgh Low Low Plgh
W 1he Lnable ln can be used for speed
conLrol of MoLor by conLlnuously
swlLchlng Lhe moLor on and off
W lf Lhe WM pln on Lhe Ardulno ls
connecLed Lo Lhe enable pln we can
conLrol Lhe speed of Lhe moLor
1he WM slgnal also corresponds Lo a volLage level
W A 30 duLy cycle slgnal corresponds Lo a volLage of 23 lf Lhe 100 duLy cycle
corresponds Lo 3v
W 1he Ardulno has an 8 blL WM module 1hls means Lhe resoluLlon of Lhe Ardulno ls
3/(2)8 00193 volLs 1haL ls we can change Lhe volLage ouLpuL of Lhe WM pln ln
sLeps of 00193 volLs
AuC Module 1
An analog slgnal ls one LhaL changes conLlnuously wlLh Llme
AuC Module 1
MosL of Lhe sensors LhaL we use ouLpuL a volLage slgnal LhaL corresponds Lo Lhe
parameLer (llghL lnLenslLy acceleraLlon LemperaLure) belng measured 1he
mlcroconLroller cannoL read analog slgnals dlrecLly so we need Lo converL Lhem Lo
dlglLal slgnals
LlghL lnLenslLy sensor
AcceleromeLer
AuC Module 2
1he AuC module converLs Lhe lnpuL volLage Lo a number
Slnce Lhe Ardulno has a 10 blL AuC module 1he converLed
number lles beLween 0 and 210 1024
W 3 volLs corresponds Lo 1023 and 0 corresponds Lo 0 1he
relaLlon on proporLlonal ln naLure
W 1herefore an analog value of 3 volLs corresponds Lo 613
when converLed ln Lhe ardulno
AuC Module 3
WrlLe Lhe followlng program ln Ardulno
vold seLup()

Serlal8egln(9600)

vold loop()

lnL a
a analog8ead(0)
SerlalprlnL(a)

l8 sensor array clrculL


1he l8 LLu on Lhe lefL ouLpuLs l8 llghL on Lhe ground
uependlng on Lhe ground color a cerLaln amounL ls
reflecLed back Lo Lhe recelver
on Lhe rlghL
1he 8ecelver ls conflgured ln a reverseblased
volLage dlvlder conflguraLlon 1hls means LhaL
Lhe dlode ls reverse blased hence a very very low
currenL passes whlch depends on Lhe llghL falllng
on Lhe dlode Also Lhe volLage dlvlder converLs
Lhe currenL lnLo a volLage gradlenL
Llne follower ComparaLor algorlLhm
W WhlLe background reflecLs a ma[or porLlon of Lhe l8 llghL back whlch
generaLes more currenL hence a hlgher AuC value 8lack background
absorbs mosL l8 llghL hence generaLes a low AuC value
W Assumlng 2 sensors are used lf Lhe lefL sensor deLecLs black swlLch on
rlghL moLor and swlLch off lefL moLor and vlce versa
W 1hls algorlLhm lsnL very good slnce lL wlll make Lhe llne follower wobble
a loL and sharp Lurns are lmposslble Lo Lake 1he llne follower followes a
zlgzag rouLe conLlnuously golng on and off Lhe llne and moLors are
consLanLly belng swlLched on and off
IGn1 SLNSC LI1 SLNSC
WPl1L WPl1L
IGn1 MC1C LI1 MC1C
lC8WA8u
10
lC8WA8u
10
INL ICCWL ANIMA1ICN
INL ICCWL ANIMA1ICN
IGn1 SLNSC LI1 SLNSC
WPl1L ACk
IGn1 MC1C LI1 MC1C
lC8WA8u
10
S1C
00
INL ICCWL ANIMA1ICN
IGn1 SLNSC LI1 SLNSC
WPl1L WPl1L
IGn1 MC1C LI1 MC1C
lC8WA8u
10
lC8WA8u
10
INL ICCWL ANIMA1ICN
IGn1 SLNSC LI1 SLNSC
WPl1L ACk
IGn1 MC1C LI1 MC1C
lC8WA8u
10
S1C
00
INL ICCWL ANIMA1ICN
IGn1 SLNSC LI1 SLNSC
WPl1L WPl1L
IGn1 MC1C LI1 MC1C
lC8WA8u
10
lC8WA8u
10
INL ICCWL ANIMA1ICN
IGn1 SLNSC LI1 SLNSC
ACk WPl1L
IGn1 MC1C LI1 MC1C
S1C
00
lC8WA8u
10
INL ICCWL ANIMA1ICN
IGn1 SLNSC LI1 SLNSC
WPl1L WPl1L
IGn1 MC1C LI1 MC1C
lC8WA8u
10
lC8WA8u
10
INL ICCWL ANIMA1ICN
IGn1 SLNSC LI1 SLNSC
ACk ACk
IGn1 MC1C LI1 MC1C
S1C S1C
M
1
2
3
4
S
6
7
8
10
9
11
12
13
14
1S
16
Lnable1
Lnable2
3v
Cnu
12v
Cnu
Cnu
Cnu
M
l8 l8
Line Followei
Ardulno Ardulno
ulglLal ln 2
ulglLal ln 3
ulglLal ln 4
ulglLal ln 7
analog ln 4
analog ln 1
ulglLal ln 3
ulglLal ln 6

You might also like