Control BMP280

日本語のページ

You can control the temperature/pressure sensor BMP280.

Wiring

The BMP280 module and the microcontroller are connected via I2C.
The pin numbers used for I2C connection vary depending on the microcontroller.
For more information, see the "I2C connection" page.

For example, in the case of a plain ESP32, connect SDA to pin 21 and SCL to pin 22.

Example of connecting the original ESP32 and BMP280

Initialization

For microcontrollers with fixed I2C pin numbers, such as the original ESP32, use the "Initialize BMP280" block.

Initialize

Also, for microcontrollers with variable I2C pin numbers, such as the ESP32-S3, use a block that specifies the pin number during initialization.

Specify the SCL / SDA pin number and initialize

Getting temperature and air pressure

After initialization, you can use blocks to get temperature and air pressure.

Temperature is in Celsius, and pressure is in hectopascals.

The values ​​obtained by these blocks can be assigned to variables or output to the screen.

Get temperature

Get pressure

Example

The following example is an example of reading temperature and pressure from the BMP280 every second and outputting them to the web browser console.
This program can be downloaded from here.

Example of BMP280