How to Use Barometric Pressure Sensors on the Arduino - Ultimate Guide to the Arduino #39

Circuit Basics
29 Jun 202318:46

Summary

TLDRIn diesem Video wird erklärt, wie man den BMP-180 Drucksensor mit einem Arduino verwendet, um atmosphärischen Druck und Temperatur zu messen. Der Sensor, der über I2C kommuniziert, kann Luftdruck und Temperatur ermitteln, was nützlich ist, um das Wetter vorherzusagen oder Höhenmessungen durchzuführen. Es wird gezeigt, wie man den Sensor anschließt, die SparkFun-Bibliothek nutzt und die Daten im seriellen Monitor anzeigt. Zusätzlich wird besprochen, wie Druckmessungen durch Höhenkorrekturen angepasst werden können, um verlässliche Vergleiche mit anderen Wetterstationen zu ermöglichen.

Takeaways

  • 📡 Der BMP-180 ist ein barometrischer Drucksensor, der Luftdruck und Temperatur misst und hauptsächlich für Wetterstationen verwendet wird.
  • 📊 Barometrischer Druck ist der atmosphärische Druck, der durch die Masse der Luft auf der Erdoberfläche verursacht wird.
  • ⛰️ Der Druck verändert sich mit der Höhe – in den Bergen gibt es weniger Luftmasse und daher weniger Druck.
  • 🌞 Ein steigender Luftdruck deutet auf sonniges, warmes Wetter hin, während ein fallender Druck auf kühles, windiges oder regnerisches Wetter hindeutet.
  • 🔧 Der BMP-180-Sensor kommuniziert über I2C und kann an 3,3V oder 5V angeschlossen werden, da er einen Spannungsregler und einen I2C-Pegelwandler besitzt.
  • 🌡️ Der Sensor misst auch die Temperatur, um den Luftdruck genauer zu berechnen, da kalte Luft dichter ist und mehr Druck ausübt als warme Luft.
  • 🛠️ Der SparkFun BMP-180 Code berechnet den Druck und die Temperatur und zeigt diese in Hektopascal (hPa) und Grad Celsius (°C) an.
  • ⏳ Die Genauigkeit des Sensors kann durch Oversampling verbessert werden, wodurch die Messzeit jedoch erhöht wird.
  • 📐 Mit dem BMP-180 können Höhenmessungen durchgeführt werden, indem der Luftdruck als Basis verwendet wird.
  • 📱 Die Druckwerte müssen möglicherweise für den Meeresspiegel kompensiert werden, um vergleichbare Messungen zu erhalten, was über eine Bibliothek leicht möglich ist.

Q & A

  • Was ist ein barometrischer Drucksensor und wofür wird er verwendet?

    -Ein barometrischer Drucksensor misst den atmosphärischen Druck, der für Wettervorhersagen und Höhenmessungen verwendet wird.

  • Was misst der BMP-180 Sensor außer dem Luftdruck?

    -Der BMP-180 misst auch die Temperatur, da diese den Luftdruck beeinflusst.

  • Warum muss die Temperatur bei der Druckmessung berücksichtigt werden?

    -Temperatur beeinflusst die Dichte der Luft, und somit den Druck. Kalte Luft ist dichter und erzeugt mehr Druck, während warme Luft weniger Druck ausübt.

  • Wie wird der BMP-180 Sensor mit einem Arduino verbunden?

    -Der BMP-180 wird über die I2C-Schnittstelle mit dem Arduino verbunden, wobei SDA an A4 und SCL an A5 angeschlossen werden. VCC kann an 3,3 V oder 5 V angeschlossen werden.

  • Was bedeutet 'Übersampling' und wie beeinflusst es die Messgenauigkeit des BMP-180?

    -Übersampling bezieht sich auf die Anzahl der Proben, die der Sensor zur Berechnung des Drucks verwendet. Höheres Übersampling führt zu präziseren, aber langsameren Messungen.

  • Wie kann man den Druck auf Meereshöhe anpassen?

    -Man kann den Druckwert um einen festgelegten Betrag korrigieren, um die Auswirkungen der Höhe zu eliminieren. Dies wird mit der 'sea level'-Funktion der SparkFun-Bibliothek durchgeführt.

  • Welche Einheit verwendet der BMP-180 zur Ausgabe des Drucks und warum?

    -Der BMP-180 gibt den Druck in Hektopascal (hPa) aus, da dies eine praktischere Einheit ist als der sehr kleine Pascal.

  • Wie lange dauert es, bis der BMP-180 den Temperaturwert zurückgibt?

    -Der BMP-180 benötigt etwa 4,5 Millisekunden, um eine Temperaturmessung durchzuführen.

  • Wie wirkt sich die Höhe auf den gemessenen Luftdruck aus?

    -Mit steigender Höhe gibt es weniger Luftmasse über dem Sensor, was zu einem geringeren Luftdruck führt. Umgekehrt nimmt der Druck bei geringerer Höhe zu.

  • Was passiert, wenn der BMP-180-Sensor erfolgreich initialisiert wird?

    -Wenn der Sensor erfolgreich initialisiert wird, gibt die 'begin'-Funktion einen Wert ungleich Null zurück, was anzeigt, dass die Kalibrierungskoeffizienten des Sensors korrekt geladen wurden.

