Transcript
Page 1: Single Chip Temperature Data Logger - Electronics-Lab · Single Chip Temperature Data Logger Rajendra Bhatt Williamsburg, VA rajbex [@] yahoo.com Introduction A data logger is a device

SingleChipTemperatureDataLogger

RajendraBhattWilliamsburg,VA

rajbex[@]yahoo.com

Introduction

Adataloggerisadevicethatrecordsmeasurementsovertime.Themeasurementscouldbeanyphysicalvariableliketemperature,pressure,voltage,humidity,etc.Thisprojectdescribeshowtobuildaminiloggerthatrecordssurroundingtemperaturevalues.Ithasfollowingfeatures:

• Usesjustone8‐pinchip,soverycompactsizecircuit.• Temperaturerange:0to+125°C.• Canstoreupto254measurements.• Samplingintervaloptions:1sec,1min,10min• Resetfeaturetoclearallpreviousmeasurements.• SerialtransferofrecordedmeasurementstoaPC• ThreetactileswitchesforuserinputsandaLEDindicator.

Description

Thebeautyofthisprojectisthatitusesjustasinglechipforlogging.ItisPIC12F683,an8‐pinmicrocontrollerfromMicrochip.PIC12F683hassixgeneral‐purposeI/O(GP0‐GP5,GP3isinputonly)pins,and2Kx14Flashprogrammemorywith256bytesofinternalEEPROM.

TemperaturewillbemeasuredwithaDS1820temperaturesensor.DS1820isaone‐wiredigitaltemperaturesensorfromDallasSemiconductor(nowMAXIM).Theoperatingtemperaturerangeofthedeviceis–55°Cto+125°Cwithanaccuracyof±0.5°Covertherangeof–10°Cto+85°C.Thetemperaturesensoroutputis9‐bitCelsiustemperaturemeasurement,andsothetemperatureresolutioncorrespondstotheleastsignificantbit,andwhichis0.5°C.Butinthisprojectwewilluseonlythemostsignificanteightbits.Therefore,thetemperatureresolutionwillbe1°C.ThemeasuredtemperatureswillberecordedintotheinternalEEPROMmemoryofPIC12F683.

ThefirstlocationoftheinternalEEPROMwillstorethesamplingintervalofdatalogger.Samplingintervaldefinesthetimegapbetweentwosuccessivemeasurements.Thisprojectwillhave3optionsforsamplingtime:1sec,1min,and10min.Theseareuserselectable.ThesecondlocationofEEPROMwillstorethenumberofmeasurementsrecordedsofar.Andtheremaining254EEPROMlocationswillstore8‐bittemperatures.So,using10minsamplinginterval,254bytesofEEPROMwillprovidedataloggingfor42hours.TherecordedmeasurementscanbesenttoPCatanytimethroughaseriallinkat9600baud.

Page 2: Single Chip Temperature Data Logger - Electronics-Lab · Single Chip Temperature Data Logger Rajendra Bhatt Williamsburg, VA rajbex [@] yahoo.com Introduction A data logger is a device

UserInputs

Therewillbethreetactswitchesforuserinputs,namelyStart,Stop,andSend/Reset.Thethreeswitcheswillbeabletoacceptthefollowing4userrequests.

1. Start:When‘Start’buttonispressed,dataloggingstarts.2. Stop:Oncethe‘Stop’buttonispressed,datarecordingwillstop.3. Send:TransferdatatoPCthroughserialport.4. Reset:Holdingthe‘Send’buttonfor2secormoreclearstheinternal

EEPROMmemory.

SamplingTimeSelection

Thesamplingintervalcanbeselectedas1sec,1min,or10minusingthesamethreeswitches.Supposeifweneed1minsamplingtime,firstturnOFFthepower,thenholdthe‘Stop’button,turnthepowerON,andwaittilltheLEDglows.OncetheLEDglows,releasethebutton,andthesamplingintervalwillbesetto1min.ThenewsetsamplingtimewillbeupdatedtoEEPROMlocation0sothatincaseofpowerfailure,theprevioussamplingtimewillberestored.Similarly,use‘Start’and‘Send’buttonsfor1sec,and10minsamplingintervalsrespectively.

