Introduction
This experiment demonstrates how to use the BME280 sensor to measure temperature, humidity, and pressure.

Components Needed
- BME280 Sensor
- Arduino (e.g., Uno, Nano)
- Jumper wires
Circuit Setup
- Connect the BME280 sensor's VCC pin to 3.3V on the Arduino.
- Connect the GND pin to ground.
- Connect the SDA and SCL pins to A4 and A5 on the Arduino for I2C communication.
The sensor will start collecting data when powered on.

Code for Temperature and Pressure Measurement
Upload the following code to your Arduino to read the temperature and pressure from the BME280 sensor:
#include
#include
#include
Adafruit_BME280 bme; // Create an instance of the BME280 sensor
void setup() {
Serial.begin(9600);
if (!bme.begin()) {
Serial.println("Could not find a valid BME280 sensor, check wiring!");
while (1);
}
}
void loop() {
Serial.print("Temperature: ");
Serial.print(bme.readTemperature());
Serial.print(" °C");
Serial.print(" Pressure: ");
Serial.print(bme.readPressure() / 100.0F);
Serial.println(" hPa");
delay(1000);
}
Explanation
The BME280 sensor is used to measure environmental conditions. It outputs data for temperature, humidity, and pressure, which can be displayed on a serial monitor or used in more complex applications.
Troubleshooting
- If the sensor isn't reading data, double-check the wiring and ensure you have the correct libraries installed.
- If readings seem inaccurate, make sure the sensor is calibrated properly or check for any interference with other electronics.