The Gravity I2C BME280 Environmental Sensor is a versatile and precise sensor module that measures temperature, humidity, and atmospheric pressure. Based on the Bosch BME280 sensor, it is designed for easy integration into weather stations, home automation systems, and IoT applications. Its I2C interface facilitates communication with most microcontrollers, including Arduino platforms.
Pin Number | Pin Name | Description |
---|---|---|
1 | VCC | Power supply (3.3V to 5V) |
2 | GND | Ground |
3 | SDA | I2C Data Line |
4 | SCL | I2C Clock Line |
5 | CS | Chip Select (active low) |
6 | SDI | Serial Data Input (unused in I2C) |
7 | SDO | Serial Data Output (unused in I2C) |
Connection:
Library Installation:
Sample Code:
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
Adafruit_BME280 bme; // Create an instance of the BME280 library
void setup() {
Serial.begin(9600);
if (!bme.begin(0x76)) { // Initialize the BME280 sensor
Serial.println("Could not find a valid BME280 sensor, check wiring!");
while (1);
}
}
void loop() {
Serial.print("Temperature = ");
Serial.print(bme.readTemperature()); // Read temperature
Serial.println(" °C");
Serial.print("Humidity = ");
Serial.print(bme.readHumidity()); // Read humidity
Serial.println(" %");
Serial.print("Pressure = ");
Serial.print(bme.readPressure() / 100.0F); // Read pressure
Serial.println(" hPa");
delay(2000); // Wait for 2 seconds before next read
}
Q: Can I use multiple BME280 sensors on the same I2C bus? A: Yes, you can use two BME280 sensors by setting one to the alternative I2C address (0x77).
Q: How do I change the I2C address of the sensor? A: The I2C address can be changed by connecting the SDO pin to GND for address 0x76 or to VCC for address 0x77.
Q: What is the maximum cable length for the I2C connection? A: I2C is designed for short-distance communication. Keep the cable length as short as possible, preferably under 50cm, to ensure reliable communication.
Q: How can I calibrate the sensor? A: Calibration procedures vary; refer to the BME280 datasheet for detailed instructions. For most applications, factory calibration is sufficient.
For further assistance, consult the manufacturer's documentation or contact technical support.