The BME/BMP280 is a high-precision digital sensor designed to measure temperature, humidity, and atmospheric pressure. Manufactured by Bosch Sensortec, this sensor is widely used in weather stations, Internet of Things (IoT) devices, and environmental monitoring systems. Its compact size, low power consumption, and high accuracy make it an ideal choice for battery-powered and portable applications.
The BME280 is capable of measuring temperature, humidity, and pressure, while the BMP280 is a variant that measures only temperature and pressure. Both sensors communicate via I2C or SPI interfaces, making them easy to integrate with microcontrollers and development boards like the Arduino UNO.
Parameter | BME280 | BMP280 |
---|---|---|
Supply Voltage | 1.71V to 3.6V | 1.71V to 3.6V |
Operating Current | 2.7 µA (humidity + pressure + temp) | 2.7 µA (pressure + temp) |
Temperature Range | -40°C to +85°C | -40°C to +85°C |
Humidity Range | 0% to 100% RH | Not applicable |
Pressure Range | 300 hPa to 1100 hPa | 300 hPa to 1100 hPa |
Communication Interface | I2C (up to 3.4 MHz) or SPI (up to 10 MHz) | I2C (up to 3.4 MHz) or SPI (up to 10 MHz) |
Accuracy (Temperature) | ±1.0°C | ±1.0°C |
Accuracy (Pressure) | ±1 hPa | ±1 hPa |
Accuracy (Humidity) | ±3% RH | Not applicable |
The BME/BMP280 sensor module typically comes with a breakout board that includes the following pins:
Pin Name | Description |
---|---|
VCC | Power supply pin (1.71V to 3.6V). Connect to 3.3V for most applications. |
GND | Ground pin. Connect to the ground of the circuit. |
SCL | Serial Clock Line for I2C communication or SPI clock input. |
SDA | Serial Data Line for I2C communication or SPI data input/output. |
CS | Chip Select for SPI communication. Pull low to enable SPI mode. |
SDO | Serial Data Output for SPI communication or I2C address selection. |
Note: For I2C communication, the SDO pin is used to set the I2C address. Connect it to GND for address 0x76
or to VCC for address 0x77
.
To use the BME/BMP280 with an Arduino UNO, follow these steps:
Wiring: Connect the sensor to the Arduino as follows:
VCC
→ 3.3V
GND
→ GND
SCL
→ A5
(I2C clock line on Arduino UNO)SDA
→ A4
(I2C data line on Arduino UNO)Install Libraries: Install the Adafruit BME280 or BMP280 library from the Arduino Library Manager. Go to Sketch > Include Library > Manage Libraries
, search for "Adafruit BME280" or "Adafruit BMP280", and install it.
Example Code: Use the following code to read temperature, humidity, and pressure from the sensor:
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
// Create an instance of the BME280 sensor
Adafruit_BME280 bme;
// Define I2C address (0x76 or 0x77 based on SDO pin connection)
#define BME280_I2C_ADDRESS 0x76
void setup() {
Serial.begin(9600);
while (!Serial); // Wait for serial monitor to open
// Initialize the BME280 sensor
if (!bme.begin(BME280_I2C_ADDRESS)) {
Serial.println("Could not find a valid BME280 sensor, check wiring!");
while (1); // Halt execution if sensor is not found
}
Serial.println("BME280 sensor initialized successfully!");
}
void loop() {
// Read and print temperature, humidity, and pressure
Serial.print("Temperature: ");
Serial.print(bme.readTemperature());
Serial.println(" °C");
Serial.print("Humidity: ");
Serial.print(bme.readHumidity());
Serial.println(" %");
Serial.print("Pressure: ");
Serial.print(bme.readPressure() / 100.0F); // Convert Pa to hPa
Serial.println(" hPa");
Serial.println(); // Add a blank line for readability
delay(2000); // Wait 2 seconds before the next reading
}
SCL
/SDA
and VCC
.0x76
or 0x77
) based on the SDO pin connection.Sensor Not Detected:
Incorrect Readings:
Arduino Freezes or Crashes:
Q: Can I use the BME/BMP280 with a 5V microcontroller?
A: Yes, but you must use a logic level shifter to convert the 5V signals to 3.3V. Alternatively, some breakout boards include built-in level shifters.
Q: How do I switch between I2C and SPI modes?
A: For I2C mode, leave the CS
pin unconnected or pull it high. For SPI mode, connect the CS
pin to the microcontroller and configure the SPI interface in your code.
Q: Can I use multiple BME/BMP280 sensors on the same I2C bus?
A: Yes, but each sensor must have a unique I2C address. Use the SDO pin to set different addresses (0x76
or 0x77
).
Q: What is the difference between the BME280 and BMP280?
A: The BME280 measures temperature, humidity, and pressure, while the BMP280 measures only temperature and pressure.