Drowsiness Detection and Alerting System
Drowsiness Detection and Alerting System
I
NTRODUCTI
ON
1.
1 I
NTRODUCTI
ONTOOURPROJECT
Ourpr
ojectai
mst
odev
elopanewt
echnol
ogywhi
chi
sDr
owsi
nessDet
ect
ion
andAl
ert
ingSy
stem f
ordr
iver
swhi
l
edr
ivi
ngal
ongr
un.Todev
elopt
hisf
ir
stl
yweneed
t
oknowt
hecausesandef
fect
sofdr
owsi
ness.
1.
1.1WHATI
SDROWNSI
NESS?
Feel
i
ng abnor
mal
l
y sl
eepy ort
ir
ed dur
ing t
he day i
s commonl
y known as
dr
owsi
ness.Dr
owsi
nessmayl
eadt
oaddi
ti
onalsy
mpt
omssuchasf
orget
ful
nessor
f
all
i
ngasl
eepati
nappr
opr
iat
eti
mes.Accor
dingt
otheexper
ts,
iti
sal
soast
atewhi
ch
t
heyof
tenf
ailt
orecogni
zeear
lyenough.Feel
i
ngdr
owsywhi
l
edr
ivi
ngmayl
eadt
o
maj
oracci
dent
sasl
i
kedr
unkanddr
ive.
1.
1.2TECHNI
CALMETHODSTODETECTDROWSI
NESS
Dr
iver
’sdr
owsi
nesshasbeenoneoft
hemaj
orcausesofsev
erephy
sical
i
njur
ies,deat
hsand economi
closses.I
n such casest
her
e shoul
d be a r
eli
abl
e
det
ect
ionsy
stem t
hatcanav
oidhappeni
ngofsuchdanger
ousat
tacks.
Ther
ear
etwomet
hodsf
ordr
owsi
nessdet
ect
ion.Theyar
e:
a)I
ntr
usi
vemet
hod,
b)Non-
int
rusi
vemet
hod.
Thei
ntr
usi
vemet
hodi
ncl
udesmeasur
ementofhear
tbeatr
ate,mi
ndwav
e
moni
tor
inget
c.I
tist
hemostaccur
atebutnotr
eal
i
sti
c.Thi
sisbecauset
hesensi
ng
el
ect
rodeswoul
dhav
etobeat
tacheddi
rect
lyt
otheuser
’sbody
.Thi
sagai
nleadst
o
t
hedi
str
act
ionoft
hedr
iver
.Sot
oav
oidsuchdi
str
act
ion,
weoptf
ort
henon-i
ntr
usi
ve
met
hodwhi
chi
ncl
udey
awndet
ect
ion,Ey
e-cl
osur
e,bl
i
nkpat
ter
net
c.Ourpr
ojectt
ell
s
aboutt
hei
mpor
tanceoft
henon-
int
rusi
vemet
hodi
nwhi
cht
hecombi
nat
ionofbot
h
ey
e cl
osur
e and bl
i
nk pat
ter
nisi
ncl
uded.Thi
s sy
stem i
simpl
ement
ed t
hrough
embeddedsy
stems.
1
1.
2INTRODUCTI
ONTOEMBEDDEDSYTEMS
Asi
tsnamesuggest
s,Embeddedmeanssomet
hingt
hati
sat
tachedt
oanot
her
t
hing.Anembeddedsy
stem canbet
houghtofasacomput
erhar
dwar
esy
stem hav
ing
sof
twar
eembeddedi
nit
.Anembeddedsy
stem canbeani
ndependentsy
stem ori
t
can bea par
tofa l
argesy
stem.An embedded sy
stem i
sa mi
crocont
rol
l
eror
mi
cropr
ocessorbasedsy
stem whi
chi
sdesi
gnedt
oper
for
m aspeci
fi
ctask.For
exampl
e,af
ir
eal
armi
sanembeddedsy
stem;
itwi
l
lsenseonl
ysmoke.
Anembeddedsy
stem hast
hreecomponent
s:
I
thashar
dwar
e.
I
thasappl
i
cat
ionsof
twar
e.
I
thasRealTi
meOper
ati
ngsy
stem (
RTOS)t
hatsuper
visest
heappl
i
cat
ion
sof
twar
eandpr
ovi
demechani
sm t
olett
hepr
ocessorr
unapr
ocessasper
schedul
i
ngbyf
oll
owi
ngapl
ant
ocont
rolt
hel
atenci
es.RTOSdef
inest
heway
t
hesy
stem wor
ks.I
tset
sther
ulesdur
ingt
heexecut
ionofappl
i
cat
ionpr
ogr
am.
Asmal
lscal
eembeddedsy
stem maynothav
eRTOS.
Sowecandef
ineanembeddedsy
stem asaMi
crocont
rol
l
erbased,sof
twar
edr
iven,
andr
eli
abl
e,r
eal
-t
imecont
rol
syst
em.
1.
2.1CHARACTERI
STI
CSOFANEMBEDDEDSYSTEM
SI
NGLE-
FUNCTI
ONED–Anembeddedsy
stem usual
l
yper
for
msaspeci
ali
zed
oper
ati
on and does t
he same r
epeat
edl
y.Forexampl
e:A pageral
way
s
f
unct
ionsasapager
.
TI
GHTLY-
CONSTRAI
NED–Al
lcomput
ingsy
stemshav
econst
rai
ntsondesi
gn
met
ri
cs,butt
hoseonanembeddedsy
stem canbeespeci
all
yti
ght
.Desi
gn
met
ri
csi
sameasur
eofani
mpl
ement
ati
on'
sfeat
uressuchasi
tscost
,si
ze,
power
,andper
for
mance.I
tmustbeofasi
zet
ofi
tonasi
ngl
echi
p,must
per
for
mfastenought
opr
ocessdat
ainr
ealt
imeandconsumemi
nimum
powert
oext
endbat
ter
yli
fe.
REACTI
VE&REALTI
ME–Manyembeddedsy
stemsmustcont
inual
l
yreactt
o
changesi
nthesy
stem'
senv
ironmentandmustcomput
ecer
tai
nresul
tsi
nreal
t
imewi
thoutanydel
ay.Consi
deranexampl
eofacarcr
uisecont
rol
l
er;i
t
cont
inual
l
ymoni
tor
sandr
eact
stospeedandbr
akesensor
s.I
tmustcomput
e
2
accel
erat
ionorde-
accel
erat
ionsr
epeat
edl
ywi
thi
nal
i
mit
edt
ime;adel
ayed
comput
ati
oncanr
esul
tinf
ail
uret
ocont
rol
oft
hecar
.
MI
CROPROCESSORSBASED – I
tmustbemi
cropr
ocessorormi
crocont
rol
l
er
based.
MEMORY–I
tmusthav
eamemor
y,asi
tssof
twar
eusual
l
yembedsi
nROM.I
t
doesnotneedanysecondar
ymemor
iesi
nthecomput
er.
CONNECTED – I
tmusthav
econnect
ed per
ipher
alst
o connecti
nputand
out
putdev
ices.
HW-
SW SYSTEMS – Sof
twar
eis used f
ormor
efeat
ures and f
lex
ibi
l
ity
.
Har
dwar
eisusedf
orper
for
manceandsecur
it
y.
Fi
g1.
1HW-
SW sy
stems
ADVANTAGES
Easi
l
yCust
omi
zabl
e
Lowpowerconsumpt
ion
Lowcost
Enhancedper
for
mance
DI
SADVANTAGES
Hi
ghdev
elopmentef
for
t
Lar
gert
imet
omar
ket
1.
2.2BASI
CSTRUCTUREOFANEMBEDDEDSYSTEM
Thef
oll
owi
ngi
l
lust
rat
ionshowst
hebasi
cst
ruct
ureofanembeddedsy
stem:
SENSOR–I
tmeasur
est
hephy
sicalquant
it
yandconv
ert
sitt
oanel
ect
ri
cal
3
si
gnalwhi
chcanber
eadbyanobser
verorbyanyel
ect
roni
cinst
rumentl
i
kean
A2Dconv
ert
er.Asensorst
orest
hemeasur
edquant
it
ytot
hememor
y.
Fi
g1.
2Basi
cst
ruct
ureofembeddedsy
stem
A-
DCONVERTER–Ananal
og-
to-
digi
talconv
ert
erconv
ert
stheanal
ogsi
gnal
sentbyt
hesensori
ntoadi
git
alsi
gnal
.
PROCESSOR&ASI
Cs–Pr
ocessor
spr
ocesst
hedat
atomeasur
etheout
put
andst
orei
ttot
hememor
y.
D-
ACONVERTER–Adi
git
al-
to-
anal
ogconv
ert
erconv
ert
sthedi
git
aldat
afedby
t
hepr
ocessort
oanal
ogdat
a.
ACTUATOR–Anact
uat
orcompar
est
heout
putgi
venbyt
heD-
AConv
ert
ert
o
t
heact
ual
(expect
ed)out
putst
oredi
nitandst
orest
heappr
ovedout
put
.
1.
2.3ES–PROCESSORS
Ear
li
ergener
ati
onmi
cropr
ocessor
s’f
etch-
and-
execut
ecy
clewasgui
dedbyacl
ock
f
requencyofor
derof~1MHz.Pr
ocessor
snowoper
ateatacl
ockf
requencyof2GHz
Fi
g1.
3ESpr
ocessor
1.
2.4MI
CROCONTROLLER:
Ami
crocont
rol
l
eri
sasi
ngl
e-chi
pVLSIuni
t(al
socal
l
edmi
crocomput
er)whi
ch,
al
thoughhav
ingl
i
mit
edcomput
ati
onalcapabi
l
iti
es,
possessesenhancedi
nput
/out
put
capabi
l
ityandanumberofon-
chi
pfunct
ional
uni
ts.
4
CPU RAM ROM
I
/OPORT TI
MER SERI
ALCOM
PORT Tabl
e1.
1
Mi
crocont
rol
l
erChi
p
Mi
crocont
rol
l
ers ar
e par
ti
cul
arl
yused i
n embedded sy
stems f
orr
eal
-t
ime
cont
rol
appl
i
cat
ionswi
thon-
chi
ppr
ogr
am memor
yanddev
ices.
1.
2.5MI
CROPROCESSORVSMI
CROCONTROLLER
Letusnowt
akeal
ookatt
hemostnot
abl
edi
ff
erencesbet
weenami
cropr
ocessor
andami
crocont
rol
l
er.
Mi
cropr
ocessor Mi
crocont
rol
l
er
Mi
cropr
ocessor
s ar
e mul
ti
taski
ng i
n Si
ngl
etask or
ient
ed.Forexampl
e,a
nat
ure.Canper
for
m mul
ti
plet
asksata washi
ng machi
ne i
s desi
gned f
or
t
ime.Forexampl
e,oncomput
erwecan washi
ngcl
othesonl
y.
pl
aymusi
cwhi
l
e wr
it
ing t
exti
ntext
edi
tor
.
RAM,ROM,I
/OPor
ts,andTi
mer
scan RAM,ROM,I
/O Por
ts,and Ti
mer
s
be added ext
ernal
l
yand can v
aryi
n cannot be added ext
ernal
l
y.These
number
s. component
s ar
e t
o be embedded
t
oget
heron a chi
p and ar
efi
xed i
n
number
s.
Desi
gner
scandeci
det
henumberof Fi
xednumberf
ormemor
yorI
/Omakes
memor
yorI
/Opor
tsneeded. ami
crocont
rol
l
eri
dealf
oral
i
mit
edbut
speci
fi
ctask.
Ext
ernalsuppor
tofext
ernalmemor
y Mi
crocont
rol
l
ers ar
eli
ght
wei
ghtand
andI
/Opor
tsmakesami
cropr
ocessor
- cheapert
hanami
cropr
ocessor
.
basedsy
stem heav
ierandcost
li
er.
5
Ext
ernaldev
ices r
equi
re mor
e space A mi
crocont
rol
l
er-
based sy
stem
andt
hei
rpowerconsumpt
ioni
shi
gher
. consumesl
esspowerandt
akesl
ess
space.
Tabl
e1.
2:Di
ff
erencebet
weenMi
cropr
ocessorandMi
crocont
rol
l
er
CHAPTER–2
HARDWARECOMPONENTS,
SOFTWAREANDTHEI
R
DESCRI
PTI
ON
2.
1HARDWARECOMPONENTS
S.
No COMPONENTS QUANTI
TY
1 Ar
dui
noUno 1
2 I
RBasedBl
i
nkDet
ect
ionGl
asses 1
3 DCMot
or 1
6
4 Pi
ezo-
Buzzer 1
5 Vi
brat
or 1
6 Bat
ter
y(9Vol
ts) 1
Tabl
e2.
1Har
dwar
eComponent
sofDr
owsi
nessDet
ect
ionandAl
ert
ingSy
stem
2.
2DESCRI
PTI
ON
2.
2.1ARDUI
NOUNO
OVERVI
EW
TheAr
dui
noUnoi
sami
crocont
rol
l
erboar
dbasedont
heATmega328.I
thas
14di
git
ali
nput
/out
putpi
ns(
ofwhi
ch6canbeusedasPWM out
put
s),
6anal
ogi
nput
s,
a16MHzcer
ami
cresonat
or,aUSBconnect
ion,apowerj
ack,anI
CSPheader
,anda
r
esetbut
ton.I
tcont
ainsev
ery
thi
ngneededt
osuppor
tthemi
crocont
rol
l
er;si
mpl
y
connecti
ttoacomput
erwi
thaUSBcabl
eorpoweri
twi
thaAC-
to-
DCadapt
eror
bat
ter
ytogetst
art
ed.TheUnodi
ff
ersf
rom al
lpr
ecedi
ngboar
dsi
nthati
tdoesnotuse
t
heFTDIUSB-
to-
ser
ialdr
iverchi
p.I
nst
ead,i
tfeat
urest
heAt
mega16U2(
Atmega8U2
upt
over
sionR2)pr
ogr
ammedasaUSB-
to-
ser
ial
conv
ert
er.
REVI
SION3OFTHEBOARDHASTHEFOLLOWI
NGNEW FEATURES
1.
0pi
nout
:addedSDAandSCLpi
nst
hatar
eneart
otheAREFpi
nandt
woot
her
newpi
nspl
acedneart
otheRESETpi
n,t
heI
OREFt
hatal
l
owt
heshi
eldst
oadaptt
othe
v
olt
agepr
ovi
dedf
rom t
heboar
d.I
nfut
ure,shi
eldswi
l
lbecompat
ibl
ebot
hwi
tht
he
boar
dthatusest
heAVR,whi
choper
atewi
th5Vandwi
tht
heAr
dui
no.Duet
othat
oper
atewi
th3.
3V.Thesecondonei
sanotconnect
edpi
nthati
sreser
vedf
orf
utur
e
pur
poses.At
mega16U2r
epl
acet
he8U2."
Uno"meansonei
nIt
ali
anandi
snamedt
o
mar
ktheupcomi
ngr
eleaseofAr
dui
no1.
0.TheUnoandv
ersi
on1.
0wi
l
lbet
he
r
efer
encev
ersi
onsofAr
dui
no,
mov
ingf
orwar
d.TheUnoi
sthel
atesti
naser
iesofUSB
Ar
dui
noboar
ds,andt
her
efer
encemodelf
ort
heAr
dui
nopl
atf
orm;f
oracompar
ison
wi
thpr
evi
ousv
ersi
on
7
Fi
g2.
1:
Ar
dui
no Boar
d
SCHEMATI
C&REFERENCEDESI
GN
TheAr
dui
nor
efer
encedesi
gncanuseanAt
mega8,
168,
or328,
Cur
rentmodel
s
useanATmega328,butanAt
mega8i
sshowni
ntheschemat
icf
orr
efer
ence.The
bel
ow showst
heschemat
icdi
agr
am asar
efer
encef
ort
heAr
dui
noUno.Thepi
n
conf
igur
ati
oni
sident
icalonal
lthr
eepr
ocessor
s.TheATmega328mi
crocont
rol
l
eri
s
t
heMCUusedi
nAr
dui
noUNOR3asamai
ncont
rol
l
er.ATmega328i
sanMCUf
rom
t
heAVRf
ami
l
y;i
tisan8-
bitdev
ice,whi
chmeanst
hati
tsdat
a-busar
chi
tect
ureand
i
nter
nal
regi
ster
sar
edesi
gnedt
ohandl
e8par
all
eldat
asi
gnal
s.
8
Fi
g2.
2:Schemat
ic&Ref
erenceDesi
gn
SPECI
FICATI
ONS:
S.
No SPECI
FICATI
ON RANGE
1 Mi
crocont
rol
l
er ATmega328
2 Oper
ati
ngVol
tage 5V
3 I
nputVol
tage 7-
12V(
recommended)
4 I
nputVol
tage(
li
mit
s) 6-
20V
5 Di
git
alI
/OPi
ns 14(
ofwhi
ch6pr
ovi
dePWM out
put
)
6 Anal
ogI
nputPi
ns 6
7 DCCur
rentperI
/OPi
n 40mA
8 DCCur
rentf
or3.
3VPi
n 50mA
32KB(
ATmega328)ofwhi
ch0.
5KB
Fl
ashMemor
y
9 used
Bybootl
oader
10 SRAM 2KB(
ATmega328)
9
11 EEPROM 1KB(
ATmega328)
12 Cl
ockSpeed 16MHz
Tabl
e2.
2:Speci
fi
cat
ionsofAr
dui
noUno
POWER:TheAr
dui
noUnocanbepower
edv
iat
heUSBconnect
ionorwi
thanext
ernal
powersuppl
y.Thepowersour
cei
ssel
ect
edaut
omat
ical
l
y.Ext
ernal(
non-
USB)power
cancomeei
therf
rom anAC-
to-
DCadapt
er(
wal
l
-war
t)orbat
ter
y.Theadapt
ercanbe
connect
edbypl
uggi
nga2.
1mm cent
er-
posi
ti
vepl
ugi
ntot
heboar
d'spowerj
ack.
Leadsf
rom abat
ter
ycanbei
nser
tedi
ntheGndandVi
npi
nheader
soft
hePOWER
connect
or.
Theboar
dcanoper
ateonanext
ernalsuppl
yof6t
o20v
olt
s.I
fsuppl
i
ed
wi
thl
esst
han7V,howev
er,t
he5Vpi
nmaysuppl
ylesst
hanf
ivev
olt
sandt
heboar
d
maybeunst
abl
e.I
fusi
ngmor
ethan12V,t
hev
olt
ager
egul
atormayov
erheatand
damaget
heboar
d.Ther
ecommendedr
angei
s7t
o12v
olt
s.
Thepowerpi
nsar
easf
oll
ows
VI
N:Thei
nputv
olt
aget
otheAr
dui
noboar
dwheni
t'
susi
nganext
ernalpowersour
ce
(
asopposedt
o5v
olt
sfr
om t
heUSBconnect
ionorot
herr
egul
atedpowersour
ce)
.
Youcansuppl
yvol
taget
hrought
hispi
n,or
,ifsuppl
yi
ngv
olt
agev
iat
hepowerj
ack,
accessi
tthr
ought
hispi
n.
Vol
tage:Thi
spi
nout
put
sar
egul
ated5Vf
rom t
her
egul
atoront
heboar
d.Theboar
d
can besuppl
i
ed wi
th powerei
therf
rom t
heDC powerj
ack(
7 -12V)
,theUSB
connect
or(
5V)
,ort
heVI
Npi
noft
heboar
d(7-
12V)
.Suppl
yi
ngv
olt
agev
iat
he5Vor
3.
3Vpi
nsby
passest
her
egul
ator
,andcandamagey
ourboar
d.Wedon'
tadv
isei
t.
3V3:A3.
3vol
tsuppl
ygener
atedbyt
heon-
boar
dregul
ator
.Maxi
mum cur
rentdr
awi
s
50mA.
GND:Gr
oundpi
ns.
I
OREF:Thi
spi
nont
heAr
dui
noboar
dpr
ovi
dest
hev
olt
ager
efer
encewi
thwhi
cht
he
mi
crocont
rol
l
eroper
ates.Apr
oper
lyconf
igur
edshi
eldcanr
eadt
heI
OREFpi
nvol
tage
andsel
ectt
heappr
opr
iat
epowersour
ceorenabl
evol
taget
ransl
ator
sont
heout
put
s
10
f
orwor
kingwi
tht
he5Vor3.
3V.
MEMORY:TheATmega328has32KB(
wit
h0.
5KBusedf
ort
hebootl
oader
).I
tal
so
has2KBofSRAM and1KBofEEPROM (
whi
chcanber
eadandwr
it
tenwi
tht
he
EEPROM l
i
brar
y).
I
NPUTANDOUTPUT:
Eachoft
he14di
git
alpi
nsont
heUnocanbeusedasani
nputor
out
put
,usi
ngpi
nMode(
),di
git
alWr
it
e()
,anddi
git
alRead(
)funct
ions.Theyoper
ateat5
v
olt
s.Eachpi
ncanpr
ovi
deorr
ecei
veamaxi
mum of40mAandhasani
nter
nal
pul
l
-up
r
esi
stor(
disconnect
ed bydef
aul
t)of20-
50 kOhms.I
n addi
ti
on,somepi
nshav
e
speci
ali
zedf
unct
ions:
SERI
AL:0(
RX)AND1(
TX)
:Usedt
orecei
ve(
RX)andt
ransmi
t(TX)TTLser
ialdat
a.
Thesepi
nsar
econnect
edt
othecor
respondi
ngpi
nsoft
heATmega8U2USB-
to-
TTL
Ser
ial
chi
p.
EXTERNAL I
NTERRUPTS:2 AND 3:These pi
nscan be conf
igur
ed t
otr
iggeran
i
nter
ruptonal
owv
alue,ar
isi
ngorf
all
i
ngedge,orachangei
nval
ue.Seet
heat
tach
I
nter
rupt
()f
unct
ionf
ordet
ail
s.
PWM:
3,5,
6,9,
10,
and11pr
ovi
de8-
bitPWM out
putwi
tht
heanal
ogWr
it
e()f
unct
ion.
SPI
:10(
SS)
,11(
MOSI
),12(
MISO)
,13(
SCK)–Thesepi
nssuppor
tSPIcommuni
cat
ion
usi
ngt
heSPIl
i
brar
y.
LED:(
13)Ther
eisabui
l
t-i
nLEDconnect
edt
odi
git
alpi
n13.Whent
hepi
nisHI
GH
v
alue,
theLEDi
son,
whent
hepi
nisLOW,
it'
sof
f.
ANALOGPI
NS:TheUnohas6anal
ogi
nput
s,l
abel
edA0t
hroughA5,eachofwhi
ch
pr
ovi
de10bi
tsofr
esol
uti
on(
i.
e.1024di
ff
erentv
alues)
.Bydef
aul
ttheymeasur
efr
om
gr
oundt
o5v
olt
s,t
houghi
sitpossi
blet
ochanget
heupperendoft
hei
rrangeusi
ng
t
heAREFpi
nand t
heanal
og Ref
erence(
)funct
ion.Addi
ti
onal
l
y,somepi
nshav
e
speci
ali
zedf
unct
ional
i
ty:
TWI
:A4ORSDAPI
N ANDA5ORSCLPI
N -Suppor
tTWIcommuni
cat
ionusi
ngt
he
Wi
rel
i
brar
y.
11
Ther
ear
eacoupl
eofot
herpi
nsont
heboar
d:
AREF:
Ref
erencev
olt
agef
ort
heanal
ogi
nput
s.Usedwi
thanal
ogRef
erence(
).
RESET:Br
ingt
hisl
i
neLOW t
oresett
hemi
crocont
rol
l
er.Ty
pical
l
yusedt
oaddar
eset
but
tont
oshi
eldswhi
chbl
ockt
heoneont
heboar
d.
COMMUNI
CATI
ON
The Ar
dui
no Uno has a numberoff
aci
l
iti
es f
orcommuni
cat
ing wi
tha
comput
er,
anot
herAr
dui
no,
orot
hermi
crocont
rol
l
ers.TheATmega328pr
ovi
desUART
TTL(
5V)ser
ialcommuni
cat
ion,
whi
chi
sav
ail
abl
eondi
git
alpi
ns0(
RX)and1(
TX)
.An
ATmega16U2ont
heboar
dchannel
sthi
sser
ialcommuni
cat
ionov
erUSBandappear
s
asav
irt
ualcom por
ttosof
twar
eont
hecomput
er.The'
16U2f
ir
mwar
eusest
he
st
andar
dUSBCOM dr
iver
s,andnoext
ernaldr
iveri
sneeded.Howev
er,
onWi
ndows,
a
.
inff
il
eisr
equi
red.TheAr
dui
nosof
twar
eincl
udesaser
ialmoni
torwhi
chal
l
ows
si
mpl
etext
ualdat
atobesentt
oandf
rom t
heAr
dui
noboar
d.TheRXandTXLEDson
t
heboar
dwi
l
lfl
ashwhendat
aisbei
ngt
ransmi
tt
edv
iat
heUSB-
to-
ser
ialchi
pandUSB
connect
iont
othecomput
er(
butnotf
orser
ial
communi
cat
iononpi
ns0and1)
.
ASof
twar
eSer
iall
i
brar
yal
l
owsf
orser
ialcommuni
cat
iononanyoft
heUno'
sdi
git
al
pi
ns.TheATmega328al
sosuppor
tsI
2C(
TWI
)andSPIcommuni
cat
ion.TheAr
dui
no
sof
twar
eincl
udesaWi
rel
i
brar
ytosi
mpl
i
fyuseoft
heI
2Cbus;
seet
hedocument
ati
on
f
ordet
ail
s.ForSPIcommuni
cat
ion,
uset
heSPIl
i
brar
y.
PROGRAMMI
NG
The Ar
dui
no Uno can be pr
ogr
ammed wi
tht
he Ar
dui
no sof
twar
e.The
ATmega328ont
heAr
dui
noUnocomespr
e-bur
nedwi
thabootl
oadert
hatal
l
owsy
ou
t
oupl
oadnew codet
oitwi
thoutt
heuseofanext
ernalhar
dwar
epr
ogr
ammer
.It
communi
cat
esusi
ngt
heor
igi
nalSTK500pr
otocol(
ref
erence,
Cheaderf
il
es)
.Youcan
al
soby
passt
hebootl
oaderandpr
ogr
amst
hemi
crocont
rol
l
ert
hrought
heI
CSP(
In-
Ci
rcui
tSer
ial
Progr
ammi
ng)header
;seet
hesei
nst
ruct
ionsf
ordet
ail
s.
TheATmega16U2(
or8U2i
nther
ev1andr
ev2boar
ds)f
ir
mwar
esour
cecodei
s
av
ail
abl
e.TheATmega16U2/
8U2i
sloadedwi
thaDFU bootl
oader
,whi
chcanbe
act
ivat
edby
:OnRev
1boar
ds:connect
ingt
hesol
derj
umperont
hebackoft
heboar
d
(
neart
hemapofI
tal
y)andt
henr
eset
ti
ngt
he8U2.
OnRev
2orl
aterboar
ds:t
her
eisar
esi
stort
hatpul
l
ingt
he8U2/
16U2HWBl
i
net
o
gr
ound,
maki
ngi
teasi
ert
oputi
ntoDFUmode.
Youcant
henuseAt
mel
'
sFLI
Psof
twar
e(Wi
ndows)ort
heDFUpr
ogr
ammer
12
(
MacOSXandLi
nux)t
oloadanewf
ir
mwar
e.Ory
oucanuset
heI
SPheaderwi
than
ext
ernalpr
ogr
ammer(
over
wri
ti
ngt
heDFU bootl
oader
).Seet
hisuser
-cont
ri
but
ed
t
utor
ial
formor
einf
ormat
ion.
AUTOMATI
C(SOFTWARE)RESET
Rat
hert
hanr
equi
ri
ngaphy
sicalpr
essoft
her
esetbut
tonbef
oreanupl
oad,
the
Ar
dui
noUnoi
sdesi
gnedi
nawayt
hatal
l
owsi
ttober
esetbysof
twar
erunni
ngona
connect
ed comput
er. One of t
he har
dwar
e f
low cont
rol l
i
nes (
DTR) of
t
heATmega8U2/
16U2i
sconnect
edt
other
esetl
i
neoft
heATmega328v
iaa100nano
f
aradcapaci
tor
.Whent
hisl
i
nei
sasser
ted(
takenl
ow)
,ther
esetl
i
nedr
opsl
ong
enought
oresett
hechi
p.TheAr
dui
nosof
twar
eusest
hiscapabi
l
ityt
oal
l
ow y
out
o
upl
oadcodebysi
mpl
ypr
essi
ngt
heupl
oadbut
toni
ntheAr
dui
noenv
ironment
.Thi
s
meanst
hatt
hebootl
oadercanhav
eashor
tert
imeout
,ast
hel
ower
ingofDTRcanbe
wel
l
-coor
dinat
edwi
tht
hest
artoft
heupl
oad.
Thi
sset
uphasot
heri
mpl
i
cat
ions.Whent
heUnoi
sconnect
edt
oei
thera
comput
err
unni
ngMacOSXorLi
nux
,itr
eset
seacht
imeaconnect
ioni
smadet
oit
f
rom sof
twar
e(v
iaUSB)
.Fort
hef
oll
owi
nghal
f-
secondorso,t
hebootl
oaderi
s
r
unni
ngont
heUno.Whi
l
eiti
spr
ogr
ammedt
oignor
emal
for
meddat
a(i
.e.any
thi
ng
besi
desanupl
oadofnewcode)
,itwi
l
lint
erceptt
hef
ir
stf
ewby
tesofdat
asentt
othe
boar
daf
teraconnect
ioni
sopened.I
fasket
chr
unni
ngont
heboar
drecei
vesone-
ti
me
conf
igur
ati
onorot
herdat
awheni
tfi
rstst
art
s,makesur
ethatt
hesof
twar
ewi
thwhi
ch
i
tcommuni
cat
eswai
tsasecondaf
teropeni
ngt
heconnect
ionandbef
oresendi
ngt
his
dat
a.TheUnocont
ainsat
racet
hatcanbecutt
odi
sabl
etheaut
o-r
eset
.Thepadson
ei
thersi
deoft
het
racecanbesol
der
edt
oget
hert
ore-
enabl
eit
.It
'sl
abel
ed"
RESET-
EN"
.Youmayal
sobeabl
etodi
sabl
etheaut
o-r
esetbyconnect
inga110ohm r
esi
stor
f
rom 5Vt
other
esetl
i
ne.
USBOVERCURRENTPROTECTI
ON
TheAr
dui
noUnohasar
eset
tabl
epol
yfuset
hatpr
otect
syourcomput
er'
sUSB
por
tsf
rom shor
tsandov
ercur
rent
.Al
thoughmostcomput
erspr
ovi
det
hei
rown
i
nter
nalpr
otect
ion,
thef
usepr
ovi
desanext
ral
ayerofpr
otect
ion.I
fmor
ethan500mA
i
sappl
i
edt
otheUSBpor
t,t
hef
usewi
l
laut
omat
ical
l
ybr
eakt
heconnect
ionunt
ilt
he
shor
torov
erl
oadi
sremov
ed.
PHYSI
CALCHARACTERI
STI
CS
13
The maxi
mum l
engt
h and wi
dth oft
he Uno PCB ar
e 2.
7 and 2.
1inches
r
espect
ivel
y,wi
tht
heUSBconnect
orandpowerj
ackext
endi
ngbey
ondt
hef
ormer
di
mensi
on.Fourscr
ewhol
esal
l
owt
heboar
dtobeat
tachedt
oasur
faceorcase.Not
e
t
hatt
hedi
stancebet
weendi
git
alpi
ns7and8i
s160mi
l(0.
16"
),notanev
enmul
ti
ple
oft
he100mi
lspaci
ngoft
heot
herpi
n.
2.
2.2I
RBASEDBLI
NKDETECTI
ONGLASSES
Thi
s Ey
e Bl
i
nk sensorsense t
he ey
e-bl
i
nk usi
ng i
sinf
rar
ed sensor
.The
Var
iat
ionAcr
osst
heey
ewi
l
lvar
yasperey
e-bl
i
nk.I
ftheey
eiscl
osedt
heout
puti
s
hi
ghot
her
wiseout
puti
slow.
Fi
g2.
3:I
RBasedBl
i
nkDet
ect
ionGl
asses
Thepi
ctur
eshowst
heI
Rbasedbl
i
nkdet
ect
iongl
assesi
nourpr
otot
ype.
SPECI
FICATI
ONS:
Ey
e-Bl
i
nki
ndi
cat
ionbyLED
I
nst
antout
putdi
git
alsi
gnal
fordi
rect
lyconnect
ingt
othemi
crocont
rol
l
er
Wor
kingVol
tage-+5Vol
tsDC
Wor
kingVol
tage-+5Vol
tsDC
Onboar
d3-
pinheader
Compactsi
ze
SensorDev
ice:
QR3114
14
I
RSENSOR
I
nfr
aredr
adi
ati
oni
sthepor
ti
onofel
ect
romagnet
icspect
rum hav
ingwav
elengt
hs
l
onger t
han v
isi
blel
i
ght wav
elengt
hs,but smal
l
er t
han mi
crowav
es,i
.e.
,the
r
egi
on
roughl
yfr
om 0.
75µm t
o1000µm i
sthei
nfr
aredr
egi
on.I
nfr
aredwav
esar
e
i
nvi
si
blet
ohumaney
es.Thewav
elengt
hregi
onof0.
75µm t
o3µm i
scal
l
ednear
i
nfr
ared,t
her
egi
onf
rom 3µm t
o6µm i
scal
l
edmi
dinf
rar
edandt
her
egi
onhi
gher
t
han6µm i
scal
l
edf
ari
nfr
ared.(
Thedemar
cat
ionsar
enotr
igi
d;r
egi
onsar
edef
ined
di
ff
erent
lybymany
).
Fi
g2.
4:I
RSensor
I
nfr
aredi
sli
ghtt
hathasawav
elengt
hlongert
hanv
isi
bler
edl
i
ght
.Ther
angesof
i
nfr
aredi
ncl
udeneari
nfr
ared,mi
dinf
rar
edandf
ari
nfr
ared,spanni
ngwav
elengt
hs
f
rom about710nanomet
ers(
neari
nfr
ared)t
o 100mi
cromet
ers(
fari
nfr
ared)
.Al
l
obj
ect
semi
tli
ghtaccor
dingt
othei
rtemper
atur
e--
thi
siscal
l
ed"
blackbodyr
adi
ati
on.
"
Thehot
tert
heobj
ect
,theshor
terwav
elengt
hofl
i
ghti
temi
ts.TheEar
themi
tsi
nfr
ared
l
i
ghtatapeakofaboutni
net
o10mi
cromet
ers-
-andsodowar
m-bl
oodedani
mal
sli
ke
humans.Thi
sli
ghtcanbeusedt
odet
ectmot
ionorwar
mth.
15
LEDI
RDETECTORS
I
R(i
nfr
ared)sensor
sdet
ecti
nfr
aredl
i
ght
.TheI
Rli
ghti
str
ansf
ormedi
ntoan
el
ect
ri
ccur
rent
,andt
hisi
sdet
ect
edbyav
olt
ageoramper
agedet
ect
or.
Apr
oper
tyof
l
i
ght
-emi
tt
ingdi
odes(
LEDs)i
sthatt
heypr
oduceacer
tai
nwav
elengt
hofl
i
ghtwhenan
el
ect
ri
ccur
renti
sappl
i
ed-
-butt
heyal
sopr
oduceacur
rentwhent
heyar
esubj
ect
edt
o
t
hesamewav
elengt
hli
ght
.
Apai
rofI
RLEDscanbeusedasmot
iondet
ect
ors.Thef
ir
stI
RLEDi
swi
redt
o
emi
tLEDandt
hesecondLEDi
swi
redt
otr
ansmi
tasi
gnal
wheni
trecei
vesanI
Rinput
.
Whenanobj
ectcomeswi
thi
nrangeoft
heemi
tt
edI
R,i
tref
lect
stheI
Rbackt
othe
r
ecei
vi
ngLEDandpr
oducesasi
gnal
.Thi
ssi
gnalcanbeusedt
oopensl
i
dingdoor
s,
t
urnonal
i
ghtorsetof
fanal
arm.
Fi
g2.
5:I
RWor
king
I
Rdet
ect
ors(
andemi
tt
ers)canbef
oundal
mostev
ery
wher
e.I
fyouhav
ea
comput
ermousewi
thar
edLEDorl
aser
--
iti
susi
ngI
Rli
ght
.Tr
yusi
ngt
hismouseona
dampmousepad-
-wat
eral
mostcompl
etel
yabsor
bst
heI
Randt
hemousewon'
twor
k
aswel
l
.TVandst
ereor
emot
esal
souseI
Rsi
gnal
s--
theTVhasanI
Rdet
ect
ort
hat
i
nter
pret
sthesi
gnalf
rom t
her
emot
e.Mostdi
git
alcamer
asar
esensi
ti
vet
oIRl
i
ght
.
Tur
nony
ourcamer
aandpoi
ntt
heTVr
emot
eatt
hecamer
a.Pr
essabut
tonont
he
r
emot
eandy
ouwi
l
lseeapi
nki
shorpur
pli
shl
i
ghtcomi
ngoutoft
her
emot
eont
he
LCDdi
spl
ayoft
hecamer
athati
stheI
Rsi
gnalf
rom t
her
emot
e.AnI
nfr
aredsensori
s
an el
ect
roni
cinst
rumentt
hati
s used t
o sense cer
tai
n char
act
eri
sti
cs ofi
ts
sur
roundi
ngsbyei
theremi
tt
ingand/
ordet
ect
ingi
nfr
aredr
adi
ati
on.I
tisal
socapabl
e
ofmeasur
ingheatofanobj
ectanddet
ect
ingmot
ion.I
nfr
aredwav
esar
enotv
isi
blet
o
t
hehumaney
e.
16
I
ntheel
ect
romagnet
icspect
rum,i
nfr
aredr
adi
ati
oni
sther
egi
onhav
ing
wav
elengt
hsl
ongert
hanv
isi
blel
i
ghtwav
elengt
hs,butshor
tert
hanmi
crowav
es.The
i
nfr
aredr
egi
oni
sappr
oxi
mat
elydemar
cat
edf
rom 0.
75t
o1000µm.Thewav
elengt
h
r
egi
onf
rom 0.
75t
o3µm i
ster
medasneari
nfr
ared,t
her
egi
onf
rom 3t
o6µm i
s
t
ermedmi
d-i
nfr
ared,
andt
her
egi
onhi
ghert
han6µm i
ster
medasf
ari
nfr
ared.
I
nfr
aredt
echnol
ogyi
sfoundi
nmanyofourev
ery
daypr
oduct
s.Forexampl
e,
TVhasanI
Rdet
ect
orf
ori
nter
pret
ingt
hesi
gnalf
rom t
her
emot
econt
rol
.Keybenef
it
s
ofi
nfr
ared sensor
sincl
ude l
ow powerr
equi
rement
s,si
mpl
e ci
rcui
tr
y,and t
hei
r
por
tabl
efeat
ure.
FEATURES
Thi
sisamul
ti
pur
posei
nfr
aredsensorwhi
chcanbeusedf
orobst
acl
esensi
ng,
col
ordet
ect
ion(
bet
weenbasi
ccont
rast
ingcol
ors)
,fi
redet
ect
ion,
li
nesensi
ng,
etcand
al
soasanencodersensor
.Thesensorpr
ovi
desadi
git
alandananal
ogout
put
.The
sensorout
put
sal
ogi
cone(
+5V)att
hedi
git
alout
putwhenanobj
ecti
spl
acedi
nfr
ont
oft
hesensorandal
ogi
czer
o(0V)
,whent
her
eisnoobj
ecti
nfr
ontoft
hesensor
.An
onboar
dLEDi
susedt
oindi
cat
ethepr
esenceofanobj
ect
.Thesensorout
put
san
anal
ogv
olt
agebet
ween0Vand5V,cor
respondi
ngt
hedi
stancebet
weent
hesensor
andt
heobj
ectatt
heanal
ogout
put
.Theanal
ogout
putcanbehookedt
oanADCt
o
gett
heappr
oxi
mat
edi
stanceoft
heobj
ectf
rom t
hesensor
.IRsensor
sar
ehi
ghl
y
suscept
ibl
etoambi
entl
i
ghtandt
heI
Rsensoront
hissensori
ssui
tabl
ycov
eredt
o
r
educeef
fectofambi
entl
i
ghtont
hesensor
.Thesensorhasamaxi
mum r
angeof
ar
ound40-
50cm i
ndoor
sandar
ound15-
20cm out
door
s.Oper
ati
ngv
olt
age:3t
o9V
(
Rangemaxi
mum f
or9V)
Rangeof50cm f
orwhi
teobj
ect
sand35cm f
orbl
ackobj
ect
s(v
ari
eswi
th
sur
roundi
ngl
i
ghtcondi
ti
ons)
Comeswi
thahi
ghl
yusef
ulanal
ogout
putal
ongwi
thaneasyt
ousedi
git
al
out
put
Sensorcomeswi
thambi
entl
i
ghtpr
otect
ion
Thesensorhas2hol
esof3mm di
amet
erf
oreasymount
ing.
USI
NGTHESENSOR
Thesensorhasasi
mpl
e4pi
nint
erf
ace–>+V(
5V)
,Gnd,
Digi
talOutandAnal
og
Out
.Thesensorcanoper
atewi
thi
nanoper
ati
ngv
olt
ageof4t
o9V.Thei
nputpower
shoul
dbepr
ovi
dedt
othe+V(
Vcc)andt
heGndpi
n.Thedi
git
alout
putoft
hesensori
s
17
pr
ovi
dedont
het
hir
dpi
n–Dout
.Theanal
ogout
putoft
hesensori
spr
ovi
dedont
he
t
hir
dpi
n–Aout
.Oncet
hesensori
spower
edup,y
ouwi
l
lhav
etocal
i
brat
ethesensor
f
ort
hespeci
fi
cenv
ironmenti
twi
l
lbeusedi
n.Tocal
i
brat
ethesensor
,youwi
l
lhav
eto
sett
hepot
ent
iomet
erbyt
urni
ngi
tsknobbyhandorascr
ewdr
iver
.Youwi
l
lhav
eto
powert
hesensorandr
otat
etheknoboft
hepot
ent
iomet
erunt
ilt
heout
putoft
he
sensorchangesf
rom hi
ght
olow.
TYPESOFI
NFRA-
REDSENSORS
I
nfr
a-r
edsensor
sar
ebr
oadl
ycl
assi
fi
edi
ntot
wot
ypes:
Ther
mali
nfr
aredsensor
s – Theseusei
nfr
aredener
gyasheat
.Thei
rphot
o
sensi
ti
vi
tyi
sindependentofwav
elengt
h.Ther
maldet
ect
orsdonotr
equi
re
cool
i
ng;
howev
er,
theyhav
esl
owr
esponset
imesandl
owdet
ect
ioncapabi
l
ity
.
Quant
um i
nfr
aredsensor
s –Thesepr
ovi
dehi
gherdet
ect
ionper
for
manceand
f
ast
err
esponsespeed.Thei
rphot
osensi
ti
vi
tyi
sdependentonwav
elengt
h.
Quant
um det
ect
orshav
etobecool
edsoast
oobt
ainaccur
atemeasur
ement
s.
Theonl
yexcept
ioni
sfordet
ect
orst
hatar
eusedi
ntheneari
nfr
aredr
egi
on.
WORKI
NGPRI
NCI
PLE
At
ypi
cal
syst
em f
ordet
ect
ingi
nfr
aredr
adi
ati
onusi
ngi
nfr
aredsensor
sincl
udes
t
hei
nfr
aredsour
cesuchasbl
ackbodyr
adi
ator
s,t
ungst
enl
amps,andsi
l
iconcar
bide.
I
ncaseofact
iveI
Rsensor
s,t
hesour
cesar
einf
rar
edl
aser
sandLEDsofspeci
fi
cIR
wav
elengt
hs.Nexti
sthet
ransmi
ssi
onmedi
um usedf
ori
nfr
aredt
ransmi
ssi
on,whi
ch
i
ncl
udesv
acuum,
theat
mospher
e,andopt
ical
fiber
s.
Thi
rdl
y,opt
icalcomponent
ssuchasopt
icall
ensesmadef
rom quar
tz,
CaF2,
Ge
andSi
,pol
yet
hyl
eneFr
esnell
enses,andAlorAumi
rr
ors,ar
eusedt
oconv
ergeor
f
ocusi
nfr
aredr
adi
ati
on.Li
kewi
se,t
oli
mitspect
ralr
esponse,band-
passf
il
ter
sar
e
i
deal
.
Fi
nal
l
y,t
he i
nfr
ared det
ect
orcompl
etes t
he sy
stem f
ordet
ect
ing i
nfr
ared
r
adi
ati
on.Theout
putf
rom t
hedet
ect
ori
susual
l
yver
ysmal
l
,andhencepr
e-ampl
i
fier
s
coupl
edwi
thci
rcui
tr
yar
eaddedt
ofur
therpr
ocesst
her
ecei
vedsi
gnal
s.
18
APPLI
CATI
ONS
Thef
oll
owi
ngar
ethekeyappl
i
cat
ionar
easofi
nfr
aredsensor
s:
Tr
acki
ngandar
thi
stor
y
Cl
i
mat
ology
,met
eor
ology
,andast
ronomy
Ther
mogr
aph,
communi
cat
ions,
andal
cohol
test
ing
Heat
ing,
hyperspect
ral
imagi
ng,
andni
ghtv
isi
on\
Bi
ologi
cal
syst
ems,
phot
obi
omodul
ati
on,
andpl
antheal
th
Gasdet
ect
ors/
gasl
eakdet
ect
ion
Wat
erandst
eel
anal
ysi
s,f
lamedet
ect
ion
Anest
hesi
ologyt
est
ingandspect
roscopy
Pet
rol
eum expl
orat
ionandunder
groundsol
uti
on.
2.
2.3DCMOTOR
ADCmot
ori
sanel
ect
ri
cmot
ort
hatr
unsondi
rectcur
rent(
DC)el
ect
ri
cit
y.I
nany
el
ect
ri
cmot
or,oper
ati
oni
sbasedonsi
mpl
eel
ect
romagnet
ism.A cur
rent
-car
ryi
ng
conduct
orgener
ates a magnet
icf
iel
d;when t
hisi
sthen pl
aced i
n an ext
ernal
magnet
icf
iel
d,i
twi
l
lexper
ienceaf
orcepr
opor
ti
onalt
othecur
renti
ntheconduct
or,
andt
othest
rengt
hoft
heext
ernalmagnet
icf
iel
d.Asy
ouar
ewel
lawar
eoff
rom
pl
ayi
ngwi
thmagnet
sasaki
d,opposi
te(
Nor
thandSout
h)pol
ari
ti
esat
tr
act
,whi
l
eli
ke
pol
ari
ti
es(
Nor
thandNor
th,
Sout
handSout
h)r
epel
.Thei
nter
nalconf
igur
ati
onofaDC
mot
ori
sdesi
gnedt
ohar
nesst
hemagnet
ici
nter
act
ionbet
weenacur
rent
-car
ryi
ng
conduct
orandanext
ernal
magnet
icf
iel
dtogener
ater
otat
ional
mot
ion.
Let
'
sst
artbyl
ooki
ngatasi
mpl
e2-
pol
eDCel
ect
ri
cmot
or(
her
eredr
epr
esent
sa
magnetorwi
ndi
ngwi
tha"
Nor
th"pol
ari
zat
ion,whi
l
egr
eenr
epr
esent
samagnetor
wi
ndi
ngwi
tha"
Sout
h"pol
ari
zat
ion)
.
Ev
ery DC mot
orhas si
x basi
c par
ts-
-axl
e,r
otor(
a.k.
a.,ar
mat
ure)
,st
ator
,
commut
ator
,fi
eldmagnet
(s)
,andbr
ushes.
19
Fi
g2.
6:DCMot
orI
nter
ior
I
nmostcommonDCmot
ors,
theext
ernalmagnet
icf
iel
dispr
oducedbyhi
gh-
str
engt
h
per
manentmagnet
s.Thest
atori
sthest
ati
onar
ypar
toft
hemot
or-
-thi
sincl
udest
he
mot
orcasi
ng,aswel
last
woormor
eper
manentmagnetpol
epi
eces.Ther
otor
r
otat
eswi
thr
espectt
othest
ator
.Ther
otorconsi
stsofwi
ndi
ngs(
gener
all
yonacor
e),
t
hewi
ndi
ngsbei
ngel
ect
ri
cal
l
yconnect
edt
othecommut
ator
.Theabov
edi
agr
am
showsacommonmot
orl
ayout-
-wi
tht
her
otori
nsi
det
hest
ator(
fi
eld)magnet
s.
Thegeomet
ryoft
hebr
ushes,commut
atorcont
act
s,andr
otorwi
ndi
ngsar
e
sucht
hatwhenpoweri
sappl
i
ed,
thepol
ari
ti
esoft
heener
gizedwi
ndi
ngandt
hest
ator
magnet
(s)ar
emi
sal
i
gned,andt
her
otorwi
l
lrot
ateunt
ili
tisal
mostal
i
gnedwi
tht
he
st
ator
'sf
iel
dmagnet
s.Ast
her
otorr
eachesal
i
gnment
,thebr
ushesmov
etot
henext
commut
atorcont
act
s,andener
gizet
henextwi
ndi
ng.Gi
venourexampl
etwo-
pol
e
mot
or,
ther
otat
ionr
ever
sest
hedi
rect
ionofcur
rentt
hrought
her
otorwi
ndi
ng,
leadi
ng
t
oa"
fl
ip"oft
her
otor
'smagnet
icf
iel
d,dr
ivi
ngi
ttocont
inuer
otat
ing.
20
Fi
g2.
7:DCMot
orwi
thTwoPol
es
I
nreall
i
fe,
though,
DCmot
orswi
l
lal
way
shav
emor
ethant
wopol
es(
thr
eei
sa
v
erycommonnumber
).I
npar
ti
cul
ar,t
hisav
oids"
deadspot
s"i
nthecommut
ator
.You
cani
magi
nehowwi
thourexampl
etwo-
pol
emot
or,
ift
her
otori
sexact
lyatt
hemi
ddl
e
ofi
tsr
otat
ion(
per
fect
lyal
i
gnedwi
tht
hef
iel
dmagnet
s),i
twi
l
lget"
stuck"t
her
e.
Meanwhi
l
e,wi
that
wo-
pol
emot
or,t
her
eisamomentwher
ethecommut
atorshor
ts
out t
he power suppl
y(i
.e.
,bot
h br
ushes t
ouch bot
h commut
ator cont
act
s
si
mul
taneousl
y).Thi
swoul
dbebadf
ort
hepowersuppl
y,wast
eener
gy,anddamage
mot
orcomponent
saswel
l
.Yetanot
herdi
sadv
ant
ageofsuchasi
mpl
emot
ori
sthati
t
woul
dexhi
bitahi
ghamountoft
orque"
ri
ppl
e".
Sosi
ncemostsmal
lDC mot
orsar
eofat
hree-
pol
edesi
gn,l
et'
sti
nkerwi
tht
he
wor
kingsofonev
iaani
nter
act
iveani
mat
ion(
Jav
aScr
iptr
equi
red)
:
Fi
g2.
8:DCMot
orwi
thThr
eePol
es
You'
l
lnot
iceaf
ew t
hingsf
rom t
his-
-namel
y,onepol
eisf
ull
yener
gizedata
t
ime(
butt
woot
her
sar
e"par
ti
all
y"ener
gized)
.Aseachbr
usht
ransi
ti
onsf
rom one
commut
atorcont
actt
othenext
,onecoi
l
'sf
iel
dwi
l
lrapi
dlycol
l
apse,
ast
henextcoi
l
's
f
iel
dwi
l
lrapi
dlychar
geup(
thi
soccur
swi
thi
naf
ew mi
crosecond)
.We'
l
lseemor
e
aboutt
heef
fect
soft
hisl
ater
,buti
nthemeant
imey
oucanseet
hatt
hisi
sadi
rect
r
esul
toft
hecoi
lwi
ndi
ngs'
ser
ieswi
ri
ng.
2.
2.4PI
EZO-
BUZZER
Abuzzerorbeeperi
sanaudi
osi
gnal
i
ngdev
ice,whi
chmaybemechani
cal
,
el
ect
romechani
cal
,orpi
ezoel
ect
ri
c.Ty
picalusesofbuzzer
sand beeper
sincl
ude
al
arms,t
imer
sandconf
ir
mat
ionofuseri
nputsuchasamousecl
i
ckorkey
str
oke.A
21
pi
ezoel
ect
ri
cel
ementmaybedr
ivenbyanosci
l
lat
ingel
ect
roni
cci
rcui
torot
heraudi
o
si
gnalsour
ce,dr
ivenwi
thapi
ezoel
ect
ri
caudi
oampl
i
fier
.Soundscommonl
yusedt
o
i
ndi
cat
ethatabut
tonhasbeenpr
essedar
eacl
i
ck,
ari
ngorabeep.I
tmostcommonl
y
consi
sts ofa numberofswi
tches orsensor
s connect
ed t
o a cont
roluni
tthat
det
ermi
nesi
fandwhi
chbut
tonwaspushedorapr
esett
imehasl
apsed,andusual
l
y
i
l
lumi
nat
esal
i
ghtont
heappr
opr
iat
ebut
tonorcont
rolpanel
,andsoundsawar
ningi
n
t
hef
orm ofacont
inuousori
nter
mit
tentbuzzi
ngorbeepi
ngsound.I
nit
ial
l
ythi
sdev
ice
wasbasedonanel
ect
romechani
calsy
stem whi
chwasi
dent
icalt
oanel
ect
ri
cbel
l
wi
thoutt
hemet
algong(
whi
chmakest
her
ingi
ngnoi
se)
.Of
tent
heseuni
tswer
e
anchor
edt
oawal
lorcei
l
ingandusedt
hecei
l
ingorwal
lasasoundi
ngboar
d.Anot
her
i
mpl
ement
ati
onwi
thsomeAC-
connect
eddev
iceswast
oimpl
ementaci
rcui
ttomake
t
heACcur
renti
ntoanoi
sel
oudenought
odr
iveal
oudspeakerandhookt
hisci
rcui
tup
t
oacheap8-
ohm speaker
.Nowaday
s,i
tismor
epopul
art
ouseacer
ami
c-based
pi
ezoel
ect
ri
csounderl
i
keaSonal
ertwhi
chmakesahi
gh-
pit
chedt
one.Usual
l
ythese
wer
ehookedupt
o"dr
iver
"ci
rcui
tswhi
chv
ari
edt
hepi
tchoft
hesoundorpul
sedt
he
soundonandof
f.
Fi
g2.
9:Pi
ezo-
Buzzer
I
ngameshowsi
tisal
soknownasa"
lockoutsy
stem,
"becausewhenoneper
son
si
gnal
s("
buzzesi
n")
,al
lot
her
sar
elockedoutf
rom si
gnal
i
ng.Sev
eralgameshows
hav
elar
gebuzzerbut
tonswhi
char
eident
if
iedas"
plunger
s".
Thewor
d"buzzer
"comesf
rom t
her
aspi
ngnoi
set
hatbuzzer
smadewhent
hey
wer
eel
ect
romechani
caldev
ices,
oper
atedf
rom st
epped-
downACl
i
nev
olt
ageat50or
60cy
cles.Ot
hersoundscommonl
yusedt
oindi
cat
ethatabut
tonhasbeenpr
essed
22
ar
ear
ingorabeep.Somesy
stems,suchast
heoneusedonJeopar
dy!
,makeno
noi
seatal
l
,inst
eadusi
ngl
i
ght
.
Fi
g2.
10:Ty
pesofBuzzer
s
Fi
g2.
11St
ruct
ureofBuzzer
SPECI
FICATI
ONS:
Rat
edVol
tage:
Api
ezo-
buzzeri
sdr
ivenbysquar
ewav
es(
Vp-
p).
Oper
ati
ngVol
tage: Fornor
maloper
ati
ng.Buti
tisnotguar
ant
eedt
omaket
he
mi
nimum SPLundert
her
atedv
olt
age.
Consumpt
ionCur
rent
:Thecur
renti
sst
abl
yconsumedundert
her
egul
aroper
ati
on.
Howev
er,
itnor
mal
l
ytakest
hreet
imesofcur
rentatt
hemomentofst
art
ingt
owor
k.
23
Capaci
tance:A pi
ezo-
buzzercanmakehi
gherSPLwi
thhi
ghercapaci
tance,buti
t
consumesmor
eel
ect
ri
cit
y.
Fi
g2.
12:BuzzerWor
kingTheor
y
SoundOut
put
:Thesoundout
puti
smeasur
edbydeci
belmet
er.Appl
yi
ngr
atedv
olt
age
andsquar
ewav
es,
andt
hedi
stanceof10cm.
Rat
edFr
equency
:Abuzzercanmakesoundonanyf
requenci
es,butwesuggestt
hat
t
hehi
ghestandt
hemostst
abl
eSPLcomef
rom t
her
atedf
requency
.
Oper
ati
ngTemper
atur
e:Keepwor
kingwel
lbet
ween-
30℃ and+70℃.
2.
2.5VI
BRATI
ONMOTOR
Vi
brat
ionmot
ori
sav
erypower
fulanduser
-f
ri
endl
ymot
or,whi
chcanbeused
wi
thav
ari
etyofpr
oduct
s.Thi
sincl
udespager
s,GPSdev
ices,mobi
l
ephonesorev
en
t
oys.
Ther
e ar
etwo basi
cty
pes ofv
ibr
ati
on mot
or.
An
eccent
ri
crot
ati
ng mass
v
ibr
ati
onmot
or(
ERM)
usesasmal
l
unbal
ancedmassonaDCmot
orwheni
trot
atesi
t
cr
eat
esaf
orcet
hatt
ransl
atest
ovi
brat
ions.
Al
i
nearr
esonantact
uat
or(
LRA)
cont
ains
asmal
li
nter
nal
massat
tachedt
oaspr
ing,
whi
chcr
eat
esaf
orcewhendr
iven.
WORKI
NG:
Thebart
ypei
sal
socal
l
edacy
li
ndershapev
ibr
atormot
or.Basi
cal
l
y,t
hismot
ori
s
bal
ancedi
mpr
oper
ly.Thi
sfor
cemov
est
hemot
or,andi
tshi
gh-
speeddi
slocat
ion
makest
hemot
ort
ovi
brat
e.Thi
scanbeal
ter
edwi
tht
heat
tachedwei
ghtmass,t
he
di
stancet
otheshaf
t,&t
hespeedatwhi
cht
hemot
ort
urns
24
Fi
g2.
13:Vi
brat
ionMot
or
Thecent
ri
fugalst
rengt
hwhi
chi
spr
oducedbyt
heunbal
ancedwei
ghtr
otat
ionwi
l
l
causet
hemot
ort
hrobi
ntwoaxesl
i
keX-
axi
sandZ-
axi
s.
Fr
equency
:fv
ibr
ati
on=
(Mot
orRPM)
/60
For
ce:
Fvi
brat
ion=
m *r*w2
Wher
e‘m’i
sel
ect
ri
cwei
ghtmass,‘
r’i
stheof
fsetdi
stanceofmassand‘
ω’i
sthe
mot
or’
sspeed.
ω=2πf
Thecent
ri
fugalf
orcecanbemeasur
edusi
ngt
heabov
eequat
ions.Basedont
he
r
elat
ionshi
pofev
erycomponenti
ntheabov
eequat
ions,
wecanconcl
udet
hatahi
gh-
wei
ghtmasswi
thahi
gh-
off
setf
rom t
heshaf
twi
l
lpr
oducemor
efor
ce&v
ibr
ati
on
ampl
i
tude.I
naddi
ti
on,whent
hei
ncr
easedv
olt
agei
ssuppl
i
edt
othev
ibr
atormot
or,
t
heni
twi
l
lenhancei
tsspeed,
frequency&t
heampl
i
tude.
SPECI
FICATI
ONS:
Cor
elessmot
ordesi
gn
Rat
edv
olt
age:
3VDC
Oper
ati
ngr
ange:
1.7V-3.
6VDC
Rat
edspeed:
14,
000RPM (
±2000RPM)
25
Vi
brat
ionampl
i
tude:
1.5
Rat
edcur
rent
:75mA
St
all
cur
rent
:140mA(
maxi
mum)
Pr
e-wi
redwi
thr
edandbl
ackl
eads,
90mm i
nlengt
h
Di
mensi
ons(
LxØ)
:12x6mm
Wei
ght
:1.
85g
2.
2.6BATTERY(
9V)
:
The
nine-
vol
tbat
ter
y,or
9-
vol
tbat
ter
y,i
sacommonsi
zeofbat
ter
ythatwas
i
ntr
oduced f
ort
heear
ly
tr
ansi
storr
adi
os.I
thasa r
ect
angul
arpr
ism shapewi
th
r
oundededgesandapol
ari
zedsnapconnect
oratt
het
op.Thi
sty
pei
scommonl
yused
i
n wal
ki
e-t
alki
es,
clocks
and
smoke det
ect
ors. The ni
ne-
vol
t bat
ter
y f
ormat i
s
commonl
yav
ail
abl
einpr
imar
ycar
bon-
zincandal
kal
i
nechemi
str
y,i
npr
imar
yli
thi
um
i
rondi
sul
fi
de,andi
nrechar
geabl
efor
minni
ckel
-cadmi
um,ni
ckel
-met
alhy
dri
deand
l
i
thi
um-
ion.Mer
cur
y-oxi
debat
ter
iesoft
hisf
ormat
,oncecommon,hav
enotbeen
manuf
act
ured i
n manyy
ear
s due t
othei
rmer
cur
ycont
ent
.
Desi
gnat
ions
fort
his
f
ormati
ncl NEDA 1604
ude I
and EC 6F22
(f
orzi
nc-
car
bon)or
MN1604 6LR61
(f
or
al
kal
i
ne)
.The si
ze,r
egar
dless of chemi
str
y,i
s commonl
y desi
gnat
ed
PP3—a
desi
gnat
ionor
igi
nal
l
yreser
vedsol
elyf
orcar
bon-
zinc,ori
nsomecount
ri E
es,
or
E-
bl
ock.
Mostni
ne-
vol
tal
kal
i
nebat
ter
iesar
econst
ruct
edofsi
xindi
vi
dual1.
5 VLR61
cel
l
sencl
osedi
nawr
apper
.Thesecel
l
sar
esl
i
ght
lysmal
l
ert
hanLR8D425
AAAA
cel
l
s andcanbeusedi
nthei
rpl
acef
orsomedev
ices,ev
ent
hought
heyar
e3.
5 mm
shor
ter
.Car
bon-
zinct
ypesar
emadewi
thsi
xfl
atcel
l
sinast
ack,encl
osedi
na
moi
stur
e-r
esi
stantwr
appert
opr
eventdr
ying.Pr
imar
yli
thi
um t
ypesar
emadewi
th
t
hreecel
l
sinser
ies.
26
Fi
g2.
14:9VBat
ter
y
SPECI
FICATI
ONS:
Const
ant9VOut
putt
il
ll
ast
s
Met
alJacketBody
GoodBui
l
tQual
i
tyandhenceLeakpr
oof
Easyt
oinst
all
andRepl
ace
Cor
rosi
onf
reeConnect
orPoi
ntf
orl
ong-
ter
m use
0%Mer
cur
yandCadmi
um.Env
ironment
-f
ri
endl
y
OEM Compat
ibl
e.
2.
3SOFTWAREDESCRI
PTI
ON
2.
3.1CREATI
NGPROJECTI
NARDUI
NO1.
7.11VERSI
ON
Ar
dui
noUnoI
nst
all
ati
on:I
nthi
swewi
l
lgetknow oft
hepr
ocessofi
nst
all
ati
onof
Ar
dui
noI
DEandconnect
ingAr
dui
noUnot
oAr
dui
noI
DE.
St
ep1-Fi
rstwemusthav
eourAr
dui
noboar
d(wecanchooseourf
avor
it
eboar
d)and
aUSBcabl
e.I
ncaseweuseAdr
ianaUNO,
Ardui
noDuemi
l
anov
e,Nano,
Ardui
noMega
2560,orDi
eci
mil
a,wewi
l
lneedast
andar
dUSBcabl
e(Apl
ugt
oBpl
ug)
,tI
ncasewe
useAr
dui
noNano,
wewi
l
lneedanAt
oMi
ni-
Bcabl
e.
St
ep2-Downl
oadAr
dui
noI
DESof
twar
e.Wecangetdi
ff
erentv
ersi
onsofAr
dui
noI
DE
f
rom t
he Downl
oad page on t
he Ar
dui
no Of
fi
cialwebsi
te.We mustsel
ectwer
27
sof
twar
e,whi
ch i
s compat
ibl
e wi
th weroper
ati
ng sy
stem (
Windows,I
OS,or
Li
nux)
.Af
terwearf
il
edownl
oadi
scompl
ete,
unzi
pthef
il
e.
Fi
g2.
15Downl
oadi
ngAr
dui
noI
DESof
twar
e
St
ep3−Powerupourboar
d.TheAr
dui
noUno,
Mega,
Duemi
l
anov
eandAr
dui
noNano
aut
omat
ical
l
ydr
aw powerf
rom ei
ther
,theUSBconnect
iont
othecomput
eroran
ext
ernalpowersuppl
y.I
fwear
eusi
nganAr
dui
noDi
eci
mil
a,wehav
etomakesur
e
t
hatt
heboar
disconf
igur
edt
odr
aw powerf
rom t
heUSBconnect
ion.Thepower
sour
cei
ssel
ect
edwi
thaj
umper
,asmal
lpi
eceofpl
ast
ict
hatf
it
sont
otwooft
het
hree
pi
nsbet
weent
heUSBandpowerj
acks.
Checkt
hati
tisont
het
wopi
nscl
osestt
otheUSBpor
t.Connectt
heAr
dui
noboar
dto
wearcomput
erusi
ngt
heUSBcabl
e.Thegr
eenpowerLED(
label
edPWR)shoul
dgl
ow.
St
ep4−LaunchAr
dui
noI
DE.
Af
terourAr
dui
noI
DEsof
twar
eisdownl
oaded,
weneedt
ounzi
pthef
older
.Insi
det
he
f
older
,wecanf
indt
heappl
i
cat
ioni
conwi
thani
nfi
nit
ylabel
(appl
i
cat
ion.
exe)
.
Fi
g2.
16Launchi
ngAr
dui
noI
DESof
twar
e
28
Doubl
ecl
i
ckt
hei
cont
ost
artt
heI
DE.
ep5−Openourf
St ir
stpr
oject
.
Oncet
hesof
twar
est
art
s,wehav
etwoopt
ions
*Cr
eat
eanewpr
oject
*Openanexi
sti
ngpr
ojectexampl
e
Tocr
eat
eanewpr
oject
,sel
ectFi
l
e→ New
Toopenanexi
sti
ngpr
ojectexampl
e,sel
ectFi
l
e→ Exampl
e→ Basi
cs→ Bl
i
nk.
Her
e,wear
esel
ect
ingj
ustoneoft
heexampl
eswi
tht
henameBl
i
nk.I
ttur
nst
heLED
onandof
fwi
thsomet
imedel
ay.Wecansel
ectanyot
herexampl
efr
om t
hel
i
st.
Fi
g2.
17:Cr
eat
ingaNewPr
ojectUsi
ngAr
dui
noI
DE
ep6−Sel
St ectourAr
dui
noboar
d.
29
Fi
g2.
18:Sel
ect
ingAr
dui
noUnoi
nAr
dui
noI
DE
Toav
oidanyer
rorwhi
l
eupl
oadi
ngwearpr
ogr
am t
otheboar
d,wemustsel
ectt
he
cor
rectAr
dui
no boar
d name,whi
ch mat
ches wi
tht
he boar
d connect
ed t
o wer
comput
er.
Got
oTool
s→ Boar
dandsel
ectwearboar
d.
Her
e,wehav
esel
ect
edAr
dui
noUnoboar
daccor
dingt
oourt
utor
ial
,butwemust
sel
ectt
henamemat
chi
ngt
heboar
dthatwear
eusi
ng.
ep7−Sel
St ectwearser
ial
por
t.
Sel
ectt
heser
ialdev
iceoft
heAr
dui
noboar
d.Got
oTool
s→ Ser
ialPor
tmenu.Thi
sis
l
i
kel
ytobeCOM3orhi
gher(
COM1andCOM2ar
eusual
l
yreser
vedf
orhar
dwar
eser
ial
por
ts)
.
Tof
indout
,wecandi
sconnectwerAr
dui
noboar
dandr
e-opent
hemenu,
theent
ryt
hat
di
sappear
sshoul
dbeoft
heAr
dui
noboar
d.Reconnectt
heboar
dandsel
ectt
hatser
ial
por
t.
ep8−Upl
St oadt
hepr
ogr
am t
owearboar
d.Bef
oreexpl
aini
nghowwecanupl
oadour
pr
ogr
am t
otheboar
d,wemustdemonst
rat
ethef
unct
ionofeachsy
mbolappear
ingi
n
t
heAr
dui
noI
DEt
ool
bar
.
30
Fi
g2.
19:Sel
ect
ingSer
ialPor
tinAr
dui
noI
DE
Fi
g2.
20:Upl
oadi
ngPr
ogr
am t
oAr
dui
noBoar
d
A−Usedt
ochecki
fther
eisanycompi
l
ati
oner
ror
.
B−Usedt
oupl
oadapr
ogr
am t
otheAr
dui
noboar
d.
C−Shor
tcutusedt
ocr
eat
eanewsket
ch.
D−Usedt
odi
rect
lyopenoneoft
heexampl
esket
ch.
E−Usedt
osav
ewearsket
ch.
F−Ser
ialmoni
torusedt
orecei
veser
ialdat
afr
om t
heboar
dandsendt
heser
ialdat
a
t
otheboar
d.Now,si
mpl
ycl
i
ckt
he"
Upl
oad"but
toni
ntheenv
ironment
.Wai
taf
ew
seconds;wewi
l
lseet
heRXandTXLEDsont
heboar
d,f
lashi
ng.I
ftheupl
oadi
s
successf
ul,
themessage
31
"
Doneupl
oadi
ng"wi
l
lappeari
nthest
atusbar
.
e−I
Not fwehav
eanAr
dui
noMi
ni,NG,orot
herboar
d,weneedt
opr
esst
her
eset
but
tonphy
sical
l
yont
heboar
d,i
mmedi
atel
ybef
orecl
i
cki
ngt
heupl
oadbut
tonont
he
Ar
dui
noSof
twar
e.
CHAPTER-
3
BLOCKDI
AGRAM ANDI
TSWORKI
NGPRI
NCI
PLE
I
nthi
schapt
er,wepr
ovi
det
hedet
ail
soft
headopt
edmet
hodf
ordet
ect
ingt
he
dr
owsi
nessandal
ert
ingt
hedr
iverwhi
l
edr
ivi
ng.Thebl
ockdi
agr
am oft
hissy
stem
i
ncl
udesbat
ter
y(9V)
,IRSensor
,Mi
crocont
rol
l
er,DCMot
orandaVi
brat
orwhi
chi
sas
shownbel
ow:
3.
1BLOCKDI
AGRAM:
32
Fi
g3.
1:Bl
ockDi
agr
am ofDr
owsi
nessDet
ect
ionandAl
ert
ingSy
stem
Themai
nbl
ockoft
heabov
ebl
ockdi
agr
am i
sMi
crocont
rol
l
erwhi
chi
sATmega328.
3.
2ATmega328:
ATmega328
i
san 8-
bitand 28 Pi
nsAVR
Micr
ocont
rol
l
er,manuf
act
ured by
Mi
crochi
p,f
oll
owsRI
SCAr
chi
tect
ureandhasaf
lasht
ypepr
ogr
am memor
yof32KB.I
t
hasanEEPROM memor
yof1KBandi
tsSRAM memor
yisof2KB. I
thas 8 Pi
nfor
ADCoper
ati
ons,whi
chal
lcombi
nest
ofor
m Por
tA(
PA0–PA7)
.Ital
sohas3bui
l
t-i
n
Ti
mer
s,t
wooft
hem ar
e8Bi
tti
mer
swhi
l
ethet
hir
donei
s16-
BitTi
mer
.
3.
2.1PI
NDI
AGRAM
33
Fi
g3.
2:Pi
nDi
agr
am ofATmega328
3.
2.2PI
NSDECRI
PTI
ON:
VCC
i
sadi
git
alv
olt
agesuppl
y.
AVCC
i
sasuppl
yvol
tagepi
nforanal
ogt
odi
git
alconv
ert
er.
GND
denot
esGr
oundandi
thasa0V.
Por
tA
consi
stsoft
hepi
nsf
rom
PA0
to
PA7.
Thesepi
nsser
veasanal
ogi
nputt
o
anal
ogt
odi
git
alconv
ert
ers.I
fanal
ogt
odi
git
alconv
ert
eri
snotused,
por
t
A act
sasan
ei
ght(
8)bi
tbi
dir
ect
ional
input
/out
putpor
t.
Por
tB
consi
stsoft
hepi
nsf
rom
PB0
to
PB7.
Thi
spor
tisan8bi
tbi
dir
ect
ionalpor
t
hav
ingani
nter
nal
pul
l
-upr
esi
stor
.
34
Tabl
e3.
1:Pi
nsofATmega328
Por
tC
consi
sts oft
he pi
ns f
rom
PC0
to
PC7.
The out
putbuf
fer
s of
por
tC
has
sy
mmet
ri
cal
dri
vechar
act
eri
sti
cswi
thsour
cecapabi
l
ityaswel
lhi
ghsi
nk.
Por
tD
consi
stsoft
hepi
nsf
rom
PD0
to
PD7.
I
tisal
soan8bi
tinput
/out
putpor
t
hav
ingani
nter
nal
pul
l
-upr
esi
stor
.
AREF
i
sananal
ogr
efer
encepi
nforanal
ogt
odi
git
alconv
ert
er.
35
SPECI
FICATI
ONS:
Tabl
e3.
2:Speci
fi
cat
ionsofATmega328
3.
3WORKI
NGPRI
NCI
PLE
Ourpr
otot
ypeconsi
stsofaMi
crocont
rol
l
er,anI
Rsensor
,9VBat
ter
y,Buzzer
,
Vi
brat
orandaMot
or.Theconnect
ionsf
ort
hissy
stem ar
easf
oll
ows:
CONNECTI
ONS:
I
R based Ey
e-bl
i
nk det
ect
ion gl
asses ar
e connect
ed t
o A0 pi
n oft
he
mi
crocont
rol
l
er.
DCmot
ori
sconnect
edt
othe3rdpi
noft
hemi
crocont
rol
l
er.
Buzzeri
sconnect
edt
othe6thpi
noft
hemi
crocont
rol
l
er.
Vi
brat
ori
sconnect
edt
othe9thpi
noft
hemi
crocont
rol
l
er.
WORKI
NG:
Her
eIRsensori
sconsi
der
edasani
nputt
othemi
crocont
rol
l
er.Buzzer
,vi
brat
or
36
andmot
orar
econsi
der
edasout
put
si.
e.asact
uat
orst
othemi
crocont
rol
l
er.Fi
rst
ly
t
hepowersuppl
yisgi
vent
othesy
stem t
hrough9Vbat
ter
y.TheI
Rsensoratt
hei
nput
det
ect
stheEy
eBl
i
nkPat
ter
noft
heper
sonwhi
l
edr
ivi
ng.Whent
hesy
stem get
s
power
edup,
themot
orst
art
srot
ati
ngr
epr
esent
ingt
hev
ehi
clemov
ement
.Whent
heI
R
det
ect
sthedr
owsi
nessoft
hedr
iver
,itsendst
hei
nfor
mat
iont
othemi
crocont
rol
l
er.
Accor
dingt
othei
nst
ruct
ionsgi
vent
othemi
crocont
rol
l
er,
whenev
ert
heper
son’
sey
es
r
emai
ncl
osedf
or1.
5seconds,att
heout
putbuzzerandv
ibr
atorst
art
srespondi
ng
t
hati
sbuzzermakessoundandv
ibr
atorst
art
svi
brat
ingsot
hedr
iverget
sal
ert
ed.
Thi
sal
ert
sthedr
ivert
owakeupi
nor
dert
opr
eventt
hehappeni
ngofanyr
oad
acci
dent
s.Si
mul
taneousl
ythemot
orst
opsr
otat
ing sl
owl
ywhi
chr
epr
esent
sthat
mov
ementofv
ehi
cl
ewi
l
lbest
oppedsl
owl
yandt
hei
gni
ti
onwi
l
lgett
urnedOFF.
37
3.
4FLOWCHART St
art
Driverdri
vingt he
v
ehiclebywear i
ngIR
basedEy e-bli
nk
detecti
nggl asses
Dri
veri
sfeel
ingdrowsy
andmightf
allasl
eep
If
Driv
er N
fel
l O
asl
eep
Vehi
cledoesn’
tstops
andnoal er
tofwakeup
tothedri
ver.
YE
IRdet ectsthatdriverhas
sleptandsendsi nfoto
microcont r
oll
er,the
STOP
microcontroll
erwilltur
non
Buzzerandv ibr
atorand
vehicleigniti
onturnsOFF
slowly
Fi
g3.
5:Fl
owChar
tofWor
kingofDr
owsi
nessDet
ect
ionandAl
ert
ingSy
stem
38
CHAPTER-
4
ADVANTAGES,
APPLI
CATI
ONSANDFUTURESCOPE
I
nthi
schapt
erwewi
l
lgett
oknowaboutt
headv
ant
ages,appl
i
cat
ionsandf
utur
e
scopeoft
headopt
edsy
stem.
4.
1APPLI
CATI
ONSANDADVANTAGES
Thi
ssy
stem canbei
mpl
ement
edi
nanyv
ehi
cle
I
tisav
erysi
mpl
eset
up
Maj
orr
oadacci
dent
sandsev
erei
njur
iescanbepr
event
edt
hrought
hissy
stem
Accur
ater
esul
tsar
epr
ovi
dedusi
ngt
hissy
stem
I
tpr
ovi
deshi
ghef
fi
ciency
I
tcanbei
mpl
ement
edatv
eryl
owcost
Mostr
eli
abl
einnat
ure
I
tispor
tabl
e
Lowpowerconsumpt
ioni
.e.i
trequi
resv
eryl
esspowert
obeoper
ated
Economi
clossesduet
ocr
ashi
ngofv
ehi
clescanbeav
oidedt
hrought
his
sy
stem
St
rayv
isi
bleandI
Rli
ghtnotef
fect
ed
4.
2FUTURESCOPE
Thi
spr
otot
ypecanbeext
endedt
oimpl
ementusi
ng
I
tcanbeusedwi
rel
essl
yusi
ngwi
rel
essmodul
esl
i
keWi
-Fi
,Bl
uet
oot
horZi
gbee
39
et
c.
Usi
ngNanot
echnol
ogyt
hiswhi
l
esy
stem canbemount
edont
othegoggl
es
i
tsel
fwhi
chr
esul
tsi
nthecompat
ibi
l
ityofusage.
CHAPTER-
5
CONCLUSI
ON
5.
1CONCLUSI
ON
Anoni
ntr
usi
vesy
stem t
olocal
i
zet
heey
ebl
i
nkhasbeendev
elopedi
nor
dert
o
det
ectt
hedr
owsi
nessandal
ertt
heper
son.Usi
ngI
Rsensort
hesy
stem i
sabl
eto
deci
dewhet
hert
heper
son’
sey
esar
eopened orcl
osed whi
ch comeundert
he
det
ect
ionsy
stem.Whent
heey
eswi
l
lbecl
osedf
or1.
5seconds,awar
ningsi
gnali
s
i
ssuedwhi
chcomesundert
heal
ert
ingsy
stem.Theadopt
edmet
hodi
sef
fect
ivet
han
ot
hermet
hodsbecauset
heobt
ainedr
esul
tsar
etr
ueandaccur
ate.Thr
ought
his
sy
stem weachi
evedf
oll
owi
ng:
Dr
owsi
nessdet
ect
ionandal
ert
ingsy
stem achi
eveshi
ghl
yrel
i
abl
edet
ect
ionof
dr
owsi
ness
Thi
smet
hodof
fer
sanoni
ntr
usi
veappr
oacht
odet
ectdr
owsi
nesswi
thoutt
he
annoy
anceandi
nter
fer
ence
Theadopt
edsy
stem wor
ksi
nbot
hday
timeandni
ghtt
imecondi
ti
on
Heav
yvehi
clescanal
soadoptt
hismet
hod
5.
2RESULT
40
Hence,Dr
owsi
nessDet
ect
ionandAl
ert
ingSy
stem f
orr
oadsaf
etyhasbeen
achi
evedandf
oll
owi
ngshowst
heout
putr
esul
tfort
hispr
oject
:
41
Fi
g5.
1:Dr
owsi
nessDet
ect
ionandAl
ert
ingSy
stem Pr
otot
ype
42
5.
3APPENDI
X
SOURCECODE:
i
nti
r=A0;
i
ntv
ib=9;
i
ntbuzz=6;
i
ntmot
or=3;
v
oidset
up(
)
pi
nMode(
ir
,I
NPUT)
;
pi
nMode(
vib,
OUTPUT)
;
pi
nMode(
buzz,
OUTPUT)
;
pi
nMode(
mot
or,
OUTPUT)
;
v
oidl
oop(
)
i
nti
r=anal
ogRead(
A0)
;
i
f(
ir<50)
anal
ogWr
it
e(buzz,
255)
;
anal
ogWr
it
e(v
ib,
200)
;
anal
ogWr
it
e(mot
or,
200)
;
del
ay(
500)
;
anal
ogWr
it
e(mot
or,
150)
;
43
del
ay(
500)
;
anal
ogWr
it
e(mot
or,
100)
;
del
ay(
500)
;
anal
ogWr
it
e(mot
or,
0);
del
ay(
500)
;
anal
ogWr
it
e(buzz,
0);
anal
ogWr
it
e(v
ib,
0);
anal
ogWr
it
e(mot
or,
255)
;
el
se
anal
ogWr
it
e(buzz,
0);
anal
ogWr
it
e(v
ib,
0);
anal
ogWr
it
e(mot
or,
255)
;
del
ay(
2000)
;
anal
ogWr
it
e(buzz,
0);
anal
ogWr
it
e(v
ib,
0);
anal
ogWr
it
e(mot
or,
255)
;
44
5.
4REFERENCES
1.
"DRI
VER FATI
GUE AND ROAD ACCI
DENTS A LI
TERATURE REVI
EW and
POSI
TION PAPER"
.Roy
alSoci
etyf
ort
hePr
event
ionofAcci
dent
s.Febr
uar
y
2001.
2."
4.1.
03.Dr
iverDr
owsi
nessDet
ect
ionSy
stem f
orCar
s".Ret
ri
eved
2015-
11-
05.
3.Sgambat
i,Fr
ank,
Dri
verDr
owsi
nessDet
ect
ion
4.Hossai
n,M.Y.
;Geor
ge,F.P.(
2018)
.
"I
OT BasedReal
-Ti
meDr
owsyDr
ivi
ng
Det
ect
ionSy
stem f
ort
hePr
event
ionofRoadAcci
dent
s".
2018I
nter
nat
ional
Conf
erenceonI
ntel
l
igentI
nfor
mat
icsandBi
omedi
calSci
ences(
ICI
IBMS)
.
3:
190–195.
doi
:
10.
1109/
ICI
IBMS.
2018.
8550026.
5.Wal
ger
,D.
J.;Br
eckon,T.
P.;Gaszczak,A.
;Popham,T.(
Nov
ember2014)
.
"A
Compar
isonofFeat
uresf
orRegr
essi
on-
basedDr
iverHeadPoseEst
imat
ion
underVar
yingI
ll
umi
nat
ionCondi
ti
ons"
(
PDF)
.
Proc.I
nter
nat
ionalWor
kshopon
Comput
ati
onal
Int
ell
i
gencef
orMul
ti
medi
aUnder
standi
ng.
6."
BMW model
upgr
ademeasur
est
aki
ngef
fectf
rom t
hesummerof2013"
.BMW.
2013-
06-
05.Ret
ri
eved
2015-
11-
05.
7."
Dri
verdr
owsi
nessdet
ect
ion"
.
Rober
tBoschGmbH.Ret
ri
eved
2015-
11-
05.
8."
AFI
L/LDWS(
count
rydependant
)"
.
9."
AFI
L/LDWS(
count
rydependant
)"
.
10.
DSOf
fi
ci
al(
2017-
03-
07)
,
DSDRI
VERATTENTI
ONMONI
TORI
NG,
ret
ri
eved
2017-
03-
08
11.
"DRI
VERALERT"
.Ar
chi
vedf
rom
theor
igi
nal
on2011-
05-
13.
12.
"Dr
iver At
tent
ion Moni
tor | 2017 Honda CR-
V | Honda Owner
s
Si
te"
.
owner
s.honda.
com.Ret
ri
eved
2018-
03-
23.
13.
"2018HondaAccor
dPr
essKi
t-Saf
etyandDr
iverAssi
sti
ve"
.
owner
s.honda.
com.
Ret
ri
eved
2018-
03-
23.
14.
"Dr
iverAt
tent
ionAl
ert-Mazdai
-ACTI
VSENSE"
.
15.
"ATTENTI
ON ASSI
ST:Dr
owsi
ness-
det
ect
ionsy
stem war
nsdr
iver
stopr
event
45
t
hem f
all
i
ngasl
eepmoment
ari
l
y".Ret
ri
eved
18Febr
uar
y 2010.
16.
Mer
cedes-
Benz'
saut
onomousdr
ivi
ngf
eat
uresdomi
nat
ethei
ndust
ry-
-andwi
l
l
f
ory
ear
s
17.
"2016Ni
ssanMaxi
ma"
4-DoorSpor
tsCar
"makesgl
obaldebutatNew Yor
k
I
nter
nat
ional
Aut
oShow"
.
NissanOnl
i
neNewsr
oom.Ret
ri
eved
4Apr
il
2015.
18.
"Fat
igueDet
ect
ion"
.Ret
ri
eved
6August
2014.
19.
"Vol
voCar
sint
roducesnew sy
stemsf
oral
ert
ingt
ir
edanddi
str
act
eddr
iver
s".
Ret
ri
eved
28August
2007.
20.
Coxwor
th,Ben(
3Januar
y2011)
.
"Ant
iSl
eepPi
l
otdet
ect
sdr
owsydr
iver
s".
Gi
zmag.
21.
"Bl
uet
oot
h HeadsetVi
go Knows When You Ar
e Ti
red Bef
ore You Do"
.
Ret
ri
eved
20Mar
ch
2014.
46