Outlines

00:00

🧑‍🔬 Einführung in den BMP-180 Barometrischen Drucksensor

In diesem Abschnitt wird erklärt, wie der BMP-180 Sensor verwendet wird, um atmosphärischen Druck mit einem Arduino zu messen. Der BMP-180 ist ein piezo-resistiver Sensor, der über I2C mit dem Arduino kommuniziert und Luftdruck sowie Temperatur messen kann. Der atmosphärische Druck kann zur Wettervorhersage und Höhenmessung genutzt werden.

05:01

🌧️ Zusammenhang zwischen Luftdruck und Wetter

Dieser Abschnitt beschreibt, wie Veränderungen im Luftdruck Wetterphänomene vorhersagen können. Ein fallender Luftdruck deutet oft auf kühles, windiges oder regnerisches Wetter hin, während steigender Luftdruck auf warmes und sonniges Wetter hinweist. Dies geschieht durch das Steigen oder Fallen von Luftmassen, was den atmosphärischen Druck auf der Erdoberfläche beeinflusst.

10:02

📊 Programmierung des Arduino zur Messung von Druck und Temperatur

In diesem Teil wird die Programmierung des Arduino erklärt, um Druck- und Temperaturmessungen mit dem BMP-180 durchzuführen. Es wird der Ablauf beschrieben, wie der Sensor initialisiert, die Temperatur gemessen und anschließend der Druck anhand der Temperaturwerte korrekt berechnet wird. Verschiedene Oversampling-Raten werden vorgestellt, die die Genauigkeit und Geschwindigkeit der Messungen beeinflussen.

15:02

🏔️ Höhenkompensation für präzisere Druckmessungen

Hier wird erläutert, wie man die gemessenen Luftdruckwerte an die Meereshöhe anpasst, um genaue barometrische Druckwerte zu erhalten. Da der Luftdruck mit der Höhe variiert, müssen die Messungen kompensiert werden, um sie mit Wetterdaten aus anderen Quellen vergleichbar zu machen. Dies erfolgt durch eine Funktion, die den Druckwert auf den Wert am Meeresspiegel korrigiert.

Mindmap

Keywords

💡Barometrischer Druck

Barometrischer Druck, auch als atmosphärischer Druck bezeichnet, ist die Kraft, die die Luft auf die Erdoberfläche ausübt. Dieser Druck kann zur Wettervorhersage und Höhenmessung genutzt werden. Im Video wird der BMP-180-Sensor verwendet, um den barometrischen Druck zu messen, um Änderungen im Wetter oder in der Höhe zu bestimmen.

💡BMP-180 Sensor

Der BMP-180 ist ein barometrischer Drucksensor, der von Bosch hergestellt wird und zur Messung von Luftdruck und Temperatur verwendet wird. Dieser Sensor kommuniziert mit dem Arduino über den I2C-Bus. Im Video wird gezeigt, wie dieser Sensor verwendet wird, um barometrischen Druck und Temperatur zu messen.

💡Arduino

Arduino ist eine Open-Source-Elektronikplattform, die leicht zu programmieren und für viele DIY-Projekte geeignet ist. Im Video wird der Arduino verwendet, um Daten vom BMP-180-Sensor auszulesen und die Druck- und Temperaturwerte über den seriellen Monitor anzuzeigen.

💡I2C-Kommunikation