LEDIndicator

Everytimetheuserpressesinputbuttons,LEDglowsforamomenttoindicatethattheinputisaccepted.ItalsoblinksthriceeverytimeEEPROMWriteoperationtakesplace.Italsoblinksatthebeginningwhenthepoweristurned‘ON’.ItalsoglowswhentheEEPROMmemoryisfull.

Page 3: Single Chip Temperature Data Logger - Electronics-Lab · Single Chip Temperature Data Logger Rajendra Bhatt Williamsburg, VA rajbex [@] yahoo.com Introduction A data logger is a device

CircuitDiagram

Thecompletecircuitdiagramforthisprojectisshownbelow.

ThesixI/OpinsofPIC12F683areassignedasfollows:

1.GP0(Pin7,I/P):ThispinwillbeusedtoreadthetemperaturevaluefromDS1820sensor.

2.GP1(Pin6,O/P):ThiswillbeusedforserialdatatransfertoaPC.

3.GP2(Pin5,O/P):LEDoutputpin.

4.GP3(Pin4,I/P):Send(tactileswitch)

5.GP4(Pin3,I/P):Stop(tactileswitch)

6.GP5(Pin2,I/P):Start(tactileswitch)

AsimpletransistorbasedlevelshiftingwillbeusedtoconverttheTTLvoltagefromPIC12F683toappropriateRS232levelforserialdatatransfertoPC.TherequirednegativevoltageisderivedfromPCRS232portpin3(Tx),whichremainsidleasnodatatransferoccursfromPCtoPIC.Isolderedallthecomponentsonageneral‐purposeprototypingboard.Besides,myfinishedproductrunson3‐AAAbatterieswithadiodeinseriesforreversepolarityprotection.Ialsohaveapowerswitchontheboard.ThePICusesinternaloscillatorat4MHz,andMCLRisdisabled.

Page 4: Single Chip Temperature Data Logger - Electronics-Lab · Single Chip Temperature Data Logger Rajendra Bhatt Williamsburg, VA rajbex [@] yahoo.com Introduction A data logger is a device

ListofComponents

• PIC12F683microcontroller• DS1820temperaturesensor• BC557NPNtransistor• Resistors:10K(4),4.7K(2),470Ohm(1)• Capacitor:10uF,50V(1)• LED(1)• Tactswitches(3)

Software

ThefirmwareiswritteninCandcompiledwithmikroCcompilerfromMikroElektronika.IusedthefreeversionofitbecauseourHEXoutputisgoingtobelessthan2K.ThedownloadlinkformikroCishttp://www.mikroe.com/eng/downloads/get/29/mikroc_pro_pic_2010_v380_setup.zip

The3userinputswitchesworkoninterrupt­on­changemode.Thatmeansanytimetheuserpressesanybutton,aninterruptisgeneratedexceptattimeswhenthemicrocontrollerisreadingtemperaturevaluesfromDS1820(whichisinstantaneous)andwhenitistransferringdatatoaPCthroughserialport.Theinterruptsaredisabledatthoseinstants.Thedatatransfertakesplaceat9600baudrate.YoucanwriteyourownsoftwaretoreceivedataonPCside,butIhaveusedtheHyperterminalapplicationforthispurpose.MyHyperterminalsettingsare

bps:9600,DataBits:8,Parity:None,StopBits:1,FlowControl:Hardware

Configuration:Internalclock@4MHz,MCLRDisabled,WDTOFF

Pictures:

Page 5: Single Chip Temperature Data Logger - Electronics-Lab · Single Chip Temperature Data Logger Rajendra Bhatt Williamsburg, VA rajbex [@] yahoo.com Introduction A data logger is a device

Thisishowmyfinishedproductlookslike.

TransferringdatatoPC

Page 6: Single Chip Temperature Data Logger - Electronics-Lab · Single Chip Temperature Data Logger Rajendra Bhatt Williamsburg, VA rajbex [@] yahoo.com Introduction A data logger is a device

Hyperterminalreceivingwindow


Recommended