How to Use the BME280 for Temperature, Humidity, and Pressure

The BME280 is a Bosch Sensortec environmental sensor that reports temperature, relative humidity, and barometric pressure from a single package, over either I²C (default address 0x76, or 0x77 with the SDO pin pulled high) or a 4-wire SPI bus. Inside the chip, three separate sensing elements do the work: a capacitive humidity element, a piezoresistive pressure element, and a bandgap temperature element, all read through the same digital interface and compensated in hardware before the values reach your microcontroller. It does not measure gas or VOCs — that fourth channel belongs to its sibling chip, the BME680. Because it packs three of the most commonly needed environmental readings onto one small breakout at low current draw, the BME280 is a standard choice for weather stations, indoor climate loggers, and altitude-estimating flight or drone electronics.

What does the BME280 measure?

Output Range Typical accuracy Resolution
Temperature −40°C to +85°C ±1°C 0.01°C
Relative humidity 0–100% RH ±3% RH 0.008% RH
Barometric pressure 300–1100 hPa ±1 hPa ~0.18 Pa

All three readings come off the same I²C or SPI transaction — there's no separate polling routine for each. The chip also exposes a register-readable ID (0x60) that firmware can use to confirm it's actually talking to a BME280 and not the pin-similar BMP280 (0x58, no humidity) or BME680 (0x61, adds gas), which matters if a project auto-detects sensors on a shared bus.

How accurate is the BME280?

The temperature and pressure readings are the most trustworthy of the three: ±1°C and ±1 hPa are tight enough for weather logging and altitude estimation without extra calibration. Humidity is the noisier channel at ±3% RH, and like any capacitive humidity sensor it drifts slightly with age and with exposure to condensation or contaminants — periodic cross-checks against a second hygrometer are worth doing if a project depends on precise humidity over months of continuous operation. None of the three channels needs user calibration to produce usable numbers out of the box; Bosch's compensation formulas, using per-chip calibration constants burned in at the factory, are applied in the driver library before you ever see a value.

How do you wire the BME280 to an ESP32?

ESP32 pin BME280 pin Signal
3V3 VCC Power
GND GND Ground
GPIO21 SDA I²C data
GPIO22 SCL I²C clock

Four wires, the standard I²C pattern. GPIO21/22 are the default I²C pins on the common ESP32-WROOM-32 dev board family; the C3, S2, and S3 variants can map I²C to different GPIOs, so check the pinout of the specific ESP32 board in hand. The BME280's sensing die runs on 3.3V logic natively, which is one reason it pairs cleanly with an ESP32 — there's no 5V-tolerance question to work through the way there can be on a 5V board like an Arduino Uno.

BME280 vs BME680: which one do you need?

The two chips share the same Bosch lineage, a similar footprint, and largely the same I²C register conventions for temperature, humidity, and pressure. The BME680 adds a fourth channel — a heated metal-oxide gas element that produces a resistance value used to derive a relative indoor air quality (IAQ) index — and that gas channel is also why the BME680 needs a burn-in period and, for a calibrated IAQ number rather than a raw resistance, Bosch's BSEC library. It also costs more than a plain three-channel sensor, since you're paying for that extra sensing element and its supporting library ecosystem. If a build only needs temperature, humidity, and pressure — a weather station, a greenhouse logger, an altitude-estimating altimeter — the BME280 is the simpler, cheaper, and equally accurate part for those three readings. Reach for the BME680 only when the project specifically needs to say something about air quality or VOCs.

Watch it built live

We typed this into Compoden's storefront assistant, Soldr, exactly as a customer would:

"I want to measure temperature, humidity, and air pressure using a BME280 sensor with an ESP32"

Compoden storefront AI assistant Soldr responding to a BME280 sensor request with an ESP32, showing the BME680 substituted into the parts tray

Soldr didn't have a standalone BME280 module to offer. Its reply: "Use for indoor air quality monitoring, weather stations, and altitude tracking. Here are the 6 we stock: BME680 Sensor Module — Rs.780, AHT10 Temperature and Humidity Sensor — Rs.120, AHT25 Temperature & Humidity Sensor — Rs.130, DHT11 Temperature & Humidity Sensor — Rs.45, BMP280 Barometric Pressure & Temperature Sensor Module — Rs.40, HTU21D Temperature and Humidity Sensor Module — Rs.160," and it added the BME680 to the tray as the nearest match. We followed up in the same session to confirm rather than guess: "I specifically need the BME280 model, not the BME680 or BMP280 — do you have that exact sensor in stock?" Soldr's answer was direct: "Here are the 2 we stock: BME680 Sensor Module — Rs.780, BMP280 Barometric Pressure & Temperature Sensor Module — Rs.40." In plain terms: Compoden does not currently carry a dedicated BME280 breakout. The BME680 covers everything a BME280 does plus a gas channel you may not need, and the BMP280 covers pressure and temperature at a much lower price but drops humidity entirely.

Watch the firmware get generated

We then asked Compoden's code assistant, Soldr's PWA build companion, to write real BME280 firmware, independent of what the storefront had in stock:

"I'm using a BME280 sensor over I2C with an ESP32 to read temperature, humidity, and pressure. Write the full firmware to read and print all three values to the serial monitor."

Soldr PWA firmware editor screenshot showing generated ESP32 code for a BME280 temperature, humidity, and pressure sensor using the Adafruit BME280 library

The build log is honest about the same gap seen on the storefront: under "Checking the catalog," the line for "Temperature, Humidity, And Pressure Sensor" reads "no match found", because there's no BME280 part record to attach. That didn't stop it from writing correct firmware for the sensor itself — the code assistant isn't limited to parts Compoden sells. It picked a TTGO T-Call ESP32 SIM800L as the generic ESP32 target (since no specific ESP32 variant was named in the prompt), and its own summary read: "Here's the firmware for your TTGO T-Call ESP32 SIM800L to read temperature, humidity, and pressure from a BME280 sensor over I2C and print the values to the serial monitor. The BME280 is connected to the default I2C pins (GPIO 21 for SDA, GPIO 22 for SCL) and uses the common address 0x76." The generated sketch includes #include <Wire.h>, #include <Adafruit_BME280.h>, and #include <Adafruit_Sensor.h>, defines BME_SCK as GPIO22 and BME_SDA as GPIO21, sets the I²C address to 0x76 with a comment noting the 0x77 fallback, and instantiates an Adafruit_BME280 bme; object for I2C mode — matching the wiring table above exactly. The instructions above the code panel tell you to install the Adafruit BME280 Library via the Arduino Library Manager before flashing.

What can you build with a BME280?

Anything that needs ambient temperature, humidity, and pressure without an air-quality channel: DIY weather stations, indoor climate loggers for a grow tent or server room, greenhouse controllers that react to humidity swings, and altitude estimation for drones or model rockets using the same barometric-formula trick as the BMP280, but with humidity logged alongside it. It's a common second sensor in ESP32 IoT nodes precisely because it answers three questions with one I²C address instead of running a separate humidity sensor and a separate barometer.

Get everything in this build

Compoden does not currently stock a dedicated BME280 module, so there is no BME280 SKU to link here honestly. The parts below are what Soldr's storefront assistant actually offered in response to the exact prompt above — live price and stock, direct add-to-cart links.

Part Price Add to cart
BME680 Sensor Module – Temp Humidity Pressure Gas, I2C/SPI (nearest available superset of the BME280) Rs.780 Add to cart
Total Rs.780 Add all 1 to cart

If the gas/VOC channel isn't needed and humidity can be dropped, the BMP280 Barometric Pressure & Temperature Sensor Module is Rs.40 and covers pressure plus temperature only — add to cart. An ESP32 dev board, a breadboard, and jumper wires are not included above; Compoden stocks ESP32 boards separately under Development Boards.

Built and Backed by Compoden

The parts listed above ship from Compoden's India stock and are checked for compatibility before they're carded together, not sourced individually and hoped to work. Delivery typically takes 3–7 days across India, with Cash on Delivery and UPI both available at checkout. Compoden's support team can help with wiring or firmware issues on a build, and if a stocked sensor doesn't perform as described, support will help troubleshoot or replace it.

FAQ

What I2C address does the BME280 use?
0x76 by default on most breakout modules, moving to 0x77 if the SDO pin is pulled high instead of tied to ground. That's the same address scheme used on the BMP280 and BME680.

Does Compoden sell the BME280 directly?
Not as a dedicated module at the time of writing. Compoden's closest in-stock parts are the BME680 (a superset that adds a gas/VOC channel on top of temperature, humidity, and pressure) and the BMP280 (temperature and pressure only, no humidity).

What's the real difference between the BME280 and the BME680?
The BME680 adds a fourth measurement, gas resistance for VOC/air-quality sensing, on top of the same temperature, humidity, and pressure channels the BME280 reports. The BME680 also needs a burn-in period for that gas channel and typically costs more.

Can the BME280 run on an Arduino Uno's 5V rail?
The bare chip's logic is 3.3V, but many breakout modules include an onboard regulator that tolerates a 5V supply. This varies by module, so check the specific breakout's markings or datasheet rather than assuming 5V safety.

Back to blog