I2C (Inter-Integrated Circuit) ist ein serielles Kommunikationsprotokoll, das zum Datenaustausch zwischen Geräten verwendet wird. Der BMP-180-Sensor kommuniziert über I2C mit dem Arduino. Im Video wird erklärt, welche Pins auf dem Arduino verwendet werden müssen, um den Sensor korrekt anzuschließen.

💡Kalibrierung

Kalibrierung bezieht sich auf die Anpassung des Sensors, um genaue Messwerte zu erhalten. Im Video wird die Kalibrierung durch die begin-Funktion des BMP-180 durchgeführt, die die notwendigen Kalibrierkoeffizienten vom Sensor herunterlädt, um die Druck- und Temperaturmessungen anzupassen.

💡Temperaturmessung

Die Temperaturmessung ist ein wichtiger Teil des Druckmessprozesses, da die Temperatur die Dichte von Gasen beeinflusst und somit auch den Luftdruck. Im Video wird der BMP-180-Sensor verwendet, um die Temperatur zu messen, um die Druckwerte genauer zu machen.

💡Höhenmessung

Die Höhenmessung ist eine Anwendung des barometrischen Drucks, bei der der Druck verwendet wird, um die Höhe über dem Meeresspiegel zu bestimmen. Im Video wird erklärt, dass der BMP-180-Sensor verwendet werden kann, um basierend auf dem Druck die Höhe zu berechnen.

💡Überabtastung

Überabtastung (Oversampling) ist eine Methode, um die Genauigkeit einer Messung zu erhöhen, indem mehrere Proben genommen werden. Der BMP-180 bietet vier Stufen der Überabtastung, die die Präzision der Druckmessung beeinflussen. Höhere Überabtastungsraten bieten genauere Messungen, benötigen aber mehr Zeit.

💡SparkFun-Bibliothek

Die SparkFun-Bibliothek ist eine spezielle Softwarebibliothek, die entwickelt wurde, um die Kommunikation mit dem BMP-180-Sensor zu vereinfachen. Sie enthält Funktionen zur Anpassung der Messwerte an Temperaturänderungen und zur Berechnung der Höhe. Im Video wird diese Bibliothek verwendet, um die Programmierung des Arduino zu erleichtern.

💡Serieller Monitor

Der serielle Monitor ist ein Werkzeug innerhalb der Arduino-Software, das zur Anzeige von Daten, die vom Arduino gesendet werden, verwendet wird. Im Video wird der serielle Monitor verwendet, um die vom BMP-180 gemessenen Druck- und Temperaturwerte in Echtzeit anzuzeigen.

Highlights

Introduction to the BMP-180 barometric pressure sensor and its uses with Arduino.

Barometric pressure, also known as atmospheric pressure, is used in weather prediction and altitude measurement.

The BMP-180 sensor, made by Bosch, is a piezoresistive sensor that measures air pressure and temperature.

The BMP-180 sensor communicates with Arduino over I2C, using SDA and SCL pins.

Explanation of atmospheric pressure and its effects on weather and altitude.

Description of how barometric pressure is measured and its units (hectopascals and Pascals).

Temperature measurements are crucial for accurate pressure readings as temperature affects air density.

Details on how the BMP-180 library adjusts pressure readings for temperature changes.

Explanation of how atmospheric pressure changes with altitude and its importance.

Description of how weather influences barometric pressure and its use in weather prediction.

Step-by-step guide on setting up the BMP-180 sensor with Arduino and taking measurements.

Introduction to the SparkFun BMP-180 library for handling calculations and reading adjustments.

Demonstration of how to connect the BMP-180 sensor to the Arduino and start taking pressure and temperature readings.

Explanation of how to compensate pressure readings for altitude to compare with standard sea level readings.

Teaser for the next video on using the BMP-180 for altitude calculation based on atmospheric pressure.

Transcripts

play00:00

foreign

play00:02

[Music]

play00:12

we're going to learn how to use the

play00:14

bmp-180 parametric pressure sensor with

play00:16

the Arduino

play00:18

parametric pressure sensors are standard

play00:20

equipment in professional and DIY

play00:22

weather stations

play00:24

barometric pressure is another term for

play00:26

atmospheric pressure

play00:28

atmospheric pressure

play00:30

is a natural force that can be used to

play00:31

predict weather and even measure

