Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
A iProject iReport i
iOn
degree
In
By
ii
Department iOf iElectronics i& iCommunication iEngineering
KIET iGROUP iOF iINSTITUTIONS, iGHAZIABAD, iUP, iINDIA
(May, i2019)
2
Certificate
ABSTRACT
Nowadays idrinking iwater iis ithe imost iprecious iand ivaluable ifor iall ithe
ihuman ibeings, idrinking iwater iutilities ifaces inew ichallenges iin ireal-time
ioperation. iThis ichallenge ioccurred ibecause iof ilimited iwater iresources
igrowing ipopulation, iageing iinfrastructure ietc. iHence itherefore ithere iis ia
ineed iof ibetter imethodologies ifor imonitoring ithe iwater iquality.
Traditional imethods iof iwater iquality iinvolve ithe imanual icollection iof
iwater isample iat idifferent ilocations, ifollowed iby ilaboratory ianalytical
itechniques iin iorder ithe icharacter ithe iwater iquality. iSuch iapproaches itake
ilonger itime iand ino ilonger ito ibe iconsidered iefficient i. iAlthough ithe
icurrent imethodologies ianalysis ithe iphysical, ichemical iand ibiological
iagents, iit ihas iseveral idrawbacks: ia) ipoor ispatiotemporal icoverage ib) iit iis
ilabor iintensive iand ihigh icost(labor, ioperation; iand iequipment) ic)the ilack
iof ireal itime iwater iquality iinformation ito ienable icritical idecisions ifor
ipublic ihealth iprotection. iTherefore, ithere iis ia ineed ifor icontinuous ionline
iwater iquality imonitoring.
i
The ionline iwater imonitoring itechnologies ihave imade ia isignificant
iprogress ifor isource iwater isurveillance iand iwater iplant ioperation. iThe iuse
iof itheir itechnologies ihaving ihigh icost iassociated iwith iinstallation iand
icalibration iof ia ilarge idistributed iarray iof imonitoring isensors. iThe
ialgorithm iproposed ion ithe inew itechnology imust ibe isuitable ifor
iparticular iarea iand ifor ilarge isystem iis inot isuitable.
4
By ifocusing ion ithe iabove iissues iour ipaper idesign iand idevelop ia ilow
icost isystem ifor ireal itime imonitoring iof ithe iwater iquality iin iIOT
ienvironment. iIn iour idesign iARM-7 iis iused ias ia icore icontroller. iThe
idesign isystem iapplies ia ispecialized iIOT imodule ifor iaccessing isensor
idata ifrom icore icontroller ito ithe imobile. iThe isensor idata ican ibe iviewed
ion ithe imobile iusing ia ispecial iIP iaddress. iAdditionally ithe iIOT imodule
ialso iprovides ia iWi-Fi ifor iviewing ithe idata ion imobile.
5
ACKNOWLEDGEMENT
This iproject ibrings iwith ia isense iof isatisfaction, ibut iit iis inever icomplete
iwithout thanking ithose ipeople iwho imade iit ipossible iand iwhose iconstant
isupport ihas crowned iour iefforts iwith isuccess.
We iwould ialso ilike ito ithank iour iguide, iMrs. iShipra iSrivastava,
iAssistant Professor iof iElectronics iand icommunication iengineering, ifor iher
iexpert iguidance, encouragement iand ivaluable isuggestions iat ievery istep.
iWithout iher iincredible support iand isteady iinvolvement ithe iproject iwould
inot ihave ibeen ifruitful. i
We iare ithankful ito ithe iHead iof ithe iDepartment i(ECE) iDr. iSanjay
iSharma iand Additional iHead iof ithe iDepartment i(ECE) iDr. iVibhav
iKumar iSachan ifor ihis iconstant support iand iecouragement.
We iare ialso ithankful ito iall ithe iLecturers iand istaff imembers iof
iElectronics iand Communication iEngineering iDepartment ifor iproviding ius
iwith irequired ifacilities iand support itowards ithe icompletion iof ithe iproject.
LIST OF CONTENTS
CONTENTS PAGE NO
Abstract 1
Acknowledgement 5
List of contents 6
List of figures 8
1. Introduction
1.1 Embedded system 10
1.2 Microcontroller versus Microprocessor 11
1.3 Microprocessor 13
2. Literature Review & Function descript
2.1 LPC2148 Microcontroller 17
2.1.1 Features 19
2.1.2 Pin Configuration 19
2.1.3 Pin description 20
3. Circuit description
3.1 Block diagram 32
3.2 Circuit diagram 34
7
3.11 pH iSensor 45
CHAPTER-1
Introduction
11
CHAPTER-1
iINTRODUCTION
Since the embedded system is devoted to specific tasks, design engineers can
optimize it, reducing the size and cost of the product, or increasing the reliability
and performance. Some embedded systems area unit factory-made, benefiting
from economies of scale.
imicrocontroller iare inot ias iwell ias iknown ito ithe igeneral iPublic ior ito
imany iin ithe itechnical icommunity, ias iare ithe imost iglamorous i–
imicroprocessor. i iThe ipublic iis ihowever ivery iaware ithat i“something” iis
iresponsible ifor iall iof ithe ismart iVCRs, iclock iradios, iwashers, idryers,
ivideogames, itelephones, imicrowaves, iTVs, iautomobiles, itoys, ivending
imachines, icopiers, ielevators iand iirons iare iprogrammable iand iintelligent
iCompanies iare ialso iware ithat ibeing icompetitive iin ithis iage iof
imicrochipirequires itheir iproducts, ior ithe imachinery ithey iuse ito imake
ithose iproducts, ito ihave isome ismart.
The iblock idiagram iof ia imicrocontroller iis ishown, iwhich iis ia itrue
icomputer ion ichip. iThe idesign iincorporates iall iof ithe ifeatures ifound iin
ithe imicroprocessor. i iIt ialso ihas iadded ithe iother ifeatures ineeded ito
imake icomplete icomputer ilike iROM, iRAM, iparallel iI/O, iserial iI/O,
icounters iand ia iclock icircuit
The idesign iapproach iof ithe imicrocontroller imirrors ithat iof ithe
imicroprocessor imake ia isingle idesign ithat ican ibe iused iin ias imany
iapplications ias ipossible iin iorder ito isell, ihopefully ias imany ias ipossible. i
iThe imicroprocessor iaccomplishes ithe igoal iby ihaving ia ivery iflexible iand
14
The imicrocontroller idesign iuses ia imuch imore ilimited iset iof isingle iand
idouble ibyte iinstructions ithat iare iused ito imove ithe icode iand idata ifrom
iinternal imemory ito iALU iMany iinstructions iare icoupled iwith ipins ion
iintegrated icircuit ipackage, ithe ipins iare i“Programmable” i– ithat iis icapable
iof ihaving iseveral idifferent ifunctions idepending ion ithe iwishes iof ithe
iprogrammer. i iThe imicro icontroller iis iconcerned iwith igetting idata ifrom
iand ito iits iown ipins. i iThe iarchitecture iand iinstructions iare ioptimized ito
ihandle idata iin ibit iand ibyte isize. i
1.3 iMICROPROCESSOR:
A imicroprocessor ias ia iterm ihas icome ito ibe iknown iis ia igeneral-purpose
idigital icomputer icentral iprocessing iunit. iAlthough ipopularly iknown ias ia
icomputer ion ia ichip. iThe imicroprocessor icontains iarithmetic iand ilogic
15
iunits, iprogram icounter, iStack ipointer, isome iworking iregisters, iand iclock
itiming icircuit iand iinterrupts icircuits.
To imake ia icomplete icomputer ione imust iadd imemory iusually iRAM i&
iROM, imemory idecoders, ian ioscillator iand inumber iof iI/O idevices isuch
ias iparallel iand iserial idata iports iin iaddition ispecial ipurpose idevices isuch
ias iinterrupt ihandlers iand icounters
The ikey iterm iin idescribing ithe idesign iof ithe imicroprocessor iis i“general
ipurpose”. iThe ihardware idesign iof ia imicroprocessor iCPU iis iarranged iso
ithat ia ismall ior ivery ilarge isystem ican ibe iconfigured iaround ithe iCPU ias
ithe iapplication idemands.
Prime iuse iof imicroprocessor iis ito iread idata, iperform iextensive
icalculation ion ithat idata iand istore ithose icalculations iin ia imass istorage
idevice. iThe iprograms iused iby ithe imicroprocessor iare istored iin ithe imass
istorage idevice iand iloaded iin ithe iRAM ias ithe iuser idirects. iA ifew
imicroprocessor iprograms iare istored iin ithe iROM. iThe iROM ibased
iprograms iare iprimarily iare ismall ifixed iprograms ithat ioperate ion
iperipherals iand iother ifixed idevice ithat iare iconnected ito ithe isystem.
16
CHAPTER-2
Literature
View And
17
Functional
Description
CHAPTER-2
iLITERATURE VIEW AND FUNCTIONAL iDESCRIPTION
Due ito itheir itiny isize iand ilow ipower iconsumption, LPC2141/42/44/46/48
are ideal ifor iapplications iwhere iminiaturization iis ia ikey irequirement,
18
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
Figure2.1LPC2148 iIC
8 ikB ito i40 ikB iof ion-chip istatic iRAM iand i32 ikB ito i512 ikB iof ion-
chip iflash imemory; i128-bit iwide iinterface/accelerator ienables ihigh-
speed i60 iMHz ioperation.
Two i32-bit itimers/external ievent icounters i(with ifour icapture iand ifour
icomparechannels ieach), iPWM iunit i(six ioutputs) iand iwatchdog.
Low ipower iReal-Time iClock i(RTC) iwith iindependent ipower iand i32
ikHz iclock iinput.
20
Port i0 iis ia i32-bit iI/O iport iwith iindividual idirection icontrols ifor ieach
ibit. i iTotal iof i31 ipins iof ithe iPort i0 ican ibe iused ias ia igeneral ipurpose
ibidirectional idigital iI/Os iwhile iP0.31 iis ioutput ionly ipin. iThe ioperation
iof iport i0 ipins idepends iupon ithe ipin ifunction iselected ivia ithe ipin
iconnect iblock.
P0.0/TXD0/PWM1:
P0.1/RXD0/PWM3/EINT0:
P0.2/SCL0/ iCAP0.0:
P0.3/SDA0/ iMAT0.0/EINT1:
P0.3 i-General ipurpose iinput/output idigital ipin i(GPIO).
SDA0 i-I2C0 idata iinput/output, iopen-drain ioutput i(for iI2C-bus i
compliance).
MAT0.0 i-Match ioutput ifor iTimer i0, ichannel i0.
EINT1 i-External iinterrupt i1 iinput.
P0.4/SCK0/ iCAP0.1/AD0.6:
P0.5/MISO0/ iMAT0.1/AD0.7:
P0.6/MOSI0/ iCAP0.2/AD1.0:
24
P0.7/SSEL0/PWM2/EINT2:
P0.8/TXD1/PWM4/AD1.1:
P0.9/RXD1/ iPWM6/EINT3:
P0.10/RTS1/ iCAP1.0/AD1.2:
P0.11/CTS1/ iCAP1.1/SCL1:
P0.12/DSR1/MAT1.0/AD1.3:
P0.12 i-General ipurpose iinput/output idigital ipin i(GPIO).
DSR1 i-Data iSet iReady iinput ifor iUART1, iavailable iin
iLPC2144/46/48 ionly.
MAT1.0 i-Match ioutput ifor iTimer i1, ichannel i0.
26
P0.13/DTR1/ iMAT1.1/AD1.4:
P0.14/DCD1/EINT1/SDA1:
P0.15/RI1/ iEINT2/AD1.5:
P0.16/EINT0/MAT0.2/CAP0.2:
P0.17/CAP1.2/ iSCK1/MAT1.2:
P0.18/CAP1.3/MISO1/MAT1.3:
P0.19/MAT1.2/MOSI1/CAP1.2:
28
P0.20/MAT1.3/SSEL1/EINT3:
P0.21/PWM5/AD1.6/CAP1.3:
P0.23/VBUS:
P0.25/AD0.4/AOUT:
P0.28/AD0.1/CAP0.2/MAT0.2:
P0.29/AD0.2/CAP0.3/MAT0.3:
P0.30/AD0.3/EINT3/CAP0.0:
P0.31/UP_LED/CONNECT:
VSS: i i6, i18, i25, i42, i50 ipins iare ifor isupply ivoltage.
Ground:0 iV ireference.
0 iV ireference, ithis ishould inominally ibe ithe isame ivoltage ias iVSS, ibut
ishould ibe iisolated ito iminimize inoise iand ierror.
VDD i23, i43, i51 iI i3.3 iV ipower isupply: Power isupply ivoltage ifor
ithe icore iand iI/O iports.
This ishould ibe inominally iless ithan ior iequal ito ithe iVDD ivoltage ibut
ishould ibe iisolated ito iminimize inoise iand ierror, ilevel ion ithis iPin iis iused
ias ia ireference ifor iADC(s) iand iDAC.
32
VBAT iRTC ipower isupply ivoltage: 3.3 iV ion ithis ipin isupplies ithe ipower
ito ithe iRTC.
33
CHAPTER-3
Circuit
Description
CHAPTER i3
CIRCUIT iDESCRIPTION
3.1 iBLOCK iDIAGRAM
POWER
SUPPLY
34
M
I
C
TEMPERA R WIFI
TURE O U MODUL
MAX MOBILE
SENSOR C A E
O R 232
A
N T PH
D T SENSOR
R
C O LCD
LEVEL L
SENSOR L
E
R
ARM7
iiiiiiiiiii iiiiiii
LPC2148
LCD iDISPLAY:
ipixel imatrix. iLCD ihas itwo iregisters, inamely, iCommand iand iData
iregisters. iThe icommand iregister istores ithe icommand iinstructions
igiven ito ithe iLCD.
POWER iSUPPLY:
ixx iin i78xx iindicates ithe ifixed ioutput ivoltage iit iis idesigned ito
iprovide. i7805 iprovides i+5V iregulated ipower isupply. i
TEMPERAT ARM 7
URE MICRO
SENSOR CONTROLL
ER
WIFI
MODULE
LEVEL
SENSOR Mobile
pH
SENSOR
ASM/C
i i i i i i i i i i i i i i i i i i i i i i i iPROGRA
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
M
iiiiiiiiiii
i i i i i i i i i i i i i i i i iFigure i3.2 i: iCircuit idiagram
icode isize iapplications, ithe ialternative i16-bit iThumb imode ireduces icode
iby imore ithan i30 i% iwith iminimal iperformance ipenalty.
It iis ia iCentre itapped itransformer igiving i9-0-9v idc iat ithe ioutput iof i1A
icurrent. iIt iis icentre itapped ito ihave iboth i-ve i iand i+ve ihalf icycle iof i
iAC iwaveform ito icontribute ito idirect icurrent iand itransforming ienergy
iusing imutual iinduction.TTL ilogic icircuitry icannot iwork ion ivoltage iof
i230v iac i.so, iwe iare istepping idown iit ito i9v.
39
BRIDGE iRECTIFER:
Converting iboth ipolarities iof iinput iac ivoltage ito ione iof ithe iconstant
ipolarity iat iits ioutput idc icurrent. iYields ia ihigher imean ioutput ivoltage
40
i.Our icircuitry ican ionly iwork ion idc ivoltage. iThe inegative ipeak iinverse
ivoltage iis iless icompared ito ifull iwave irectifier iand iis icost iefficient.
FILTER iCIRCUIT:
Low ipass ifilter iis ia ifilter ithat ipasses iwith ia ifrequency ilower ithan ia
icertain icut-off ifrequency iand iattenuates isignals iwith ifrequency ihigher
ithan ithe icut-off ifrequency.
The iamount iof iattenuation ifor ieach ifrequency idepends ion ithe ifilter
idesign ithe ifrequency iat iwhich ithe itransition ioccurs iis icalled ithe i“cut-off
ifrequency”.
41
VOLTAGE iREGULATOR:
It ihas i5V iRegulated ioutput ivoltage. iInput ivoltage irange iis i5V-18V. iThe
ivoltage isource iin icircuit imay ihave ifluctuation iand iwould inot igive ifixed
ioutput ivoltage. iIt ihas ithree ipins iPin1-input, iPin2-ground, iPin3-
output.Heat isink iis iused ifor idissipating iheat iinto isurrounding iair ito
iprotect idevice ifrom idamage. iLM iindicates ias ilinear imonolithic,78
iindicates ipositive ivoltage iand i05 iindicates i5v.
42
This itype iof iregulation iis iideal ifor ihaving ia isimple ivariable ibench
ipower isupply. iActually ithis iis iquite iimportant ibecause ione iof ithe ifirst
iprojects ia ihobbyist ishould iundertake iis ithe iconstruction iof ia ivariable
43
iregulated ipower isupply. iWhile ia idedicated isupply iis iquite ihandy i,it's
imuch ihandier ito ihave ia ivariable isupply ion ihand, iespecially ifor itesting. i
Mainly i ithe iARM icontroller ineeds i3.3 ivolt ipower isupply. iTo iuse ithese
iparts iwe ineed ito ibuild ia iregulated i3.3 ivolt isource. iUsually iyou istart
iwith ian iunregulated ipower iTo imake ia i3.3 ivolt ipower isupply, iwe iuse ia
iLM317 ivoltage iregulator iIC i(Integrated iCircuit). iThe iIC iis ishown ibelow.
CIRCUIT iFEATURES
LM317 iis ithe istandard ipart inumber ifor ian iintegrated ithree-terminal
iadjustable ilinear ivoltage iregulator. iLM317 iis ia ipositive ivoltage iregulator
isupporting iinput ivoltage iof i3V ito i40V iand ioutput ivoltage ibetween
i1.25V iand i37V. iA itypical icurrent irating iis i1.5A ialthough iseveral ilower
iand ihigher icurrent imodels iare iavailable. iVariable ioutput ivoltage iis
iachieved iby iusing ia ipotentiometer ior ia ivariable ivoltage ifrom ianother
isource ito iapply ia icontrol ivoltage ito ithe icontrol iterminal. iLM317 ialso
ihas ia ibuilt-in icurrent ilimiter ito iprevent ithe ioutput icurrent ifrom
iexceeding ithe irated icurrent, iand iLM317 iwill iautomatically ireduce iits
ioutput icurrent iif ian ioverheat icondition ioccurs iunder iload. iLM317 iis
imanufactured iby imany icompanies, iincluding iNational iSemiconductor,
iFairchild iSemiconductor, iand iSTMicroelectronics.
In ithis iproject, iin iorder ito imonitor ithe itemperature icontinuously iand
icompare ithis iwith ithe iset itemperature ipreprogrammed iin ithe
imicrocontroller, iinitially ithis itemperature ivalue ihas ito ibe iread iand ifed ito
ithe imicrocontroller. iThis itemperature ivalue ihas ito ibe isensed. iThus ia
isensor ihas ito ibe iused iand ithe isensor iused iin ithis iproject iis iLM35. iIt
iconverts itemperature ivalue iinto ielectrical isignals. i
icalibrated. i. iThe iLM35 idoes inot irequire iany iexternal icalibration ior
itrimming ito iprovide itypical iaccuracies iof i±1⁄4°C iat iroom itemperature
iand i±3⁄4°C iover ia ifull i−55 ito i+150°C itemperature irange. i
The iLM35’s ilow ioutput iimpedance, ilinear ioutput, iand iprecise iinherent
icalibration imake iinterfacing ito ireadout ior icontrol icircuitry iespecially
ieasy. iIt ican ibe iused iwith isingle ipower isupplies, ior iwith iplus iand iminus
isupplies. iAs iit idraws ionly i60 iμA ifrom iits isupply, iit ihas ivery ilow iself-
heating, iless ithan i0.1°C iin istill iair. i
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
i i i i i i i i i i i i i i i i iFigure i3.10 i: iTemperature iSensor
The ipH isensor icomponents iare iusually icombined iinto ione idevice icalled
ia icombination ipH i ielectrode. iThe imeasuring ielectrode iis iusually iglass
iand iquite ifragile. iRecent idevelopments ihave ireplaced ithe iglass iwith
imore idurable isolid-state isensors. iThe i ipreamplifier iis ia isignal-
conditioning idevice. iIt itakes ithe ihigh-impedance i ipH ielectrode isignal iand
46
ichanges iit iinto iallow iimpedance isignal iwhich ithe ianaliser ior itransmitter
ican iaccept. iThe ipreamplifier ialso istrengthens i iand istabilizes ithe isignal,
imaking iit iless isusceptible ito ielectrical inoise.
The isensor's ielectrical isignal iis ithen idisplayed. iThis iis icommonly idone
iin ia i120/240 iV iac-powered ianaliser ior iin ia i24 iV idc iloop-powered
itransmitter.
iAdditionally, ithe ianaliser ior itransmitter ihas ia iman imachine iinterface ifor
icalibrating ithe isensor iand iconfiguring ioutputs iand ialarms, iif ipH icontrol
iis ibeing idone.
iESP8266 iModule iis inot icapable iof i5-3V ilogic ishifting iand iwill irequire
ian iexternal iLogic iLevel iConverter. iPlease ido inot ipower iit idirectly ifrom
iyour i5V idev iboard. iThis inew iversion iof ithe iESP8266 iWi-Fi iModule
ihas iincreased ithe iflash idisk isize ifrom i512k ito i1MB.
A iliquid icrystal idisplay i(LCD) iis ia ithin, iflat idisplay idevice imade iup iof
iany inumber iof icolour ior imonochrome ipixels iarrayed iin ifront iof ia ilight
isource ior ireflector. i iEach ipixel iconsists iof ia icolumn iof iliquid icrystal
imolecules isuspended ibetween itwo itransparent ielectrodes, iand itwo
ipolarizing ifilters, ithe iaxes iof ipolarity iof iwhich iare iperpendicular ito ieach
iother. i iWithout ithe iliquid icrystals ibetween ithem, ilight ipassing ithrough
ione iwould ibe iblocked iby ithe iother. iThe iliquid icrystal itwists ithe
49
ipolarization iof ilight ientering ione ifilter ito iallow iit ito ipass ithrough ithe
iother. i
A iprogram imust iinteract iwith ithe ioutside iworld iusing iinput iand ioutput
idevices ithat icommunicate idirectly iwith ia ihuman ibeing. iOne iof ithe imost
icommon idevices iattached ito ia icontroller iis ian iLCD idisplay. iSome iof
ithe imost icommon iLCDs iconnected ito ithe icontrollers iare i16X1, i16x2
iand i20x2 idisplays. iThis imeans i16 icharacters iper iline iby i1 iline i16
icharacters iper iline iby i2 ilines iand i20 icharacters iper iline iby i2 ilines,
irespectively.
Many imicrocontroller idevices iuse i'smart iLCD' idisplays ito ioutput ivisual
iinformation. i iLCD idisplays idesigned iaround iLCD iNT-C1611 imodule,
iare iinexpensive, ieasy ito iuse, iand iit iis ieven ipossible ito iproduce ia
ireadout iusing ithe i5X7 idots iplus icursor iof ithe idisplay. i iThey ihave ia
istandard iASCII iset iof icharacters iand imathematical isymbols. i iFor ian i8-
bit idata ibus, ithe idisplay irequires ia i+5V isupply iplus i10 iI/O ilines i(RS
iRW iD7 iD6 iD5 iD4 iD3 iD2 iD1 iD0). i i iFor ia i4-bit idata ibus iit ionly
irequires ithe isupply ilines iplus i6 iextra ilines i(RS iRW iD7 iD6 iD5 iD4).
iWhen ithe iLCD idisplay iis inot ienabled, idata ilines iare itri istate iand ithey
ido inot iinterfere iwith ithe ioperation iof ithe imicrocontroller.
iS
50
CHAPTER-4
Implementation
51
CHAPTER- i4
i IMPLEMENTATION
4.1. iINTRODUCTION:
Nowadays idrinking iwater iis ithe imost iprecious iand ivaluable ifor iall ithe
ihuman ibeings, idrinking iwater iutilities ifaces inew ichallenges iin ireal-time
ioperation. iThis ichallenge ioccurred ibecause iof ilimited iwater iresources
igrowing ipopulation, iageing iinfrastructure ietc. iHence itherefore ithere iis ia
ineed iof ibetter imethodologies ifor imonitoring ithe iwater iquality.
Traditional imethods iof iwater iquality iinvolve ithe imanual icollection iof
iwater isample iat idifferent ilocations, ifollowed iby ilaboratory ianalytical
itechniques iin iorder ithe icharacter ithe iwater iquality. iSuch iapproaches itake
ilonger itime iand ino ilonger ito ibe iconsidered iefficient i. iAlthough ithe
icurrent imethodologies ianalysis ithe iphysical, ichemical iand ibiological
iagents, iit ihas iseveral idrawbacks: ia) ipoor ispatiotemporal icoverage ib) iit iis
ilabor iintensive iand ihigh icost(labor, ioperation; iand iequipment) ic)the ilack
iof ireal itime iwater iquality iinformation ito ienable icritical idecisions ifor
ipublic ihealth iprotection. iTherefore, ithere iis ia ineed ifor icontinuous ionline
iwater iquality imonitoring.
ialgorithm iproposed ion ithe inew itechnology imust ibe isuitable ifor
iparticular iarea iand ifor ilarge isystem iis inot isuitable.
By ifocusing ion ithe iabove iissues iour ipaper idesign iand idevelop ia ilow
icost isystem ifor ireal itime imonitoring iof ithe iwater iquality iin iIOT
ienvironment. iIn iour idesign iARM-7 iis iused ias ia icore icontroller. iThe
idesign isystem iapplies ia ispecialized iIOT imodule ifor iaccessing isensor
idata ifrom icore icontroller ito ithe imobile. iThe isensor idata ican ibe iviewed
ion ithe imobile iusing ia ispecial iIP iaddress. iAdditionally ithe iIOT imodule
ialso iprovides ia iWi-Fi ifor iviewing ithe idata ion imobile.
4.2 i iWORKING:
iiiiii
In this iproject, iwe iare iusing ithree isensors inamely i itemperature isensor,
ilevel isensor iand ipH isensor iwhich iare iused ito icollect ithe iinformation
ifrom ithe irequired iwater. iThese isensors iare iconnected ito ithe iLCP2148
iARM-7 i32bit imicrocontroller i. iThe idata iwhich iis icollected iin iARM-7 i,
iis isent ito ithe ireceiver iand ithrough i iUART iThe iMAX232 iis ian iIC, ithat
iconverts isignals ifrom ian iRS-232 iserial iport ito isignals isuitable ifor iuse
iin iTTL icompatible idigital ilogic icircuits. iThe iMAX232 iis ia idual
idriver/receiver iand itypically iconverts ithe iRX, iTX, iCTS iand iRTS isignals,
ias iit iplays ia irole ifor itransmitting idata ifrom icontroller ito ithe iWi-Fi
imodule. iThe ioutput iis iviewed ion iLCD ior iMobile iphone ithrough ithe
iTelnet isoftware i, ithrough iwhich iinformation iabout iwater iparameters iis
idisplayed.
53
CHAPTER-5
Results
& Analysis
55
CHAPTER-5
RESULTS & ANALYSIS
SIMULATION iRESULT:
CHAPTER-6
Conclusion &
Future Scope
57
CHAPTER-6
CONCLUSION & FUTURE SCOPE
6.1 i iCONCULSION:
There are numerous potential applications of the online real-time monitoring and
control system outlined in this paper – environmental monitoring, waste water
treatment, industrial process control and drinking water monitoring. The
incorporation of the biosensor under development in collaboration with Dr.
Kane will increase these potential applications and provide the system with
market leading monitoring and control capabilities.
APPENDICES
}
unsigned ilong iint ias2()
{
iAD0CR&=0XFFFFFF00;
iAD0CR|=0X01000004;
i//delay(500);
iwhile(!(AD0DR2&0X80000000));
ireturn((AD0DR2 i>> i6) i& i0x03FF);
}
unsigned ilong iint ias3()
{
iAD0CR&=0XFFFFFF00;
iAD0CR|=0X01000008;
i//delay(500);
iwhile(!(AD0DR3&0X80000000));
ireturn((AD0DR3 i>> i6) i& i0x03FF);
}
void ipin()
{
iPINSEL0=0X00050005;//SELECTING iPIN iOPERATION
iPINSEL1=0X15000000;
iPINSEL2=0X00000000;
iIODIR0=0xffffffff;
//IODIR0=0X00000000|sensor1|sensor2;// ias ioutput and i2 ipins ias iinput
60
}
void iInitSerial0Int(unsigned iisrPtr)
{
i iU0IER i= i0x01;
i iVICVectCntl0 i = i0x00000026; i i i i i i i i i i i i i//select ia ipriority islot ifor
ia igiven iinterrupt i i
i iVICVectAddr0 i = i(unsigned ilong)isrPtr; i i//pass ithe iaddress iof ithe
iIRQ iinto ithe i i i i iVIC islot i
i iVICIntEnable i |= i0x00000040; //enable iinterrupt2
}
void ilcdbasic()
{
i i i i iclcd(1);
stringlcd(0x80,"T:");//0x82,3,4
stringlcd(0x86,"L:"); i//0x88,9,a
stringlcd(0xc0,"H:");//0xc2,3,4
}
void iokc()
{
iunsigned ichar irr;
i ido{
i i i i i irr i= ireceive_0();
i i i i}while(rr i!= i'K'); i
}
void iwifiinit()
{
stringlcd(0x80,"IOT iInitilizing");
string_0("AT\r\n"); delay(1500);
//okc();
string_0("ATE0\r\n");
okc();
string_0("AT+CWMODE=3\r\n");
delay(1500);
63
// string_0("AT+CWSAP=\"org_6547\",\"connectnow\",5,0\r\n");
delay(1500);
string_0("AT+CIPMUX=1\r\n");
delay(1500);
string_0("AT+CIPSERVER=1,23\r\n");
delay(1500);
stringlcd(0x80,"WAITING iFOR iCONNCT");
}
void isendwifi(unsigned ichar i*chr,unsigned iint ilength)
{
unsigned ichar itemp[20];
string_0("AT+CIPSEND=0,");
sprintf(temp,"%u",length);
string_0(temp);
string_0("\r\n");
while(receive_0()!='>');
delay(100);
string_0(chr);
}
//string_0("4");
// conv_serial_1(temp);
//string_0("\r\n");
while(receive_0()!='>');
delay(100);
// string_1(chr);
i i i istring_0("Temp:");
i i i iconv_serial_0(temp);
i i// istring_0("\r\n");
}
void imain() i i i//gsm imodem iis iconnected ito iserial0 iand isystem iis
iconnected ito iserial1
{
iunsigned ichar irec='X',rec1='x',p;
iunsigned ilong iint icountv=0,cnt=0,hc=0,ht=0;
65
ifor(p=0;p<14;p++){rfid_t[p]=0;}
ipin();
iiii
iIOCLR0=buzzer;
i i i i i i i i i i i iser_init_0(0x61,0x00);
ser_init_1(0x61,0x00); i//serial iinitilization i
i i i i i i i i i i i i iinitlcd(); i i//Energy iEfficient iEthernet ifor iReal-Time
iIndustrial iNetworks
stringlcd(0x80,"IOT iBASED iWATER iQUALITY");
delay(1000); i//gprs();
i i i i i i i i i i i iclcd(1);
i i iwifiinit();
i iwhile(receive_0()!='L');
delay(400);
stringlcd(0x80,"CONNECTED");
delay(2500);
i i i i i i i i i i i iclcd(1);
istringlcd(0x80,"T:");//0x83,4,5
istringlcd(0x88,"L:");//0xc3,4,5
istringlcd(0xc0,"PH:");
// iInitSerial0Int((unsigned iint)serial0_RxISR);
ii
while(1)
66
i{
itempv i= ias1();
i i itempv i= i(tempv/3);
i i iclcd(0x82);conv(tempv);delay(500);
i istring_0("AT+CIPSEND=0,9\r\n"); idelay(900);
i i i i i i istring_0("Temp:");conv_serial_0(tempv);
i i idelay(800);
i i i i i iif(tempv i> i40)
i i i i i{
iIOSET0=buzzer;
i}
i i iif(tempv i< i40)
i i i i i{
i iIOCLR0=buzzer;
i}
i i i i iphv i= ias2();
i i i//phv i= i(phv/3);
i i i i i iclcd(0xC4);conv(phv);
i i i idelay(500);
iif(phv i> i0 i&& iphv i< i200)
i i i i i{
ii i istringlcd(0xc4,"000 i"); i i
i i istring_0("AT+CIPSEND=0,8\r\n"); idelay(900);
i i i i i i istring_0("Ph-000\r\n");//6
i i idelay(800);
67
i}
iii
i i iif(phv i== i0)// i&& iphv i< i20)
i i i i i{
i i i i i i i i i i i i i i i istringlcd(0xc4,"000 i"); i i
i i i i i i i i i i i i i i i i i i i i i istring_0("AT+CIPSEND=0,8\r\n"); idelay(900);
i i i i i i istring_0("Ph-000\r\n");//6
i i idelay(800);
i}
i/*
i i iif(phv i> i40 i&& iphv i< i130)
i i i i i{
ii istringlcd(0xc4,"0.7 i");
i i i istring_0("AT+CIPSEND=0,8\r\n"); idelay(900);
i i i i i i istring_0("Ph-0.7\r\n");//6
i i idelay(800);
i}
iii
i i iif(phv i> i130 i&& iphv i< i160)
i i i i i{
ii istringlcd(0xc4,"0.72");
i i istring_0("AT+CIPSEND=0,9\r\n"); idelay(900);
i i i i i i istring_0("Ph-0.72\r\n");//6
i i idelay(800);
i}
68
iii
i i iif(phv i> i160 i&& iphv i< i170)
i i i i i{
ii istringlcd(0xc4,"0.75");
istring_0("AT+CIPSEND=0,9\r\n"); idelay(900);
i i i i i i istring_0("Ph-0.75\r\n");//6
i i idelay(800);
i} i*/
iii i/*
i i iif(phv i> i176 i&& iphv i< i200)
i i i i i{
ii istringlcd(0xc4,"0.77");
i istring_0("AT+CIPSEND=0,9\r\n"); idelay(900);
i i i i i i istring_0("Ph-0.77\r\n");//6
i i idelay(800);
i} i i i*/
iii
i i iif(phv i> i200 i&& iphv i< i210)
i i i i i{
ii istringlcd(0xc4,"0.79");
i i i istring_0("AT+CIPSEND=0,9\r\n"); idelay(900);
i i i i i i istring_0("Ph-0.79\r\n");//6
i i idelay(800);
i}
iii
69
i i i i i i i i i i i istring_0("AT+CIPSEND=0,13\r\n"); idelay(900);
i i i i i i istring_0("LEVEL-EMPTY\r\n");//6
i i idelay(800);
i i iIOSET0=buzzer;
}
i iif(inp0(lvl1) i== i0 i&& iinp0(lvl2) i== i1)
i i i i{
istringlcd(0x8A,"Lvl-1");
i i i i i i i i i i i i i iIOCLR0=buzzer;
i i i istring_0("AT+CIPSEND=0,9\r\n"); idelay(900);
i i i i i i istring_0("LEVEL-1\r\n");//6
i i idelay(800);
}
ii
i iif(inp0(lvl1) i== i1 i&& iinp0(lvl2) i== i1)
i i i i{
istring ilcd(0x8A,"Full i");
IOCLR0=buzzer;
i i i istring_0("AT+CIPSEND=0,12\r\n"); idelay(900);
i i i i i i istring_0("LEVEL-FULL\r\n");//6
i i idelay(800);
}
/*
iii i i i istring_0("AT+CIPSEND=0,10\r\n"); idelay(900);
71
i i i i i i istring_0("Count:");//6
i i iconv_serial_0(count); i//4
*/ iii
iii
i i idelay(500);
i}//end iof iwhil1e
i}
i ivoid iserial0_RxISR(void) i__irq i
{
i iunsigned ichar ich,cht1;
i i i icht1 i= ireceive_0();
if(cht1 i== i'+'){ i
ifor(ch=0;ch<8;ch++){receive_0();}
i i igchr i= ireceive_0(); i}
i/* ifor(ch=0;ch<12;ch++){rfid_t[ch]=receive_0();}
i iIOCLR0=relay;
i iif(strcmp(rfid_t,rfid_0)==0){card i= i1;set3=1;}
i iif(strcmp(rfid_t,rfid_1)==0){card i= i2;set3=1;}
i iif(strcmp(rfid_t,rfid_2)==0){card i= i3;set3=1;}*/
VICVectAddr i = i0x00000000; i//Dummy iwrite ito isignal iend iof
iinterrupt
}
72
REFERENCES
[1]PWTAG, Swimming Pool Water: Treatment and Quality Standards for Pools
and Spas, ISBN 095100766, pg 97
[2]B. Pletschke et al Online real-time enzymatic biosensor system for the rapid
detection of faecal contamination in water intended for drinking purposes, WRC
Report 1603/1/08, ISBN 978-1- 77005-670-1