Sei sulla pagina 1di 72

1

A iProject iReport i

iOn

Online iReal iTime iWater iQuality iMonitoring iAnd


iControl iSystem i
Submitted ifor ipartial ifulfillment iof iaward iof i

iBACHELOR iOF iTECHNOLOGY

degree

In

Electronics i& iCommunication iEngineering i

By

Mukul iSingh iYadav i(1502931089)


Navdeep iPanwar i(1502931092)
Neha iGaur i(1502931093)
Nikita iSrivastava i(1502931095)

Name iof iProject iGuide


Mrs. iShipra iSrivastava i

ii
Department iOf iElectronics i& iCommunication iEngineering
KIET iGROUP iOF iINSTITUTIONS, iGHAZIABAD, iUP, iINDIA
(May, i2019)
2

Certificate

Certified ithat iMukul iSingh iYadav, iNavdeep iPanwar, iNeha


iGaur iand iNikita iSrivastava ihave icarried iout ithe iproject work
ipresented iin ithis iproject ireport ientitled i“Online iReal iTime iWater
iQuality iMonitoring iAnd iControl iSystem” ifor ithe iaward iof
iBachelor iof iTechnology iin iElectronics i& iCommunication
iEngineering i ifrom i iKIET iGROUP iOF iINSTITUTIONS,
iGhaziabad i i(Dr. iA iP iJ iAbdul iKalam iTechnical iUniversity,
iLucknow) iunder imy isupervision. iThe iproject ireport iembodies
iresult iof ioriginal iwork iand istudies icarried iout iby iStudent ihimself
iand ithe icontents iof ithe ireport ido inot iform ithe ibasis ifor ithe
iaward iof iany iother idegree ito ithe icandidate ior ito ianybody ielse.

Mrs. iShipra iSrivastava i Dr. iSanjay iSharma


Assistant iProfessor i i i i I i i i i HoD i(ECE)

iDate: i28 iMay,


3

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.

We iare iextremely ihappy ito iacknowledge iand iexpress iour isincere


igratitude ito iour parents ifor itheir iconstant isupport iand iencouragement iand
ilast ibut inot ithe ileast, friends iand iwell-wishers ifor itheir ihelp ifor
icooperation iand isolutions ito iproblems during ithe icompletion iof iproject.
6

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.3 Components description


3.3.1 LPC2148 Microcontroller 35
3.3.2 Power supply circuit 36
3.3.3 Regulated power supply 40
3.3.4 Temperature sensor 42
3.3.5 pH sensor 43
3.3.6 ESP8266 Wi-Fi module 45
3.3.7 LCD 46
4. Implementation
4.1 Introduction 49
4.2 Working 50
5. Results Analysis
5.1 Simulation Result 53
6. Conclusion and Future Scope
6.1 Conclusion 55
6.2 Future scope 55
APPENDICES 56
7. REFERENCES
Source code 69
8
9

LIST iOF iFIGURES

FIGURE.NO FIGURE iNAME PAGE.NO

2.1 LPC2148 iIC 17

2.2 Pin iConfiguration 19

3.1 Block idiagram i 32

3.2 Circuit iDiagram 35

3.3 Power iSupply iCircuit 36

3.4 Mutual iInduction iOf 37


iTransformer

3.5 Step iDown iTransformer 38

3.6 Bridge iRectifier iCircuit 39

3.7 Filter iCircuit 40

3.8 7805 iVoltage iRegulator 41

3.10 Temperature iSensor 44


10

3.11 pH iSensor 45

3.12 Wi-Fi iModule 47

4.1 Output of Water Quality 52


Parameters
5 Output iusing iKeil- 54
microvision3

CHAPTER-1
Introduction
11

CHAPTER-1

iINTRODUCTION

1.1 EMBEDDED SYSTEMS:

An embedded system could be a special-purpose automatic data processing


system designed to perform one or some dedicated functions, typically with time
period computing constraints. It is sometimes embedded as a part of an entire
device together with hardware and mechanical elements. In distinction, a
general-purpose computer, such as a personal computer, can do many different
tasks depending on programming. Embedded systems became vital these days as
they management several of the common devices we tend to use.

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.

Physically, embedded systems vary from transferable devices like digital


watches and MP3 players, to large stationary installations like traffic lights,
factory controllers, or the systems controlling nuclear power plants. Complexity
varies from low, with one microcontroller chip, to terribly high with multiple
12

units, peripherals and networks mounted within an oversized chassis or


enclosure.

In general, "embedded system" isn't associate degree precisely outlined term, as