play00:33

altitude

play00:35

in the next video we'll see how to use

play00:37

the BMP 180 to measure altitude

play00:39

but in this video we'll find out what

play00:42

atmospheric pressure is then look at a

play00:44

sketch that prints the pressure and

play00:45

temperature measurements to the serial

play00:47

monitor

play00:51

the bmp1ab sensor I'm going to use is a

play00:53

breakout board from Adafruit

play00:57

the sensor itself is a bmp-180 made by

play00:59

Bosch

play01:01

the bmp-180 has five pins

play01:05

it communicates with the Arduino over

play01:07

i2c

play01:09

so it has SDA and scl pins

play01:15

here's the ground pin

play01:20

and this is the VCC pin

play01:23

it says three volts but this breakout

play01:25

has a voltage regulator and an i2c level

play01:27

shifter

play01:28

so you can connect it to 5 volts too

play01:34

pin adjust the operating voltage of the

play01:35

sensor so it can be used in low voltage

play01:37

projects

play01:43

the bmp180 is a pzo resistive sensor

play01:47

PCO resistive sensors are a type of

play01:49

transducer where a physical force causes

play01:51

a change in resistance of the sensor

play01:53

element

play01:57

in the bmp-180 that forces air pressure

play02:04

the bmp-180 can measure any form of air

play02:06

pressure

play02:07

like the pressure inside a sealed

play02:09

container

play02:11

but it's mainly used to measure

play02:13

barometric pressure

play02:18

barometric pressure is caused by the

play02:20

weight of the atmosphere pressing down

play02:22

on the Earth's surface

play02:25

imagine a one inch by one inch column of

play02:27

air from the surface of the Earth to the

play02:29

top of the atmosphere

play02:32

all gases have mass including the air in

play02:34

the atmosphere

play02:36

and due to gravity this massive air

play02:38

exerts a pressure on the Earth's surface

play02:41

at the Earth's surface this one inch by

play02:43

one inch column of air weighs 14.7

play02:45

pounds

play02:50

a common unit of pressure measurement is

play02:51

the atmosphere or ATM

play02:55

One ATM is defined as 14.7 pounds per

play02:58

square inch

play03:02

the SI unit of pressure is the Pascal

play03:05

but one pascal is very small

play03:08

it's about the pressure that a single

play03:10

piece of paper exerts on a table top

play03:15

so for more practical usage we usually

play03:17

use the hectopascal which equals 100

play03:19

pascals

play03:22

the bmp-180 outputs pressure readings in

play03:24

hectopascals

play03:26

but you can convert it to any other unit

play03:27

of pressure

play03:29

the bmp-180 also measures temperature

play03:35

since temperature affects the density of

play03:37

gases like air

play03:39

it also affects the pressure exerted by

play03:41

that massive air

play03:43

colder temperatures cause air to become

play03:45

more dense so it weighs more and exerts

play03:47

more pressure

play03:53

warmer temperatures make the air less

play03:54

dense

play03:56

so it weighs less and exerts less

play03:57

pressure

play03:59

we can use the temperature measurements

play04:01

to make the pressure readings more

play04:02

accurate

play04:03

actually this will be done by the

play04:04

library we're going to use

play04:09

atmospheric pressure also changes with

play04:11

altitude

play04:12

if you're up in the mountains there's

play04:14

less air above you

play04:16

and less air mass to create pressure

play04:21

if you're at sea level there's more air

play04:23

above you

play04:24

which creates more atmospheric pressure

play04:28

we'll look at altitude effects on

play04:29

atmospheric pressure in the next video

play04:31

but for now let's look at something else

play04:33

that can influence atmospheric pressure

play04:35

the weather

play04:39

for hundreds of years barometers have

play04:42

been used to predict the weather

play04:44

usually a rising barometric pressure

play04:46

means that warm sunny weather is coming

play04:51

a following barometric pressure usually

play04:53

means that cool windy or rainy weather

play04:55

is coming

play04:59

a following barometric pressure is

play05:01

caused by a massive air rising from the

play05:03

Earth's surface

play05:06

the vacuum created by the rising air

play05:07

mass forms a low pressure area on the

play05:09

surface

play05:13

as the air mass gets higher in altitude

play05:15

it cools down and compresses

play05:18

water vapor in the air forming rain

play05:20

