This project builds a real-time temperature and humidity monitor using an ESP32 microcontroller, a DHT22 sensor, and a small OLED display. The DHT22 reads environmental conditions every 2.5 seconds and displays the current temperature in Celsius and relative humidity percentage on the 128x64 pixel screen.
The guide includes a complete wiring diagram showing how to connect the OLED display and DHT22 sensor to the ESP32, a full parts list with component specifications, ready-to-use Arduino firmware, and step-by-step assembly instructions. Builders will have a functional environmental sensor display suitable for monitoring indoor conditions, weather stations, or climate-controlled spaces.
Wiring diagram

Gather all the parts
Assemble it in 4 steps
1. Préparer le montage hors tension
Débranchez l'USB. Utilisez une ESP32-C6-DevKitC-1, un écran OLED SSD1306 I2C 128 × 64 de 0,96 pouce, un DHT22 et une résistance de 10 kΩ.
2. Brancher le petit écran
VCC → 3V3 (alimentation), GND → GND (masse), SDA → GPIO23 (données), SCL → GPIO22 (horloge). Fiez-vous aux inscriptions des broches, pas à leur position.
- Inverser VCC et GND peut détruire l'écran. Ne pas alimenter ce montage en 5 V sur les signaux.
3. Brancher le capteur
VCC → 3V3, GND → GND et DATA → GPIO10. Reliez la résistance de 10 kΩ entre DATA et 3V3 : elle maintient le signal au repos. Laissez toute broche non connectée du capteur libre.
- Placez le capteur à distance de la carte pour éviter de mesurer sa chaleur. Respectez les repères VCC, DATA et GND de votre capteur.
4. Vérifier avant alimentation
Contrôlez chaque fil et l'absence de court-circuit entre 3V3 et GND. Le montage sera alimenté par le câble USB de la carte.
Review all connections
1. Connections between "oled" and "ESP32"
2. Connections between "sensor" and "ESP32"
3. Connections between "pullup" and "ESP32"
Deploy the firmware
#include <Arduino.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <DHT.h>
Adafruit_SSD1306 screen(128, 64, &Wire, -1);
DHT sensor(10, DHT22);
bool screenReady = false;
String previous;
uint32_t lastRead = 0;
void show(const String &text) {
if (!screenReady || text == previous) return;
previous = text;
screen.clearDisplay();
screen.setTextColor(SSD1306_WHITE);
screen.setTextSize(1);
screen.setCursor(0, 0);
screen.println("TEMPERATURE / HUMIDITE");
screen.setCursor(0, 22);
screen.setTextSize(2);
screen.print(text);
screen.display();
}
void setup() {
Serial.begin(115200);
Wire.begin(23, 22);
screenReady = screen.begin(SSD1306_SWITCHCAPVCC, 0x3C, true, false);
if (!screenReady) Serial.println("Ecran introuvable");
sensor.begin();
show("Patientez");
lastRead = millis();
}
void loop() {
if (millis() - lastRead < 2500) return;
lastRead = millis();
float humidity = sensor.readHumidity();
float temperature = sensor.readTemperature();
if (isnan(humidity) || isnan(temperature)) {
show("Erreur\ncapteur");
Serial.println("Verifier le capteur et son cablage");
return;
}
String text = String(temperature, 1) + " C\n" + String(humidity, 1) + " %";
show(text);
Serial.println(text);
}Remix this project
Make it yours in one click
Open a full copy of this project in your own Schematik workspace, diagram, code, parts, and assembly steps included. Swap the sensor, add features, or redesign the whole thing with AI. The author's original stays untouched.