many systems have some element of programmability. For example, hand-held
computers share some parts with embedded systems — like the operational
systems and microprocessors that power them — however don't seem to be
actually embedded systems, because they allow completely different
applications to be loaded and peripherals to be connected. A electronic computer
designed on one IC is termed single chip digital computer.

Such Computers area unit employed in instrumentation automatic industrial


management, process control, and home and consumer applications. As it is
employed for management applications it's referred to as small controller or
embedded microcontroller. It is very small and compact. It contains CPU, ROM,
RAM and I/O lines.

1.2 iMICROPROCESSOR iVs iMICROCONTROLLER:


The ipast ithree idecades ihave iseen ithe iintroduction iof ia itechnology ithat
ihas iradically ichanged ithe iway iin iwhich iwe ianalyses ithe icontrol ithe
iworld iaround ius. Born iof iparallel idevelopments iin icomputer iarchitecture
iand iintegrated icircuit ifabrication, ithe imicroprocessor ior icomputer ion ia
ichip ifirst ibecame ia icommercial ireality iin i1971 iwith iintroduction iof i4-bit
i4004 iby iIntel icorp.

A iby-product iof imicroprocessor idevelopment iwas ithe imicrocontroller. i


iThe isame ifabrication itechniques iand iprogramming iconcept ithat imake
ipossible ithe igeneral purpose imicroprocessor ialso iyielded ithe
13

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

Like ithe imicroprocessor, ia imicrocontroller iis ia igeneral ipurpose idevice,


ibut ione ithat iis imeant ito iread idata, iperform ilimited icalculation ion ithat
idata iand iits ienvironment ibased ion ithose icalculations. i iThe iprime iuse iof
ia imicrocontroller iis ito icontrol ithe ioperation iof ia imachine iusing ia ifixed
iprogram ithat iis istored iin iROM i& ithat idoes inot ichange iover ithe
ilifetime iof ithe isystem.

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

iextensive irepertoire iof imulti-byte iinstructions. iThese iinstructions iwork iin


iHardware iconfigurations ithat ienable ilarge iamounts iof imemory iand iI/O
ito ibe iconnected ito iaddress iand idata ibus ipins ion ithe iIntegrated iCircuit
iPackage. iMuch iof ithe iactivity iin ithe iMicroprocessor ihas ito ido iwith
imoving ithe icode iand idata ito iand ifrom iexternal imemory ito ithe iCPU. i
iThe iarchitecture ifeatures iworking iregisters ithat ican ibe iprogrammed ito
itake iParty iin ithe imemory iaccess iprocess, iand iinstruction iset iis iaimed iat
iexpediting ithis iactivity iin iorder ito iimprove ithroughput. i iThe ipins
iconnected ito ithe imicroprocessor ito ithe iexternal imemory iare iunique, iis
ihaving ia isingle ifunction. iData iis ihandled iin ibyte ior ilarge isizes.

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

2.1 iLPC2148 iMICROCONTROLLER

The iLPC2148 imicrocontroller iis ibased ion ia i32-bit iARM7TDMI-S iCPU


iwith ireal-time iemulation iand iembedded itrace isupport, ithat icombine
imicrocontrollers iwith iembedded ihigh-speed iflash imemory iranging ifrom
i32 ikB ito i512 ikB. iA i128-bit iwide imemory iinterface iand iunique
iaccelerator iarchitecture ienable i32-bit icode iexecution at ithe imaximum
iclock irate. iFor icritical icode isize iapplications, ithe ialternative i16- bit
iThumb imode ireduces icode iby imore ithan i30 i% iwith iminimal
iperformance ipenalty.

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

isuch ias iaccess icontrol iand ipoint-of-sale. iSerial icommunications iinterfaces


iranging ifrom ia iUSB i2.0 iFull-speed idevice, imultiple iUARTs, iSPI, iSSP
ito iI2C-bus iand ion-chip iSRAM iof i8 ikB iup ito i40 ikB, imake ithese
idevices ivery iwell isuited ifor icommunication igateways iand iprotocol
iconverters, isoft imodems, ivoice irecognition iand ilow iend iimaging,
iproviding iboth ilarge ibuffer isize iand ihigh iprocessing ipower. iVarious i32-
bit itimers, isingle ior idual i10-bit iADCs, i10-bit iDAC, iPWM ichannels iand
i45 ifast iGPIO ilines iwith iup ito inine iedge ior ilevel isensitive iexternal
iinterrupt ipins imake ithese imicrocontrollers isuitable ifor iindustrial icontrol
iand imedical isystems.

iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
Figure2.1LPC2148 iIC

2.1.1 Features iof iLPC2148:

 16-bit/32-bit iARM7TDMI-S imicrocontroller iin ia itiny iLQFP64 ipackage.