clouds

play05:22

it usually brings wind too because the

play05:25

surrounding air on the surface flows

play05:26

into the low pressure area

play05:31

a rising barometric pressure is caused

play05:33

by a massive air in the upper atmosphere

play05:35

falling to the Earth

play05:40

the weight of the falling Mass presses

play05:41

down on the surface increasing the air

play05:43

pressure below it

play05:46

the air mass gets warmer and expands as

play05:47

it gets closer to the surface

play05:50

this warm expanding air is usually low

play05:52

in humidity which prevents cloud

play05:54

formations

play05:56

Rising barometric pressures usually

play05:58

indicate that warm sunny weather is

play06:00

coming

play06:02

okay now let's set up the BMP 180 on the

play06:04

Arduino and take some measurements

play06:10

the bmp-180 uses i2c to communicate with

play06:12

the Arduino

play06:14

the Arduino Uno has the SDA pin at

play06:16

Analog pin A4

play06:19

and the scl pin at Analog pin A5

play06:23

other arduinos have the i2c pins in

play06:25

different locations

play06:26

so be sure to check that before

play06:28

connecting it

play06:30

all you have to do is connect SDA to SDA

play06:33

scl to scl

play06:36

ground to ground

play06:38

and VCC to either 5 volts or 3.3 volts

play06:43

connecting it to 5 volts here

play06:47

okay now for the library

play06:51

SparkFun has a great library for the

play06:53

bmp-180 called sfe bmp180

play06:57

this library takes care of all the math

play06:58

needed to adjust the pressure readings

play07:00

for changes in temperature

play07:02

it also has functions that calculate

play07:04

altitude

play07:06

you can download the library from GitHub

play07:07

at this link

play07:10

once you get that installed you're ready

play07:12

to start programming

play07:16

foreign

play07:18

this sketch is going to Output the

play07:20

barometric pressure and temperature to

play07:21

the serial monitor

play07:24

now as with all projects that use i2c we

play07:27

need to include the built-in wire

play07:28

Library

play07:30

then we need to include the bmp-180

play07:32

library with hash include

play07:34

sfe underscore bmp180.h

play07:40

next we create a BMP 180 object from the

play07:43

sfe bmp-180 class

play07:47

this will let us access all the

play07:48

functions in the library

play07:54

in the setup section we first initialize

play07:57

the serial monitor

play08:00

then we initialize the bmp-180 with the

play08:02

begin function

play08:04

the begin function downloads some

play08:06

calibration coefficients from the sensor

play08:08

that are needed for the pressure and

play08:10

temperature calculations

play08:12

it returns a non-zero value

play08:14

which gets stored in a Boolean variable

play08:16

called success

play08:19

to check that the initialization was

play08:20

successful we use an if statement with

play08:23

the success variable as the condition

play08:26

so if the sensor successfully

play08:28

initializes and the begin function

play08:30

Returns the non-zero value

play08:32

the condition inside here will be true

play08:35

and we enter the statement and Print

play08:37

bmp180 in its success to the serial

play08:40

monitor

play08:42

if the initialization fails the success

play08:45

variable will hold a zero value making

play08:47

this false

play08:49

if that's the case we won't get the

play08:51

success message and we'll know something

play08:52

is wrong with this sensor or the way

play08:54

it's connected

play09:01

in the loop section we first declare

play09:03

some variables

play09:06

the care variable status will hold

play09:08

different values that control the flow

play09:09

of the temperature and pressure

play09:10

measurement process

play09:13

the double variables T and P are going

play09:16

to hold the temperature and pressure

play09:17

values

play09:19

here we set the success variable to

play09:21

false

play09:22

so that it doesn't have a True Value the

play09:24

next time the Arduino starts up

play09:28

now we start a temperature measurement

play09:30

with the start temperature function

play09:34

this function Returns the time in

play09:35

milliseconds the Arduino needs to wait

play09:37

before receiving the temperature

play09:38

measurement

play09:41

the sensor takes 4.5 milliseconds to

play09:44

measure the temperature

play09:45

perform the calculations

play09:47

and return our reading

play09:48

so we can't get the temperature reading

play09:50

right away

play09:57

now we enter into a series of nested if

play09:59

statements that make sure that we read

play10:01

the sensor values in the right order and

play10:03

at the right time

play10:06

if the start temperature function

