Skip to content

Using BMP280 to measure Temperature, Pressure and Altitude + Arduino & OLED

 

 Get your Grove BMP280 sensor from Seeedstudio now, click here !!

              Hello, and welcome to this tutorial where I use the BMP280 to measure Temperature, Pressure and also Altitude, with the help of an Arduino UNO board and an OLED display, and here some of the BMP280 key parameters from its datasheet:

 

1.jpg
BMP 280 Key parameters

         So for this project, we gonne use the module to measure all these stuff in both metric and imperial systems as usual, I’m not quiet sure about the units but you can always convert them through the code, and here are the components we gonna use:

 

Wiring:

Wiring

    Wiring is simple both modules uses the i²c interface, SDA/SCL with A4 and A5, the BMP280 is powred by 5v meanwhile the OLED is using the 3.3v.

Libraries:

Codes:

  • First I used the code from the example “BMP280test”
  • Codes for displaying on Serial monitor: Download here
  • Codes for displaying on OLED display: Download here
  • i²c scanner code: Download here

Test and Troubleshooting:

      After wiring your module, it’s better to test the code from the library example its name is “BMP280test”, if your module isn’t detected like in the picture below:

test1.png
Module not detected by the library

You can run the i²c scanner code (But unplung any other i²c device like a LCD or OLED), and if your module is not broken, or doesn’t have a solder problem, you’ll see that the device is detected by the scanner:

test2.png
Module detected, note the address

Now note that address and go to your library c++ file, library is usually installed in the “Documents/Arduino/Libraries”:

lib1.jpg
Library folder

And open it with a proper editor, I’m using Dev c++

lib2
look of _i2caddr = a line

Then go to the line “41” and _i2caddr change the “a” with the address you found on the serial monitor:

lib3
Replace a with the i²c address of the module

Save all and close, the library is meant to work with modules that have 0x77 as i²c address but the one I’m using has 0x76.

Run the test code again:

test3.jpg
Things are alright

Test pictures:

I hope it works for you, and if you have any problem contact me on my FB page, Don’t forget to support us by a subscribe to the channel.

Yassine View All

Automation and Electrical Engineer, Electronics amateur trying to share my little projects.

Leave a Reply

%d bloggers like this: