Complete Guide on BMP180 Pressure Sensor Arduino Interface

在这个项目中,我将向您展示如何与Arduino接口BMP180气压和温度传感器。在此过程中,您将看到典型压力传感器的功能和规范以及BMP180 Arduino界面的工作方式。

We will see how to connect this sensor with Arduino UNO board, install the necessary software libraries and get the data from the sensor.

BMP180-with-Arduino-1

介绍

Barometric Pressure (also known as Atmospheric Pressure), is the force exerted by air at a given point. The device used to measure the atmospheric pressure is known as Barometer (hence the name Barometric Pressure).

Atmospheric Pressure is inversely proportional to the elevation or altitude i.e., as the elevation increases, the atmospheric pressure decreases. Hence, the air pressure on a mountain top is less than that at sea level.

There is a significant importance in the measurement of Barometric Pressure as it varies from point to point on Earth and it helps in studying, analysing and predicting the weather and climate.

我们知道压力的SI单位是Pascal,它是单位面积的力(1 pa = 1 n/m2)但是,气压通常在海hoccascal(1 HPA = 100 PA)或Millibar(1 MBAR = 100 PA = 1 HPA)中表示。

在海平面,平均大气压约为101,325 PA(≈1,013mbar或1,013 HPA)。这被称为标准气氛(ATM = 101,325 PA)。

Enough lecture on Physics. Let us move on with BMP180Arduino界面. First, let us see a little bit about the BMP180 Barometric Pressure Sensor.

A Brief Note on BMP180 Sensor

BMP180是Bosch的数字气压传感器。它是基于压电电阻MEMS设备的超低动力设备。它可以测量300 hPa至1100 hPa的大气压。

除压力外,BMP180传感器还可以测量0的温度0C to 650C. By measuring the pressure, you can also deduct the altitude of the point (as they both are related).

BMP180传感器
BMP180传感器引脚

The actual BMP180 Sensor is a tiny device with dimensions 3.6mm x 3.8mm. It is available in 7 pin LGA package and communicates with a Microcontroller either through I2C or SPI (only one is possible in the final sensor).

An important point about sensors is its calibration. A sensor needs to be properly calibrated to produce acceptable results. Fortunately, all the Bosch BMP180 Barometric Pressure Sensors are factory calibrated so that they are ready to use.

BMP180模块

Many third-party module and sensor manufacturers took the tiny BMP180 Sensor and designed a small Module, which is perfectly suitable for Arduino and other DIY Projects. Most of the modules available today use I2C Communication.

BMP180模块前

如果您想查看BMP180模块的引脚,则将其打印在PCB的背面。此版本的传感器通过i通信2C and hence the module consists of only 4 pins.

  • Vin
  • GND
  • SCL
  • SDA

BMP180-Module-Back

模块的示意图

由于BMP180传感器在3.3V上工作,因此该模块由板载3.3V电压调节器组成,因此您可以直接从Arduino等5V板上为模块供电。如果您想要该模块的完整示意图,请查看下一个图像。

BMP180-Module-Schematic
Schematic of BMP180 Module

As you can see from the schematic, the SCL and SDA pins of the I2C communication are pulled HIGH using two 4.7 KΩ Resistors respectively. You don’t need to worry about the pull-up resistors anymore.

IMPORTANT NOTE:那里似乎有太多的假或错误或错误校准的Bosch BM180传感器(至少根据我的经验)。我为这个项目购买了3个不同的模块(来自三个不同的供应商)。因此,从知名的卖家那里购买。

将BMP180与Arduino连接

Now that we have seen a little bit about the BMP180 Sensor and its capabilities, let us proceed with BMP180 Arduino Connection. The BMP180 Sensor has to be one of the simplest sensors available for Arduino.

For getting started with BMP180, all you need is an Arduino UNO, a BMP180 Sensor, bunch of connecting wires and a PC (or a laptop). That’s it. You can make few simple connections and get the data from the sensor on the Serial Monitor of Arduino IDE.

BMP180-with-Arduino-2

但是,为了使事情变得有趣,我使用了一个特定于16×2字符LCD的LCD模块,以显示传感器的结果。

The reason for this is you can extend this simple project into a full-blown Weather Station Project as BMP180 can measure Pressure, Temperature and Altitude and with an LCD Display, implementing a weather station will be more intuitive.

Components Required

  • ArduinoUNO
  • BMP180 Pressure Sensor
  • 16×2 LCD
  • PCF8574 I2C LCD Module (optional)
  • 面包板
  • 连接电线
  • 面包板电源(可选)

Circuit Diagram

下图显示了将BMP180与Arduino接口的电路图。我选择了一个我2C LCD作为传感器也基于I2C communication. You can check out more about Interfacing I2c lcd与arduino这里.

BMP180-Arduino-Interface-Circuit-Diagram
Circuit Diagram of BMP180 Arduino Interface

Code

Before going to the code, you have to download the libraries for BMP180 Sensor. There are three options for this:

  • Adafruit BMP085库
  • Adafruit BMP085 Unified Library
  • Sparkfun的BMP180突破Arduino图书馆

我选择了“ Adafruit BMP085库”的简单性。您总是可以尝试其他库。是的,图书馆说“ BMP085”。这是因为BMP180是上一代BMP085传感器的替代品。

在软件方面没有差异,您可以为两个传感器使用相同的库。

IMPORTANT NOTE:我相信即使是BMP180传感器也被Bosch停用,并由BME280取代。因此,我的下一个项目将基于BME280传感器。

要下载库,请打开Arduino IDE并转到工具 - >管理库…

BMP180-图1

在搜索栏中,键入BMP180并点击Enter。选择“ Adafruit BMP085库”,然后单击“安装”。

BMP180-图2

就代码而言,我只是使用库来读取传感器的压力和温度读数并将其显示在LCD上。

Working

BMP180的数据表清楚地说明了如何从传感器中提取压力和温度数据。此处介绍的所有信息都是从数据表本身获取的。

Following image shows the sequence of steps to follow in order to read the data from the sensor. Here, UT is 16-bit Temperature Data and UP is 16-bit – 19-bit Pressure Data.

BMP180-Measurement-Steps

在这个过程中,你必须执行大量的广告样稿licated mathematical calculations. For example, take a look at the maths involved in calculating Temperature and Pressure from BMP180 Sensor.

BMP180计算 - 压力

This is just a part of the complete logic and the datasheet gives you complete information.

感谢Arduino库,因为它们在幕后进行了所有必要且复杂的计算,并为您提供简单的API。一些有用的API表格Adafruit BMP085库是:

  • readtemperature();
  • readPressure();
  • readsealevelpressure();
  • readAltitude();
  • readRawTemperature();
  • ReadRawPressure();

有关API的更多信息,请访问库的GitHub页面。

结论

在这个项目中,您了解了如何与Arduino接口BMP180传感器并测量压力和温度值。在未来的项目中,我将向您展示如何与Arduino连接更好,高级的BME280传感器。

发表评论

Your email address will not be published.

Electronicshub Favicon
<\/i>","library":""}}" data-widget_type="nav-menu.default">
Baidu