play10:07

successfully notifies the sensor to

play10:09

start a temperature measurement

play10:11

the status variable will hold the

play10:12

non-zero value

play10:15

that will make this condition true

play10:17

so the program will enter the first if

play10:19

statement

play10:21

we only need to wait 4.5 milliseconds

play10:23

before the temperature reading is ready

play10:26

but we're going to wait a full second to

play10:27

slow down the output and make it easier

play10:29

to read

play10:30

so we delay 1000 milliseconds here

play10:35

now we can receive the temperature value

play10:38

to do that we use the get temperature

play10:39

function

play10:41

this function gets the temperature

play10:43

reading from the sensor and passes it to

play10:45

the argument here

play10:48

in this case the argument is the

play10:49

variable t

play10:51

so the temperature reading will be

play10:52

stored in the T variable

play10:54

but the function itself returns a 1 if

play10:57

the temperature reading is successfully

play10:58

received

play10:59

and a zero if it's not

play11:01

and that value will be stored in status

play11:06

if the temperature reading was

play11:07

successfully received the value of

play11:09

status will be 1.

play11:11

making the condition inside the next if

play11:13

statement true

play11:15

this makes sure we get a valid

play11:17

temperature reading before we start the

play11:18

pressure measurement

play11:21

then we start a pressure measurement

play11:23

with the start pressure function

play11:26

the argument of the function sets the

play11:28

oversampling rate of the sensor

play11:31

oversampling sets how precise the

play11:32

bmp-180's pressure measurements are

play11:36

the value can be 0 1 2 or 3.

play11:41

a zero sets it at the lowest resolution

play11:42

and a 3 sets it at the highest

play11:44

resolution

play11:47

lower resolution means the sensor takes

play11:49

fewer samples

play11:51

so the measurement is performed faster

play11:52

but it's also less accurate

play11:56

a higher resolution means it takes more

play11:58

samples

play11:59

which takes longer but the reading is

play12:01

more accurate

play12:04

the start pressure function Returns the

play12:06

number of milliseconds we need to wait

play12:08

before receiving the pressure value

play12:12

so if the measurement was started

play12:13

successfully

play12:14

status will hold a non-zero value and

play12:17

the program will enter the next if

play12:18

statement

play12:20

the time we need to wait before

play12:22

receiving the pressure measurement

play12:23

depends on how your oversampling is set

play12:27

if your oversampling is set to the

play12:29

highest setting three

play12:31

you have to wait about 26 milliseconds

play12:35

but if it's set to the lower setting

play12:37

zero you only need to wait about five

play12:39

milliseconds

play12:42

we can use the delay function with

play12:44

status as an argument

play12:46

to delay the exact number of

play12:47

milliseconds we need to wait until the

play12:49

pressure measurement is ready to read

play12:57

after that we can receive the pressure

play12:59

values with the get pressure function

play13:03

the get pressure function takes two

play13:04

arguments p and t

play13:07

the temperature value measured earlier

play13:09

is stored in t

play13:11

which is passed to the function to

play13:12

perform the pressure calculations

play13:16

the result of the pressure calculation

play13:17

is stored in the P variable

play13:20

the get pressure function returns a 1 if

play13:22

the pressure measurement was

play13:24

successfully received from the sensor

play13:25

and a zero if not

play13:29

so if the pressure measurement was

play13:30

successfully received

play13:31

status will contain a 1. and the

play13:34

condition of the next if statement will

play13:35

be true

play13:42

inside the next if statement we print

play13:44

the TMP variables to the serial monitor

play13:48

first we print the word pressure equals

play13:50

with a space

play13:52

then we print the P variable on the same

play13:54

line

play13:56

the pressure measurements are in

play13:57

hectopascals

play13:59

so after that we print HPA with the

play14:01

serial print line to end the line

play14:05

now we do the same thing with the

play14:06

temperature

play14:07

I print the word temperature

play14:10

then the T variable

play14:12

then serial print line a c since the

play14:15

temperature measurement is in Celsius

play14:19

okay let's upload this and check it out

play14:31

I have my BMP 180 connected to my

play14:33

Arduino

play14:35

you can see the pressure and temperature

play14:36

measurements starting to come through

play14:38

it's pretty amazing how sensitive the

play14:40

sensor is when I lift the sensor up you

play14:42

