Smart Home · ESP32 DevKit
Desk Weather Station
A ESP32 DevKit build with 3 components. Reads: DHT22. Drives: OLED, LED.
3 parts · 9 connections · 8 steps
Wiring
Parts
| Part | Refs | Qty | Est. |
|---|---|---|---|
| DHT22 temperature & humidity sensor | DHT22 | 1 | $4.50 |
| SSD1306 OLED display (128×64, I²C) | OLED | 1 | $3.20 |
| LED (5 mm) + 220 Ω resistor | LED | 1 | $0.15 |
| Plus: breadboard, jumper wires, USB cable | ≈ $7.85 | ||
Prices are rough hobby-market estimates. Click a part for wiring notes and specs.
Firmware
1// Weather Station2// Generated by Wirecraft for the ESP32 DevKit (ESP32-WROOM-32)3// Prompt: A weather station that shows temperature and humidity on an OLED display4//5// Wiring, parts and step-by-step assembly live alongside this file.67#include <Arduino.h>8#include <DHT.h>9#include <Wire.h>10#include <Adafruit_GFX.h>11#include <Adafruit_SSD1306.h>1213#define DHT22_PIN 414#define LED_PIN 51516DHT dHT22((uint8_t)DHT22_PIN, DHT22);17float dHT22TempC = 0, dHT22Humidity = 0;18Adafruit_SSD1306 oLED(128, 64, &Wire, -1);1920void setup() {21 Serial.begin(115200);22 dHT22.begin();23 if (!oLED.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { Serial.println(F("OLED not found")); }24 oLED.clearDisplay();25 oLED.setTextColor(SSD1306_WHITE);26 oLED.setTextSize(1);27 pinMode(LED_PIN, OUTPUT);28 Serial.println(F("Weather Station ready."));29}3031void loop() {32 // --- Read sensors ---33 dHT22TempC = dHT22.readTemperature();34 dHT22Humidity = dHT22.readHumidity();3536 // Refresh the display with live readings37 oLED.clearDisplay();38 oLED.setCursor(0, 0);39 oLED.setCursor(0, 0);40 oLED.print("DHT22: "); oLED.println(dHT22TempC);41 oLED.display();4243 delay(2000);44}451; PlatformIO project for Weather Station2[env:esp32dev]3platform = espressif324board = esp32dev5framework = arduino6monitor_speed = 1152007lib_deps =8 adafruit/DHT sensor library@^1.4.69 adafruit/Adafruit Unified Sensor@^1.1.1410 adafruit/Adafruit SSD1306@^2.5.1011 adafruit/Adafruit GFX Library@^1.11.912Assembly
- 1
Lay out your workbench
Gather the ESP32 DevKit, a half-size breadboard, and a bundle of male-to-male jumper wires. Keep the parts list open — every component below gets its own spot on the breadboard. Don't plug in USB power until the last wire is placed.
- 2
Seat the board and power rails
Run a red jumper from the ESP32 DevKit's 3V3 (or VIN for 5 V parts) pin to the breadboard's + rail, and a black jumper from GND to the − rail. Every component's power and ground will tap these rails.
- 3
Wire the DHT22
Place the DHT22 temperature & humidity sensor on the breadboard. Power first: VCC → + rail, GND → − rail. Then signals: DATA → GPIO4. Tip: Give it 2 seconds between reads — the DHT22 is slow but steady.
- 4
Wire the OLED
Place the SSD1306 OLED display (128×64, I²C) on the breadboard. Power first: VCC → + rail, GND → − rail. Then signals: SDA → GPIO21, SCL → GPIO22. Tip: If nothing shows up, try I²C address 0x3D — some modules ship with it.
- 5
Wire the LED
Place the LED (5 mm) + 220 Ω resistor on the breadboard. Power first: CATHODE → − rail. Then signals: ANODE → GPIO5. Tip: The longer leg is the anode (+). The resistor can go on either leg.
- 6
Double-check before power
Trace every wire against the diagram once more — 9 connections in total. The classic mistakes: swapped power and ground, and off-by-one rows on the breadboard. Thirty seconds of checking saves a component.
- 7
Flash the firmware
Open the exported folder in VS Code with the PlatformIO extension (free), plug in the ESP32 DevKit over USB, and hit Upload. PlatformIO fetches the libraries listed in platformio.ini automatically. Prefer the Arduino IDE? Copy src/main.cpp into a new sketch and install the same libraries from the Library Manager.
- 8
Bring it to life
Open the Serial Monitor at 115200 baud — you should see "Weather Station ready." Then start customizing the loop; the sketch is organized so every component's code is easy to find.