19

 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.

 In-System iProgramming/In-Application iProgramming i(ISP/IAP) ivia ion-


chip iboot iloader isoftware, isingle iflash isector ior ifull ichip ierase iin i400
ims iand iprogramming iof i256 iB iin i1 ims.

 Embedded iICE iRT iand iEmbedded iTrace iinterfaces ioffer ireal-time


idebugging iwith ithe ion-chip iReal iMonitor isoftware iand ihigh-speed
itracing iof iinstruction iexecution.

 USB i2.0 iFull-speed icompliant idevice icontroller iwith i2 ikB iof


iendpoint iRAM.

 In iaddition, ithe iLPC2146/48 iprovides i8 ikB iof ion-chip iRAM


iaccessible ito iUSB iby iDMA.

 One ior itwo i(LPC2141/42 ivs, iLPC2144/46/48) i10-bit iADCs iprovide ia


itotal iof i6/14 ianalog iinputs, iwith iconversion itimes ias ilow ias i2.44 ims
iper ichannel iSingle i10-bit iDAC iprovides ivariable ianalog ioutput
i(LPC2142/44/46/48 ionly).

 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

 Multiple iserial iinterfaces iincluding itwo iUARTs i(16C550), itwo iFast


iI2C-bus i(400 ikbit/s), iSPI iand iSSP iwith ibuffering iand ivariable idata
ilength icapabilities.

 Vectored iInterrupt iController i(VIC) iwith iconfigurable ipriorities iand


ivector iaddresses.

2.1.2 Pin iConfiguration:


21

Figure i2.2: iPin iconfiguration


2.1.3 Pin iDescription:

P0.0 ito iP0.31 iI/O iPort i0: i


22

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.0 i- iGeneral ipurpose iinput/output idigital ipin i(GPIO).


TXD0 i- iTransmitter ioutput ifor iUART0.
PWM1 i- iPulse iWidth iModulator ioutput i1.

P0.1/RXD0/PWM3/EINT0:

P0.1 i-General ipurpose iinput/output idigital ipin i(GPIO).


RXD0 i-Receiver iinput ifor iUART0.
PWM3 i- iPulse iWidth iModulator ioutput i3.
EINT0 i-External iinterrupt i0 iinput.

P0.2/SCL0/ iCAP0.0:

P0.2 i- iGeneral ipurpose iinput/output idigital ipin i(GPIO).


SCL0 i-I2C0 iclock iinput/output, iopen-drain ioutput i(for iI2C-bus
icompliance).
CAP0.0 i-Capture iinput ifor iTimer i0, ichannel i0.
23

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.4 i-General ipurpose iinput/output idigital ipin i(GPIO).


SCK0 i-Serial iclock ifor iSPI0, iSPI iclock ioutput ifrom imaster ior
iinput ito islave.
CAP0.1 i-Capture iinput ifor iTimer i0, ichannel i0.
AD0.6 i-ADC i0, iinput i6.

P0.5/MISO0/ iMAT0.1/AD0.7:

P0.5 i-General ipurpose iinput/output idigital ipin i(GPIO).


MISO0 i–Master iIn iSlave iOUT ifor iSPI0, idata iinput ito iSPI imaster
ior idata ioutput ifrom iSPI. i
MAT0.1 i-Match ioutput ifor iTimer i0, ichannel i1.
AD0.7 i-ADC i0, iinput i7.

P0.6/MOSI0/ iCAP0.2/AD1.0:
24

P0.6 i-General ipurpose iinput/output idigital ipin i(GPIO).


MOSI0 i-Master iOut iSlave iIn ifor iSPI0, idata ioutput ifrom iSPI
imaster ior idata iinput ito iSPI.
CAP0.2 i-Capture iinput ifor iTimer i0, ichannel i2.
AD1.0 i-ADC i1, iinput i0, iavailable iin iLPC2144/46/48 ionly.

P0.7/SSEL0/PWM2/EINT2:

P0.7 i-General ipurpose iinput/output idigital ipin i(GPIO).


SSEL0 i-Slave iSelect ifor iSPI0, iselects ithe iSPI iinterface ias ia islave.
PWM2 i— iPulse iWidth iModulator ioutput i2.
EINT2 i— iExternal iinterrupt i2 iinput.

P0.8/TXD1/PWM4/AD1.1:

P0.8 i— iGeneral ipurpose iinput/output idigital ipin i(GPIO).


TXD1 i— iTransmitter ioutput ifor iUART1.
PWM4 i— iPulse iWidth iModulator ioutput i4.
AD1.1 i— iADC i1, iinput i1, iavailable iin iLPC2144/46/48 ionly.

