Arduino Uno: Wetterstation (BME280 + OLED)
BME280 misst, OLED zeigt an (I²C).
- Arduino Uno
- BME280
- SSD1306 OLED
Im Simulator öffnenOhne Konto: Simulieren drücken, und es läuft.

So funktioniert es
BME280 misst Temperatur, Luftdruck und Feuchte, das 0,96"-OLED (SSD1306) zeigt die Werte – beide am I²C-Bus des Uno (A4 = SDA, A5 = SCL), mit den Original-Bibliotheken von Adafruit. Die Umgebung des Sensors ist im Inspektor einstellbar, auch während die Simulation läuft; das OLED-Bild erscheint im Live-Fenster.
Verdrahtung
Jede Zeile ist eine Verbindung (Netz) mit den Pins, die sie verbindet.
| Netz | Pins |
|---|---|
| GND | A1 GNDDS1 GNDU2 GNDV1 − |
| 5V | A1 5VDS1 VCCR1 1R2 1U2 VINV1 + |
| SCL | A1 A5/SCLDS1 SCLR1 2U2 SCL |
| SDA | A1 A4/SDADS1 SDAR2 2U2 SDA |
Bauteile
Firmware
sketch.ino · 27 Zeilen
// Weather station: the BME280 (0x76) measures, the SSD1306 OLED (0x3C) displays, both on the I²C bus (A4/A5)
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_BME280.h>
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
Adafruit_BME280 bme;
void setup() {
Serial.begin(115200);
if (!oled.begin(SSD1306_SWITCHCAPVCC, 0x3C)) Serial.println(F("OLED missing"));
if (!bme.begin(0x76)) Serial.println(F("BME280 missing"));
oled.setTextColor(SSD1306_WHITE);
}
void loop() {
float t = bme.readTemperature(), p = bme.readPressure() / 100.0, h = bme.readHumidity();
oled.clearDisplay();
oled.setTextSize(1); oled.setCursor(0, 0); oled.print(F("Weather station"));
oled.setTextSize(2); oled.setCursor(0, 16); oled.print(t, 1); oled.print((char)247); oled.print('C');
oled.setTextSize(1); oled.setCursor(0, 40); oled.print(p, 1); oled.print(F(" hPa"));
oled.setCursor(0, 52); oled.print(h, 0); oled.print(F(" % rel. humidity"));
oled.display();
Serial.print(t, 2); Serial.print(F(" C ")); Serial.print(p, 2); Serial.print(F(" hPa ")); Serial.print(h, 1); Serial.println(F(" %"));
delay(500);
}Im Simulator öffnen