can see the pressure measurement go down

play14:47

and when I lower the sensor the pressure

play14:49

measurement goes up

play14:51

that makes sense since lifting the

play14:53

sensor higher puts less air mass above

play14:54

it and results in a lower atmospheric

play14:56

pressure

play14:59

lowering it puts more air mass above it

play15:01

so the pressure gets higher

play15:04

the pressure reading here is the

play15:06

barometric pressure at my current

play15:07

altitude

play15:09

we saw earlier that the barometric

play15:10

pressure is affected by altitude

play15:13

this will be fine if all you want to do

play15:15

is measure changes in pressure

play15:17

but if you're building a weather station

play15:19

you'll probably want to compare the

play15:20

reading from the bmp-180 to pressure

play15:22

readings reported by different news and

play15:24

weather channels

play15:29

but those readings might have been taken

play15:31

from a different altitude than yours

play15:33

so we need to adjust the pressure

play15:35

reading to remove the effects of

play15:36

altitude

play15:39

to do that we can add a fixed amount of

play15:41

pressure to our readings to make it seem

play15:43

like the measurement was taken at sea

play15:44

level

play15:46

all weather stations do this to make the

play15:49

barometric pressure readings from

play15:50

stations at different altitudes

play15:51

comparable

play15:53

that way you'll know a low pressure

play15:55

reading at one station was caused by the

play15:57

weather and not due to a tire altitude

play16:01

the SparkFun library has a function that

play16:02

makes this easy

play16:07

we only have to make a few changes to

play16:09

the original sketch

play16:12

first we declare an INT variable called

play16:13

altitude

play16:15

this will hold the altitude of your

play16:17

current location in meters

play16:20

if you don't know your altitude you can

play16:21

look it up online or use an app on your

play16:23

phone

play16:25

the rest of the sketch Remains the Same

play16:34

except for the last if statement

play16:36

the SparkFun library has a function

play16:38

called sea level

play16:40

that outputs an altitude compensated

play16:41

pressure reading

play16:44

it takes two parameters

play16:47

the pressure variable and the altitude

play16:49

variable

play16:51

I'm going to store the result in a local

play16:53

float variable called comp for

play16:55

compensated

play16:57

now instead of printing the

play16:58

uncompensated pressure variable p

play17:01

we print the comp variable

play17:04

and that's it

play17:06

I won't demonstrate this sketch because

play17:08

my altitude is only 5 meters above sea

play17:10

level so it doesn't make a big

play17:11

difference

play17:13

but if you live at a higher elevation

play17:14

it's definitely going to have an effect

play17:17

in fact a difference in altitude of only

play17:19

8 meters changes the barometric pressure

play17:21

by one hectopascal

play17:24

in the next video we're going to see how

play17:26

to use the bmp180s atmospheric pressure

play17:28

measurements to calculate your altitude

play17:35

[Music]

play17:41

the three in one smart car and iot

play17:43

learning kit from Sun founder is a

play17:45

Hands-On all included Electronics kit

play17:48

that is perfect for anyone who wants to

play17:49

learn how to master the Arduino

play17:51

the kit comes with an Arduino 22

play17:54

different sensors and modules

play17:56

breadboards jumper wires and everything

play17:59

else you need to build a bunch of fun

play18:00

and interesting projects

play18:02

learn about robotics by building a

play18:04

remote controlled smart car that can be

play18:06

controlled with an infrared remote

play18:08

controller

play18:09

or drive on its own and avoid obstacles

play18:12

or fall on the line

play18:14

learn about the internet of things with

play18:16

a project that lets you monitor the

play18:18

temperature humidity and light level of

play18:20

a room from an app on your smartphone

play18:23

[Music]

play18:25

and build a plant monitor that tracks

play18:27

the temperature humidity light intensity

play18:29

and soil moisture

play18:31

displays it on your smartphone so you

play18:33

can keep your plants water remotely

play18:37

it's a super cool kit and I have lots of

play18:40

fun building all the projects in it so

play18:42

click the link in the description below

play18:43

to order the kit from Sun founder

Rate This

5.0 / 5 (0 votes)

Étiquettes Connexes
ArduinoBMP-180BarometerDrucksensorDIY-ProjektWetterstationLuftdruckHöhenmessungElektronikTemperatursensor
Besoin d'un résumé en anglais ?