P0.9/RXD1/ iPWM6/EINT3:

P0.9 i-General ipurpose iinput/output idigital ipin i(GPIO).


25

RXD1 i-Receiver iinput ifor iUART1.


PWM6 i-Pulse iWidth iModulator ioutput i6.
EINT3 i-External iinterrupt i3 iinput.

P0.10/RTS1/ iCAP1.0/AD1.2:

P0.10 i-General ipurpose iinput/output idigital ipin i(GPIO).


RTS1 i-Request ito isend ioutput ifor iUART1, iLPC2144/46/48 ionly.
CAP1.0 i-Capture iinput ifor iTimer i1, ichannel i0.
AD1.2 i-ADC i1, iinput i2, iavailable iin iLPC2144/46/48 ionly.

P0.11/CTS1/ iCAP1.1/SCL1:

P0.11 i-General ipurpose iinput/output idigital ipin i(GPIO).


CTS1 i-Clear ito isend iinput ifor iUART1, iavailable iin iLPC2144/46/48
ionly.
CAP1.1 i-Capture iinput ifor iTimer i1, ichannel i1.
SCL1 i-I2C1 iclock iinput/output, iopen-drain ioutput i(for iI2C-bus
icompliance).

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

AD1.3 i-ADC iinput i3, iavailable iin iLPC2144/46/48 ionly.

P0.13/DTR1/ iMAT1.1/AD1.4:

P0.13 i-General ipurpose iinput/output idigital ipin i(GPIO).


DTR1 i-Data iTerminal iReady ioutput ifor iUART1, iLPC2144/46/48
ionly.
MAT1.1 i-Match ioutput ifor iTimer i1, ichannel i1.
AD1.4 i-ADC iinput i4, iavailable iin iLPC2144/46/48 ionly.

P0.14/DCD1/EINT1/SDA1:

P0.14 i— iGeneral ipurpose iinput/output idigital ipin i(GPIO)


DCD1 i— iData iCarrier iDetect iinput ifor iUART1, iLPC2144/46/48
ionly
EINT1 i— iExternal iinterrupt i1 iinput
SDA1 i— iI2C1 idata iinput/output, iopen-drain ioutput.

P0.15/RI1/ iEINT2/AD1.5:

P0.15 i- iGeneral ipurpose iinput/output idigital ipin i(GPIO).


RI1 i-Ring iIndicator iinput ifor iUART1, iavailable iin iLPC2144/46/48
ionly.
EINT2 i-External iinterrupt i2 iinput.
AD1.5 i-ADC i1, iinput i5, iavailable iin iLPC2144/46/48 ionly.
27

P0.16/EINT0/MAT0.2/CAP0.2:

P0.16 i-General ipurpose iinput/output idigital ipin i(GPIO).


EINT0 i-External iinterrupt i0 iinput.
MAT0.2 i-Match ioutput ifor iTimer i0, ichannel i2.
CAP0.2 i- iCapture iinput ifor iTimer i0, ichannel

P0.17/CAP1.2/ iSCK1/MAT1.2:

P0.17 i-General ipurpose iinput/output idigital ipin i(GPIO).


CAP1.2 i-Capture iinput ifor iTimer i1, ichannel i2.
SCK1 i-Serial iClock ifor iSSP, iclock ioutput ifrom imaster ior iinput ito
islave.
MAT1.2 i-Match ioutput ifor iTimer i1, ichannel i2.

P0.18/CAP1.3/MISO1/MAT1.3:

P0.18 i-General ipurpose iinput/output idigital ipin i(GPIO).


CAP1.3 i- iCapture iinput ifor iTimer i1, ichannel i3.
MISO1 i-Master iIn iSlave iOut ifor iSSP, idata iinput ito iSPI imaster ior
idata ioutput ifrom iSSP.
MAT1.3 i-Match ioutput ifor iTimer i1, ichannel i3.

P0.19/MAT1.2/MOSI1/CAP1.2:
28

P0.19 i-General ipurpose iinput/output idigital ipin i(GPIO).


MAT1.2 i-Match ioutput ifor iTimer i1, ichannel i2.
MOSI1 i-Master iOut iSlave iIn ifor iSSP, idata ioutput ifrom iSSP
imaster ior idata iInput ito iSSP.
CAP1.2 i-Capture iinput ifor iTimer i1, ichannel i2.

P0.20/MAT1.3/SSEL1/EINT3:

P0.20 i-General ipurpose iinput/output idigital ipin i(GPIO).


MAT1.3 i-Match ioutput ifor iTimer i1, ichannel i3.
SSEL1 i-Slave iSelect ifor iSSP, iselects ithe iSSP iinterface ias ia islave.
EINT3 i-External iinterrupt i3 iinput.

