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:
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 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.
- Adafruit BMP280 Library: Download here
- Adafruit SSD1306 library: Download here
- Adafruit GFX library: Download here
- 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:
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:
Now note that address and go to your library c++ file, library is usually installed in the “Documents/Arduino/Libraries”:
And open it with a proper editor, I’m using Dev c++
Then go to the line “41” and _i2caddr change the “a” with the address you found on the serial monitor:
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:
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.
Automation and Electrical Engineer, Electronics amateur trying to share my little projects.