BMP280 am ESP32

Today we would like to offer you the BMP Sensor Module Imagine.

The module is equipped with an ambient sensor from Bosch. This combines the 2 different sensor types: pressure sensor and temperature sensor. All this in a small 8-pin case.

It is located on a small board with 4 pins: VIN, GND, SCL and SDA.

This makes it very easy to connect the sensor to a microcontroller via I2C.

In this example, we'll use an ESP32 Dev kit

We connect the following pins:

ESP32 Dev Kit

BMP280 Module

3.3v

Vin

Gnd

Gnd

Scl

Scl

Sda

Sda

 

We use 2 libraries from Adafruit for our project: "Adafruit Unified Sensors" and "Adafruit BMP280 Library"

 

If they are not yet installed, the easiest way to integrate them is via the library manager of the Arduino IDE.

 

Then, via "File" - "Examples" - "Adafruit BMP Library" - "bmp280test" open the test sketch.

After the sketch is compiled and uploaded, we open the serial monitor by clicking on the icon at the top right (or with the key combination Ctrl+Shift+M):

 

Code:

 

#include <Wire.H>
#include <Adafruit_Sensor.H>
#include <Adafruit_BMP280.H>

#define BMP_SDA 21
#define BMP_SCL 22

Adafruit_BMP280 Bmp; I2c

Void Setup() {   Serial.Begin(9600);   Serial.println(Q("BMP280 test"));      If (!Bmp.Begin()) {       Serial.println("Could not find a valid BMP280 !");     while (1);   }
}    Void Loop() {     Serial.Print("T = ");     Serial.Print(Bmp.readTemperature());     Serial.println(" °C");          Serial.Print("P = ");     Serial.Print(Bmp.readPressure()/100);     Serial.println(" hPa ");     Serial.Print("H = ");     Serial.Print(Bmp.readAltitude(1013.25));      Serial.println(" m");          Serial.println();     Delay(2000);
}

until the next post :)

 

Esp-32ProduktvorstellungenSensors

3 comments

User

User

In einem anderen Forum habe ich folgende Aussage dazu gefunden wie Steffen schon bemerkt hat: "Connecting SDO to GND results in slave address 1110110 (0×76), connecting it to VCC results in slave address 1110111 (0×77), which is the same as BMP180’s I²C address. "

Steffen

Steffen

Das BMP280 Board (blau) hat Konnektoren! Um die Sensoren per Adafruit_BMP280 Bibliothek per I2C ansprechen zu können, muss zusätzlich der SDO Pin auf Vcc gelegt werden. Sonst stimmen die I2C Adressen nicht.

Sebastian

Sebastian

Moin,
Ist es richtig das der BMP auch Luftfeuchtigkeit misst? Ich dachte das macht nur der BME?

Mit freundlichen Grüßen Sebastian

Leave a comment

All comments are moderated before being published

Recommended blog posts

  1. Install ESP32 now from the board manager
  2. Lüftersteuerung Raspberry Pi
  3. Arduino IDE - Programmieren für Einsteiger - Teil 1
  4. ESP32 - das Multitalent
  5. OTA - Over the Air - ESP programming via WLAN