P0.21/PWM5/AD1.6/CAP1.3:

P0.21 i-General ipurpose iinput/output idigital ipin i(GPIO).


PWM5 i-Pulse iWidth iModulator ioutput i5.
AD1.6 i-ADC i1, iinput i6, iavailable iin iLPC2144/46/48 ionly.
CAP1.3 i-Capture iinput ifor iTimer i1, ichannel i3.
P0.22/AD1.7/CAP0.0/MAT0.0:

P0.22 i-General ipurpose iinput/output idigital ipin i(GPIO).


AD1.7 i-ADC i1, iinput i7, iavailable iin iLPC2144/46/48 ionly.
CAP0.0 i-Capture iinput ifor iTimer i0, ichannel i0.
29

MAT0.0 i-Match ioutput ifor iTimer i0, ichannel i0.

P0.23/VBUS:

P0.23 i-General ipurpose iinput/output idigital ipin i(GPIO).


VBUS i-Indicates ithe ipresence iof iUSB ibus ipower.

P0.25/AD0.4/AOUT:

P0.25 i-General ipurpose iinput/output idigital ipin i(GPIO).


AD0.4 i-ADC i0, iinput i4.
AOUT i-DAC ioutput, iavailable iin iLPC2142/44/46/48 ionly.

P0.28/AD0.1/CAP0.2/MAT0.2:

P0.28 i-General ipurpose iinput/output idigital ipin i(GPIO).


AD0.1 i-ADC i0, iinput i1.
CAP0.2 i-Capture iinput ifor iTimer i0, ichannel i2.
MAT0.2 i-Match ioutput ifor iTimer i0, ichannel i2.

P0.29/AD0.2/CAP0.3/MAT0.3:

P0.29 i-General ipurpose iinput/output idigital ipin i(GPIO).


AD0.2 i-ADC i0, iinput i2.
CAP0.3 i-Capture iinput ifor iTimer i0, iChannel i3.
30

MAT0.3 i-Match ioutput ifor iTimer i0, ichannel i3.

P0.30/AD0.3/EINT3/CAP0.0:

P0.30 i- iGeneral ipurpose iinput/output idigital ipin i(GPIO).


AD0.3 i-ADC i0, iinput i3.
EINT3 i- iExternal iinterrupt i3 iinput.
CAP0.0 i-Capture iinput ifor iTimer i0, ichannel i0.

P0.31/UP_LED/CONNECT:

P0.31 i- iGeneral ipurpose ioutput ionly idigital ipin i(GPO).


UP_LED i-USB iGood iLink iLED iindicator, iLOW iwhen iconfigured
iotherwise HIGH.
CONNECT i-Signal iused ito iswitch ian iexternal i1.5 ik iohms iresistor
iunder ithe iSoftware control, iused iwith ithe iSoft iConnect iUSB ifeature.
RESET iExternal iinput:
A iLOW ion ithis ipin iresets ithe idevice, icausing iI/O iports iand iperipherals
ito itake ion itheir idefault istates, iand iprocessor iexecution ito ibegin iat
iaddress i0, iTTL iwith ihysteretic, i5 iV itolerant.
XTAL1: Input ito ithe ioscillator icircuit iand iinternal iclock igenerator
icircuits.

XTAL2: Output ifrom ithe ioscillator iamplifier.


31

RTCX1: Input ito ithe iRTC ioscillator icircuit.

RTCX2: Output ifrom ithe iRTC ioscillator icircuit.

VSS: i i6, i18, i25, i42, i50 ipins iare ifor isupply ivoltage.

Ground:0 iV ireference.

VSSA iAnalog iground:

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.

VDDA i7 iI iAnalog i3.3 iV ipower isupply:


This ishould ibe inominally ithe isame ivoltage ias iVDD ibut ishould ibe
iisolated ito iminimize inoise iand ierror, ithis ivoltage iis ionly iused ito ipower
ithe ion-chip iADC(s) iand iDAC.
VREF iADC ireference ivoltage:

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

Figure i3.1: iBlock Diagram

LCD iDISPLAY:

 LCD i(Liquid iCrystal iDisplay) iis ian ielectronic idisplay imodule. iA


i16x2 iLCD idisplay iis ia ivery ibasic imodule iand icommonly iused iin
ivarious idevices iand icircuits. iThese imodules iare ipreferred iover iseven
isegments iand iother imulti isegment iLEDs.
 A i16x2 iLCD imeans iit ican idisplay i16 icharacters iper iline iand ithere
