Arduino UNO and BME280 Sensor-Based Weather Station with Serial Monitoring
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit involves an Arduino UNO microcontroller interfaced with a BME/BMP280 sensor. The Arduino UNO provides power and communication to the sensor, which measures temperature, pressure, and humidity. The data collected by the sensor is then printed to the Serial Monitor.
Component List
Arduino UNO
- Description: A microcontroller board based on the ATmega328P.
- Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
BME/BMP280
- Description: A sensor module that measures temperature, pressure, and humidity.
- Pins: GND, SCL, SDA, VIN
Wiring Details
Arduino UNO
- 5V: Connected to VIN of BME/BMP280
- GND: Connected to GND of BME/BMP280
- A4: Connected to SDA of BME/BMP280
- A5: Connected to SCL of BME/BMP280
BME/BMP280
- VIN: Connected to 5V of Arduino UNO
- GND: Connected to GND of Arduino UNO
- SDA: Connected to A4 of Arduino UNO
- SCL: Connected to A5 of Arduino UNO
Code
/*
* This Arduino Sketch initializes the BME/BMP280 sensor and reads
* temperature, pressure, and humidity data from it. The data is then
* printed to the Serial Monitor.
*/
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#define BME_SDA A4
#define BME_SCL A5
Adafruit_BME280 bme;
void setup() {
Serial.begin(9600);
Wire.begin(BME_SDA, BME_SCL);
if (!bme.begin(0x76)) {
Serial.println("Could not find a valid BME280 sensor, check wiring!");
while (1);
}
}
void loop() {
Serial.print("Temperature = ");
Serial.print(bme.readTemperature());
Serial.println(" *C");
Serial.print("Pressure = ");
Serial.print(bme.readPressure() / 100.0F);
Serial.println(" hPa");
Serial.print("Humidity = ");
Serial.print(bme.readHumidity());
Serial.println(" %");
delay(2000);
}
This code initializes the BME/BMP280 sensor and reads temperature, pressure, and humidity data from it. The data is then printed to the Serial Monitor every 2 seconds.