Vous êtes sur la page 1sur 3

Posible codigo vaco

TheFreescaleMPX5020PressureSensorisincludedinthe2013NationalmicroMedicContest
Kit.ThisdemoconnectsthepressuresensortotheBoardofEducationShieldandusesthe
Arduinosoftware'sSerialMonitortodisplaythedata.
Thissensordetectschangesinairpressureatitstwoductedports.Theoutputofthesensoris
ananalogvoltagethatvariesdependingonthepressure.Thepressuresensorcandetect
changesinbothpositiveandnegativeairpressure.Positiveairpressureisequivalenttoblowing
intoatube.Negativeairpressurecreatesavacuum,similartosuckingfromastraw.

Rubberaquariumtubingmeasuringapproximately1/4"outsidediametermaybeusedtoattach
anairorvacuumsourcetoeitherofthesensorsductedports.Cuttolength,andinsertoverthe
ribsoftheports.YoumayalsousesomeoftheitemsthatcomeintheParallaxmicroMedic
Contentkit,includingtheLSPHandheldNebulizerandMTRManualBloodPressureCuff.Both
consistoftubesandothercomponentsthatmaybeusedtobuildafinishedproject.Whenusing
thesqueezebulbofthepressurecuff,exercisecareinnotoverpressuringthesensor.

Connections
ToconnectthepressuresensorstotheArduinoShield,attachthethreeleadsofthedeviceas
showninthefigure.Thesensorisa6pindevice,butonlypins13areconnected.Notethatpin
1isdenotedbyasmallnotch.

Althoughtheleadsonthepressurehavethestandard0.100"spacing,itisrecommendedthat
youconnectthedevicetotheArduinousingmalefemalejumperwires,ratherthanpluggingthe
sensordirectlyintothebreadboardoftheArduinoShield.Thisallowsyoumoreflexibilityin
connectingtubestothesensor.

Programming

DownloadArduinoDemoCode

Tousethisexample,uploadthePressureSensorsketchtoyourArduino,thenopentheSerial
Monitorwindow.EnsurethattheBaudRateissetat9600.Usingatubeconnectedtooneofthe
portsonthesensor,useyourmouthtoblowintothetube,andwatchthevaluechangeinthe
SerialMonitorwindow.
Sensorvalueswillvaryfrom0(0volts)to1023(5V).Thesensorwillalwaysreadsomevalue
between,evenwhennotblowingintothetube.Thisisbecausethesensorisregisteringthe
atmosphericpressurethatispresent.
Avoidexcessiveairpressureorvacuumateitherport.Otherwisedamagetothesensormay
result.RefertotheFreescaleSemiconductorMPX5010DPdatasheetforthepressuresensorfor
maximumratingsforthedevice.


//Pin1(notch)Analogoutput
//Pin2Gnd
//Pin35V

intsensorPin=A0 //Selectinputpinforthepotentiometer
intsensorValue=0//Variablestoresvaluecomingfromthesensor

voidsetup(){
Serial.begin(9600)
}

voidloop(){
sensorValue=analogRead(sensorPin)//Readsensor
Serial.println(sensorValue,DEC) //Displayresult
delay(400) //Wait400milliseconds
}

Vous aimerez peut-être aussi