iare i2 isuch ilines. iIn ithis iLCD ieach icharacter iis idisplayed iin i5x7
35

ipixel imatrix. iLCD ihas itwo iregisters, inamely, iCommand iand iData
iregisters. iThe icommand iregister istores ithe icommand iinstructions
igiven ito ithe iLCD.

POWER iSUPPLY:

 The icircuit ibasically iconsists iof ia istep idown itransformer, ia ibridge


irectifier, ia ilow-pass ifilter, i i iand ia iregulator. iIt iis icentre itapped ito
ihave iboth i-ve i iand i+ve i 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.
 A ibridge irectifier iis ian iarrangement iof ifour ior imore idiodes iin ia
ibridge icircuit iconfiguration iwhich iprovides ithe isame ioutput
ipolarity ifor ieither iinput ipolarity. i
 It iis iused ifor iconverting ian ialternating icurrent i(AC) iinput iinto ia
idirect icurrent i(DC) ioutput.
 A ilow ipass ifilter iin ithe icircuit iis ito ifilter iout iany iunwanted ihigh
ifrequency inoise ifrom inearby iequipment. iThe icut-off ifrequency iof
ithe ifilter iwas ichosen ias i2Hz. iThe ifrequency iand iphase iresponses
iof ithe iamplifier itogether iwith ithe ifilter. iThe ioutput itime iresponse
iof ithe iamplifier iand ifilter icircuit iwhich iconsists iof ipulses. i
 7805 iis ia ivoltage iregulator iintegrated icircuit. iIt iis ia imember iof
i78xx iseries iof ifixed i i i ilinear ivoltage iregulator iICs. iThe ivoltage
iregulator iIC imaintains ithe ioutput ivoltage iat ia iconstant ivalue. iThe
36

ixx iin i78xx iindicates ithe ifixed ioutput ivoltage iit iis idesigned ito
iprovide. i7805 iprovides i+5V iregulated ipower isupply. i

3.2 iCIRCUIT iDIAGRAM:


37

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

3.3 iCOMPONENT iDESCRIPTION:


iii
3.3.1 iLPC2148 i iMICRO iCONTROLLER

The iLPC2148 imicrocontroller iis ibased ion ia i32-bit iARM7TDMI-S iCPU


iwith ireal-time iemulation iand iembedded itrace isupport, ithat icombine
imicrocontrollers iwith iembedded ihigh-speed iflash imemory iranging ifrom
i32 ikB ito i512 ikB. i

A i128-bit iwide imemory iinterface iand iunique iaccelerator iarchitecture


ienable i32-bit icode iexecution iat ithe imaximum iclock irate. iFor icritical
38

icode isize iapplications, ithe ialternative i16-bit iThumb imode ireduces icode
iby imore ithan i30 i% iwith iminimal iperformance ipenalty.

3.3.2 iPOWER iSUPPLY iCIRCUIT:

Figure i3.3: iPower isupply icircuit


STEP iDOWN iTRANSFORMER:

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

Figure i3.4: iMutual iInduction iof itransformer

Figure i3.5: iStep idown itransformer

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.

Figure i3.6: iBridge irectifier icircuit

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

Figure i3.7: iFilter icircuit

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

Figure i3.8: i7805 Voltage regulator

3.3.3 iREGULATED iPOWER iSUPPLY

A ivariable iregulated ipower isupply, ialso icalled ia ivariable ibench ipower


isupply, iis ione iwhere iyou ican icontinuously iadjust ithe ioutput ivoltage ito
iyour irequirements. iVarying ithe ioutput iof ithe ipower isupply iis ithe
irecommended iway ito itest ia iproject iafter ihaving idouble ichecked iparts
iplacement iagainst icircuit idrawings iand ithe iparts iplacement iguide. i

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

Vout irange 1.25V i- i37V

Vin i- iVout idifference 3V i- i40V

Operation iambient itemperature 0 i- i125°C

Output iImax <1.5A

Minimum iLoad iCurrentmax 10mA

A icurrent-limiting icircuit iconstructed iwith iLM317

i i i i i iFigure i3.9: iLM317 iIC


44

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.

3.3.4 iTEMPERATURE iSENSOR i(LM35):

Precision iCentigrade iTemperature iSensor

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

LM35 iseries isensors iare iprecision iintegrated-circuit itemperature isensors


iwhose ioutput ivoltage iis ilinearly iproportional ito ithe iCelsius itemperature.
iThe iLM35 irequires ino iexternal icalibration isince iit iis iinternally
45

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

3.3.5 i ipH 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.

Keep i iin i imind, iapplication i irequirements i ishould ibe icarefully i i


