Home › Lessons › Embedded (ESP32) › I²C sensor: temperature, humidity, pressure

I²C sensor: temperature, humidity, pressure

Embedded (ESP32) · Intermediate · about 20 minutes · part of Zen’s Electronics Design Mastery

Environmental sensors like the BME280 sit on the I²C bus at a fixed address and return calibrated readings. A library hides the register details; the program’s job is to read on a schedule and act, here lighting the LED when it is hotter than 30 °C.

I²C sensor: temperature, humidity, pressure: the circuit on the simulator's bench

Open this lesson in the labFree, in your browser, no account needed.

How it works

BME280 at 0x76 (0x77 with SDO high). Temperature ±1 °C, humidity ±3 %RH, pressure ±1 hPa. Pressure falls about 12 hPa per 100 m of altitude, so it doubles as an altimeter.

The sensor heats itself a little when read quickly: one reading per second is plenty for room conditions.

Try it on the bench

  1. Select the sensor and raise the temperature past 30 °C: the onboard LED comes on.
  2. Change the address in the sketch to 0x77: “BME280 not found”.

Parts on the bench

In the course

Zen’s Electronics Design Mastery, module “Microcontrollers & Embedded”.

More on embedded (esp32)