The BME 280, manufactured by Adafruit, is a high-performance sensor designed to measure temperature, humidity, and atmospheric pressure. This versatile sensor is widely used in environmental monitoring, weather stations, and Internet of Things (IoT) applications. Its compact size, low power consumption, and high accuracy make it an ideal choice for projects requiring precise environmental data.
The BME 280 sensor offers a range of features and specifications that make it suitable for various applications. Below are the key technical details:
Parameter | Value |
---|---|
Supply Voltage | 1.8V to 3.6V |
Operating Current | 2.7 µA (at 1 Hz) |
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 |
Communication Protocols | I2C, SPI |
The BME 280 sensor typically comes in a breakout board format with the following pin configuration:
Pin Name | Description |
---|---|
VIN | Power supply input (1.8V to 3.6V) |
GND | Ground connection |
SCL | I2C clock line / SPI clock input |
SDA | I2C data line / SPI data input |
CS | Chip select for SPI (active low) |
SD0 | SPI data output / I2C address selection |
Note: For I2C communication, the SD0 pin determines the I2C address:
0x76
0x77
0x76
) or VIN (0x77
).Below is an example of how to use the BME 280 with an Arduino UNO via I2C:
#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)
#define BME280_I2C_ADDRESS 0x76
void setup() {
Serial.begin(9600); // Initialize serial communication
while (!Serial); // Wait for serial port to connect (for native USB boards)
// 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 initialization fails
}
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");
delay(2000); // Wait 2 seconds before the next reading
}
Sensor Not Detected:
Incorrect Readings:
Communication Errors:
Q: Can the BME 280 measure altitude?
A: Yes, the BME 280 can calculate altitude based on atmospheric pressure readings. Use the readAltitude()
function in the Adafruit library.
Q: What is the maximum cable length for I2C communication?
A: The maximum cable length depends on the pull-up resistor values and the I2C clock speed. For standard setups, keep the cable length under 1 meter for reliable communication.
Q: Can the BME 280 operate at 5V?
A: No, the BME 280 operates at a maximum voltage of 3.6V. Use a level shifter if interfacing with a 5V microcontroller.
Q: Is the BME 280 waterproof?
A: No, the BME 280 is not waterproof. Use a protective enclosure if deploying it in outdoor or humid environments.