iconsidered iwhen ichoosing ia ipH ielectrode. iAccurate ipH imeasurement i
iand i ithe iresulting iprecise icontrol ithat iit ican iallow, ican igo ia ilong i iway
itoward iprocess ioptimization iand iresult iin iincreased iproduct iand iresult iin
iincreased iproduct iquality iand iconsistency. iAccurate, istable ipH
imeasurement ialso icontrols iand ioften ilowers ichemical iusage, iminimising
isystem imaintenance iand iexpense.

i i i i i i i i i i i i i i i i i i Figure 3.11 : pH Sensori i i iF i i i i i i i i i i i i


47

3.3.6 iESP8266 iWi-Fi iModule


The iESP8266 iWi-Fi iModule iis ia iself icontained iSOC iwith iintegrated
iTCP/IP iprotocol istack ithat ican igive iany imicrocontroller iaccess ito iyour
iWi-Fi inetwork. iThe iESP8266 iis icapable iof ieither ihosting ian iapplication
ior ioffloading iall iWi-Fi inetworking ifunctions ifrom ianother iapplication
iprocessor. iEach iESP8266 imodule icomes ipre-programmed iwith ian iAT
icommand iset ifirmware, imeaning, iyou ican isimply ihook ithis iup ito iyour
iArduino idevice iand iget iabout ias imuch iWi-Fi-ability ias ia iWi-Fi iShield
ioffers i(and ithat’s ijust iout iof ithe ibox)! iThe iESP8266 imodule iis ian
iextremely icost ieffective iboard iwith ia ihuge, iand iever igrowing,
icommunity.
This imodule ihas ia ipowerful ienough ion-board iprocessing iand istorage
icapability ithat iallows iit ito ibe iintegrated iwith ithe isensors iand iother
iapplication ispecific idevices ithrough iits iGPIOs iwith iminimal idevelopment
iup-front iand iminimal iloading iduring iruntime. iIts ihigh idegree iof ion-chip
iintegration iallows ifor iminimal iexternal icircuitry, iincluding ithe ifront-end
imodule, iis idesigned ito ioccupy iminimal iPCB iarea. iThe iESP8266
isupports iAPSD ifor iVoIP iapplications iand iBluetooth ico-existence
iinterfaces, iit icontains ia iself-calibrated iRF iallowing iit ito iwork iunder iall
ioperating iconditions, iand irequires ino iexternal iRF iparts.
There iis ian ialmost ilimitless ifountain iof iinformation iavailable ifor ithe
iESP8266, iall iof iwhich ihas ibeen iprovided iby iamazing icommunity
isupport. iIn ithe iDocuments isection ibelow iyou iwill ifind imany iresources
ito iaid iyou iin iusing ithe iESP8266, ieven iinstructions ion ihow ito
itransforming ithis imodule iinto ian iIOT i(Internet iof iThings) isolution. iThe
48

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.

] i i i i i i i i iFigure i3.12: iWi-Fi iModule i i i i i i i i i i

3.7 iLCD i(Liquid iCrystal iDisplay)

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.

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
52

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

i i i i i i i i i i i i i iFigure i4.1: iOutput iof iWater iquality iparameters


54

CHAPTER-5
Results
& Analysis
55

CHAPTER-5
RESULTS & ANALYSIS

SIMULATION iRESULT:

Figure i5 iOutput iusing iKeil-microvision3


56

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.

6.2 iFUTURE iSCOPES:


At the time of paper submission the test rig is nearing completion and some
preliminary testing has been conducted. Extensive testing of the monitoring and
control system’s response over extended periods of time is required and will be
conducted along with testing of the system’s response to standard pollutants and
shock dosage of chemicals. Dialogue with the relevant authorities has been
opened in order to develop the best possible data analysis. A workshop
showcasing the completed test rig with industry is scheduled for February 2010.
The fiber optic turbidity sensor is currently under development and testing will
occur in spring 2010. Initial experimentation with biosensor components and
processes will be conducted in parallel with these tests. Upon completion of
these experiments the automated biosensor will be built and tested from winter
2010 to summer 2011.
58

APPENDICES

#include i<lpc214x.h> i//21007BB4B15F i i i i i i i i i18008D991A16


#include i<stdio.h>
#include i<string.h> //192.168.4.1-telnet iport-23 i
#include i"lcd.h"
#include i"serial.h"
//#include i"gsm.h"
#include i"gpio.h"
#define iON i i'1'//0x31
#define iOFF i'0' i//0x30
#define ilvl1 iP0_3
#define ilvl2 iP0_4
#define ibuzzer iP0_5
unsigned iint imemsx=0,memsy=0;
unsigned iint itemp=0;
unsigned ichar igchr='x',gchr1='x';
void iserial0_RxISR(void) i__irq; i
unsigned ilong iint ias1()
{
iAD0CR&=0XFFFFFF00;
iAD0CR|=0X01000002;
idelay(500);
i iwhile(!(AD0DR1&0X80000000));
ireturn i((AD0DR1 i>> i6) i& i0x03FF);
59

}
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

