Arduino Home Weather Station with BME280 using I2C

Materials

  • Arduino Uno
  • BME280 Sensor
  • Breadboard and Jumper Wires

Instructions

  1. Connect the BME280 sensor to the Arduino using I2C.
  2. Upload the following code to your Arduino:

#include <"Wire.h">
#include <"Adafruit_Sensor.h">
#include <"Adafruit_BME280.h">
Adafruit_BME280 bme;
void setup() {
Serial.begin(9600);
if (!bme.begin()) {
Serial.println(“Could not find a valid BME280 sensor, check wiring!”);
while (1);
}
}
void loop() {
float temperature = bme.readTemperature();
float humidity = bme.readHumidity();
float pressure = bme.readPressure() / 100.0F;
Serial.print(“Temperature: “);
Serial.print(temperature);
Serial.print(” C, “);
Serial.print(“Humidity: “);
Serial.print(humidity);
Serial.print(” %, “);
Serial.print(“Pressure: “);
Serial.print(pressure);
Serial.println(” hPa”);
delay(2000);
}

Explanation

This code reads temperature, humidity, and pressure from the BME280 sensor and prints the data to the serial monitor. It’s useful for building a weather monitoring station.

Conclusion

This home weather station project offers insights into environmental monitoring and data collection, providing valuable information for various applications.

Leave a Comment

Pillow home studio.