The BME280 is a high-precision digital sensor manufactured by Laskakit (Part ID: Senzor Tem, Hum, Press). It is designed to measure temperature, humidity, and atmospheric pressure. This versatile sensor is widely used in applications such as weather stations, IoT devices, and environmental monitoring systems. Its compact size, low power consumption, and high accuracy make it an ideal choice for both hobbyists and professionals.
Parameter | Value |
---|---|
Supply Voltage | 1.8V to 3.6V |
Interface | I2C (up to 3.4 MHz) and SPI (up to 10 MHz) |
Temperature Range | -40°C to +85°C |
Temperature Accuracy | ±1.0°C |
Humidity Range | 0% to 100% RH |
Humidity Accuracy | ±3% RH |
Pressure Range | 300 hPa to 1100 hPa |
Pressure Accuracy | ±1 hPa |
Power Consumption | 3.6 µA (at 1 Hz sampling) |
Dimensions | 2.5 mm x 2.5 mm x 0.93 mm |
The BME280 module typically comes with 4 or 6 pins, depending on the breakout board design. Below is the pinout for a common 4-pin configuration:
Pin Name | Pin Number | Description |
---|---|---|
VCC | 1 | Power supply (1.8V to 3.6V) |
GND | 2 | Ground |
SCL | 3 | Serial Clock Line for I2C or SPI SCK |
SDA | 4 | Serial Data Line for I2C or SPI MOSI |
For 6-pin configurations, additional pins may include:
Pin Name | Pin Number | Description |
---|---|---|
CS | 5 | Chip Select for SPI (active low) |
SDO | 6 | Serial Data Out for SPI |
0x76
or 0x77
by connecting the SDO pin to GND or VCC, respectively.Below is an example of how to connect the BME280 to an Arduino UNO using the I2C interface:
The following code demonstrates how to read temperature, humidity, and pressure data from the BME280 using the Adafruit BME280 library:
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
// Create an instance of the BME280 sensor
Adafruit_BME280 bme;
// Define I2C address (default is 0x76, change to 0x77 if needed)
#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);
}
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
}
Sensor Not Detected:
Inaccurate Readings:
Communication Errors:
Q: Can the BME280 measure altitude?
Q: What is the difference between BME280 and BMP280?
Q: Can I use the BME280 with a 5V microcontroller?
Q: How do I change the I2C address?
0x76
or to VCC for 0x77
.By following this documentation, you can effectively integrate the BME280 sensor into your projects for accurate environmental monitoring.