iIODIR0 i&= i~(lvl1|lvl2);


iIODIR1=0XFFFFFFFF;//PORT1 iAS iOUTPUT
iIOCLR1=0XFFFFFFFF;
iAD0CR=0X00210600;// iADC iCONTROL iREGISTER
//IOPIN0|=0X0000001C;
i//IOSET0=sensor1|sensor2;
}
/*char iinp0(char i_bit)
{
iunsigned ilong ic; i
ic i= i1<<_bit; i// iCalculate idigit ito iconfiguration ifor iinput iport
iIODIR0 i&= i~c; i// iSet iinput iport ifrom iparameter i_bit
ireturn((IOPIN0 i& ic)>>_bit); i// iRead iand ireturn idata ibit
}*/

int iinp0(int ipinNumber)


{
i i// iRead ithe icurrent istate iof iall ipins iin iGPIO iblock i0
i iint ipinBlockState i= iIOPIN0;

i i// iRead ithe ivalue iof i'pinNumber'


i iint ipinState i= i(pinBlockState i& i(/*1 i<<*/ ipinNumber)) i? i1 i: i0;

i i// iReturn ithe ivalue iof ipinState


i ireturn ipinState;
61

}
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
}

unsigned ichar icount=0,gps_location[26];


void igps()
{
while(receive_1()!='C');
for(count=0;count<14;count++)
{
receive_1();
}
for(count=0;count<24;count++)
{
gps_location[count]=receive_1();
}
}
62

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);
}

void isend iwifitemp()


{
i i i string_0("AT+CIPSEND=0,9\r\n");
//sprintf(temp,"%u",length);
64

//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");
}

unsigned ichar imob1[11];//="9030059841\0";


unsigned ichar imob2[12];
unsigned iint icard=0,set1=0,set2=0,set3=0,hb=0,cnt=0,ht=0,loop=0;
unsignedchar
irfid_t[15],rfid_0[13]="140071C70FAD\0",rfid_1[13]="140071DCA61F\0",rfid
_2[13]="840081160E1D\0",rfid_3[13]="FE006E2F5BE4\0";
unsigned ichar imsg1[10],msg2[10];

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

iunsigned iint itempv=0,phv=0;

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 iif(phv i> i210 i&& iphv i< i230)


i i i i i{
ii istringlcd(0xc4,"0.80");
i istring_0("AT+CIPSEND=0,9\r\n"); idelay(900);
i i i i i i istring_0("Ph-0.80\r\n");//6
i i idelay(800);
i}
i i i i i iif(phv i> i230 i&& iphv i< i250)
i i i i i{
ii istringlcd(0xc4,"0.82");
i istring_0("AT+CIPSEND=0,9\r\n"); idelay(900);
i i i i i i istring_0("Ph-0.82\r\n");//6
i i idelay(800);
i}
iii
i i iif(phv i> i250)// i&& iphv i< i250)
i i i i i{
ii istringlcd(0xc4,"0.84");
istring_0("AT+CIPSEND=0,9\r\n"); idelay(900);
i i i i i i istring_0("Ph-0.84\r\n");//6
i i idelay(800);
i}
i iif(inp0(lvl1) i== i0 i&& iinp0(lvl2) i== i0)
i i i i{
istring ilcd(0x8A,"Empty");
70

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

[3]J. A. Adams et al Real-time, online monitoring of drinking water for


waterborne pathogen contamination warning, International Journal of High
Speed Electronic Systems Vol.17 (2007) 643 – 659

[4]A. Almadidy et al A fibre optic biosensor for the detection of microbial


contamination Canadian Journal of Chemistry Vol.5 (2003) 339 -349

[5]J. Zhao et al Rapidly determining E. coli and P. aeruginosa by an eight


channels bulk acoustic wave impedance physical biosensor Sensors and
Actuators B 107(2005) 271-276

[6]Brown et al Detection of biological molecules by differential partitioning of


enzyme substrates and products United States Patent 7,402,426 WO/2004/02708

[7]K. Rijal et al Detection of pathogen Escherichia coli O157:h7 at 70cells/ml


using antibody-immobilized biconical tapered fiber sensors Biosensors and
Bioelectronics Vol.21 (2005) 871- 880

Potrebbero piacerti anche