The GY-BME280 3V3 is a compact digital sensor module designed for measuring temperature, humidity, and atmospheric pressure. Manufactured in China, this versatile sensor operates at 3.3V and supports both I2C and SPI communication protocols, making it an excellent choice for environmental monitoring applications. Its high precision and low power consumption make it ideal for use in weather stations, IoT devices, HVAC systems, and altitude measurement projects.
The GY-BME280 3V3 module is built around the Bosch BME280 sensor and includes additional circuitry for easy integration into projects. Below are the key technical details:
Parameter | Value |
---|---|
Operating Voltage | 3.3V |
Communication Protocols | I2C, SPI |
Temperature Range | -40°C to +85°C |
Temperature Accuracy | ±1.0°C |
Humidity Range | 0% to 100% |
Humidity Accuracy | ±3% RH |
Pressure Range | 300 hPa to 1100 hPa |
Pressure Accuracy | ±1 hPa |
Power Consumption | 3.6 µA (in sleep mode) |
Dimensions | 15mm x 13mm x 2.5mm |
The GY-BME280 3V3 module has 6 pins, as described in the table below:
Pin | Name | Description |
---|---|---|
1 | VIN | Power input (3.3V). Supplies power to the module. |
2 | GND | Ground. Connect to the ground of your circuit. |
3 | SCL | Serial Clock Line for I2C communication. |
4 | SDA | Serial Data Line for I2C communication. |
5 | CS | Chip Select. Used for SPI communication. Pull high or low depending on the mode. |
6 | SDO | Serial Data Output. Used for SPI communication. |
The GY-BME280 3V3 is easy to integrate into a variety of projects. Below are the steps to use it in a circuit:
Wiring: Connect the module to the Arduino UNO as follows:
VIN
→ 3.3V pin on the ArduinoGND
→ GND pin on the ArduinoSCL
→ A5 (I2C clock line on Arduino UNO)SDA
→ A4 (I2C data line on Arduino UNO)CS
and SDO
unconnected for I2C mode.Install Required Libraries:
Adafruit BME280
library and its dependency, Adafruit Sensor
, from the Arduino Library Manager.Upload Example Code: Use the following code to read temperature, humidity, and pressure data from the sensor:
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
// Create an instance of the BME280 sensor
Adafruit_BME280 bme;
void setup() {
Serial.begin(9600);
while (!Serial); // Wait for the serial monitor to open
// Initialize the BME280 sensor
if (!bme.begin(0x76)) {
// 0x76 is the default I2C address for the GY-BME280
Serial.println("Could not find a valid BME280 sensor, check wiring!");
while (1);
}
}
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();
delay(2000); // Wait 2 seconds before the next reading
}
0x76
. If there are address conflicts, you can change it to 0x77
by pulling the SDO
pin high.Sensor Not Detected:
0x76
or 0x77
) is used in the code.Incorrect Readings:
Communication Errors:
Q1: Can I use the GY-BME280 with a 5V microcontroller?
A1: Yes, but you must use a logic level shifter to convert the 5V signals to 3.3V to avoid damaging the sensor.
Q2: How do I switch between I2C and SPI modes?
A2: For I2C mode, leave the CS
pin unconnected. For SPI mode, connect the CS
pin to the appropriate control signal and configure the SDO
pin.
Q3: What is the maximum cable length for I2C communication?
A3: The maximum length depends on the pull-up resistor values and the I2C clock speed. For most applications, keep the cable length under 1 meter to ensure reliable communication.
By following this documentation, you can effectively integrate the GY-BME280 3V3 into your projects and troubleshoot common issues with ease.