Project

General

Profile

Pressure Sensor

The BMP180 and BMP280 air pressure sensors operates on the S2C protocol which much be setup before using this device. To do this, look at the following section:

Setting up I2C

First step is to install i2c tools, this makes detecting device addresses much easier. This can be accomplished by running the following command.

sudo apt-get install -y i2c-tools

Next you will need to make sure I2C is enabled on the raspberry.
To do this, run the following command:

sudo raspi-config

You will presented with a menu screen. Select 5. Interfacing Options, and then P5, I2C.
Enable this interface, exit and save configuration.

WiringPi Prerequsites

I2C functionality requires WiringPi to be installed on your raspberry pi. In some cases this is pre-installed. To check whether this is installed, run the following command.

gpio readall

If Wiring Pi installed, you will be presented with a chart similar to the following:

 +-----+-----+---------+------+---+---Pi 3---+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
 |   2 |   8 |   SDA.1 | ALT0 | 1 |  3 || 4  |   |      | 5v      |     |     |
 |   3 |   9 |   SCL.1 | ALT0 | 1 |  5 || 6  |   |      | 0v      |     |     |
 |   4 |   7 | GPIO. 7 |   IN | 0 |  7 || 8  | 0 | IN   | TxD     | 15  | 14  |
 |     |     |      0v |      |   |  9 || 10 | 1 | IN   | RxD     | 16  | 15  |
 |  17 |   0 | GPIO. 0 |   IN | 0 | 11 || 12 | 0 | IN   | GPIO. 1 | 1   | 18  |
 |  27 |   2 | GPIO. 2 |   IN | 0 | 13 || 14 |   |      | 0v      |     |     |
 |  22 |   3 | GPIO. 3 |   IN | 0 | 15 || 16 | 0 | IN   | GPIO. 4 | 4   | 23  |
 |     |     |    3.3v |      |   | 17 || 18 | 0 | IN   | GPIO. 5 | 5   | 24  |
 |  10 |  12 |    MOSI | ALT0 | 0 | 19 || 20 |   |      | 0v      |     |     |
 |   9 |  13 |    MISO | ALT0 | 0 | 21 || 22 | 0 | IN   | GPIO. 6 | 6   | 25  |
 |  11 |  14 |    SCLK | ALT0 | 0 | 23 || 24 | 1 | OUT  | CE0     | 10  | 8   |
 |     |     |      0v |      |   | 25 || 26 | 1 | OUT  | CE1     | 11  | 7   |
 |   0 |  30 |   SDA.0 |   IN | 1 | 27 || 28 | 1 | IN   | SCL.0   | 31  | 1   |
 |   5 |  21 | GPIO.21 |   IN | 1 | 29 || 30 |   |      | 0v      |     |     |
 |   6 |  22 | GPIO.22 |   IN | 1 | 31 || 32 | 0 | IN   | GPIO.26 | 26  | 12  |
 |  13 |  23 | GPIO.23 |   IN | 0 | 33 || 34 |   |      | 0v      |     |     |
 |  19 |  24 | GPIO.24 |   IN | 0 | 35 || 36 | 0 | IN   | GPIO.27 | 27  | 16  |
 |  26 |  25 | GPIO.25 |   IN | 0 | 37 || 38 | 0 | IN   | GPIO.28 | 28  | 20  |
 |     |     |      0v |      |   | 39 || 40 | 0 | IN   | GPIO.29 | 29  | 21  |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+---Pi 3---+---+------+---------+-----+-----+

If you get this chart, proceed to Connecting the Sensor
If you get a no such command error, proceed to installation instructions:

Installing WiringPi

Wiring Pi requires that you install git, and then compile the code, therefore you must first install git. To do this from the command line, run the following commands.
First update the pi:

sudo apt-get update && sudo apt-get upgrade

Once this is finished, now install git:

sudo apt-get install git git-core

Then use git to download wiringpi code:

it clone git://git.drogon.net/wiringPi
cd wiringPi
./build

Once this is done you can now run the gpio command and verify wiring pi is installed.

Turn off the device to plug in your sensor

sudo shutdown

Connecting the Sensor - BMP280

Use the following wiring diagram to connect your device. Note that SDI and SCK MUST be connected to pins 3 and 5 as I2C devices must communicate on those pins.
BMP280 Wiring Diagram

Connecting the Sensor - BMP180

Use the following wiring diagram to connect your device. Note that SCL and SDA MUST be connected to pins 3 and 5 as I2C devices must communicate on those pins.
BMP180 Wiring Diagram

Detecting and working with your device

Both the BMP180 and 280 sensors will work in a similar fashion, for either sensor, you may following the next instructions.

Turn on your raspberry Pi and let it boot up. Once you are logged in, run the following command

i2cdetect -y 1

You will presented with a map like the following:

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- 77

This polls bus 1 of the i2c system, which is the one the model 3 uses.

Devices connected using i2c will be listed in this screen. In this case a device is connected at address 77.

Error from i2cdetect

If you result in this error:

Error: Could not open file `/dev/i2c-1' or `/dev/i2c/1': No such file or directory

You are likely using an older model such as the model 1 and 2 and will need to check bus 0

i2cdetect -y 0

Adding the Sensor

Once you've connected the device and booted, now proceed to add the sensor from Light Sensor -> BH1750

Note that the Address and Bus are separate entries. Be sure that you select the proper address as displayed in the graph. In our example it is 77 on bus 1.

Once added, the client will display the ambient air pressure in hectopascals (hPa).

A Note about connections

In some cases the BMP280 sensor might not receive enough power from the breakout board or ribbon cables. i2cdetect will show devices if they are receiving enough power, however if none is shown, or you get an entry of 00 someplace in the matrix, your device might not have enough power to run.

BMP180 and BMP280

Tigase IoT One Cloud is compatible with the BMP180 and BMP280 devices, they are similar and will both provide the same information however, the BMP280 provides slightly more accurate results.

Field BMP180 BMP280
Temp range -40-85C -40-85C
Temp Accuracy +/- 1C +/- 1C
Pressure range 300-1100 hPa 300-1100 hPa
Pressure Accuracy +/- 1hPa +/- 0.12hPa
Max Sampling Rate 1Hz 1Hz

Pressure and Temperature

The same sensor can be used for both Temperature and Pressure samplings, and you may setup 2 devices on the same pin to poll both.

Hectopascals and other units

Hectopascals are essentially identical to Millibar in terms of atmospheric pressure, so they can be considered a 1:1 conversion ratio. If you wish to convert hectopascals to Pounds per Square Inch, or PSI multiply your number by 0.0145038.