Project Overview
ESP32-C6 Temperature Logger with DHT11 + OLED: A pocket-sized environmental monitor built on the new ESP32-C6 — WiFi 6, BLE, Thread, Zigbee, and Matter in one tiny chip — showing live temperature and humidity on a crisp OLED, with a 3D-printed case for a finished look.
- Time: ~1 hour
- Skill level: Beginner–Intermediate
- What you will build: A compact temp/humidity display with centered OLED readouts, serial debug output, and a clear path to Matter/Thread smart-home integration.
Parts List
From ShillehTek
- ESP32-C6-N4 Pre-Soldered Development Board (or the ultra-compact Seeed XIAO ESP32-C6 for the smallest possible build)
- DHT11 Temperature & Humidity Sensor (with Cables)
- SSD1306 0.96" I2C White OLED Display
- 400-Point Breadboard
- Dupont Jumper Wires
External
- USB-C cable for programming and serial debugging
- Optional: a 3D-printed enclosure for a finished desk gadget
Note: The ESP32-C6 speaks WiFi 6, BLE 5, Thread, Zigbee, and Matter — this little logger can graduate into a full smart-home sensor without changing boards. Want tighter accuracy? Swap the DHT11 for a DHT22 or an ENS160 air-quality sensor; the C6 easily handles several sensors at once.
Step-by-Step Guide
Step 1 — Wire the Sensor and Display
Goal: Three connections for the DHT11, four for the OLED.
What to do: DHT11: VCC→3.3V, GND→GND, DATA→GPIO2. OLED: VCC→3.3V, GND→GND, SDA and SCL to your board's I2C pins. The SSD1306 sits at I2C address 0x3C with a 128x64 resolution — both go straight into the code in Step 2.
Expected result: Sensor and display wired on 3.3V.
Step 2 — Upload the Code
Goal: Read the DHT11 and print centered values on the OLED.
What to do: Install Adafruit GFX, Adafruit SSD1306, and the DHT sensor library, select your ESP32-C6 board in the IDE, and upload:
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include "DHT.h"
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
#define DHTPIN 2 // DHT11 data pin (match your wiring)
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(115200);
dht.begin();
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.setTextSize(2);
display.setTextColor(SSD1306_WHITE);
}
void loop() {
float t = dht.readTemperature();
float h = dht.readHumidity();
Serial.printf("T: %.1f C H: %.0f %%\n", t, h);
display.clearDisplay();
// center each line using its measured pixel width
String tempStr = "T:" + String(t, 1) + "C";
int16_t x1, y1; uint16_t w, hgt;
display.getTextBounds(tempStr, 0, 0, &x1, &y1, &w, &hgt);
display.setCursor((SCREEN_WIDTH - w) / 2, 15);
display.print(tempStr);
String humStr = "H:" + String(h, 0) + "%";
display.getTextBounds(humStr, 0, 0, &x1, &y1, &w, &hgt);
display.setCursor((SCREEN_WIDTH - w) / 2, 40);
display.print(humStr);
display.display();
delay(2000); // update every 2 s
}
Expected result: Temperature and humidity refresh every two seconds, perfectly centered, with debug lines in the Serial Monitor.
Step 3 — Why Centered Text Matters
Goal: Make the readout look intentional, not accidental.
What to do: The original build houses the display behind a case cutout with wide borders — left-aligned text looks off-center through the window. getTextBounds() returns the exact pixel width of any string, so the sketch computes (SCREEN_WIDTH − w) / 2 fresh for every reading, keeping "T:23.4C" and "T:9.8C" equally centered as values change width.
Expected result: A readout that stays balanced no matter the value.
Step 4 — Box It Up
Goal: Turn the breadboard into a desk gadget.
What to do: A small 3D-printed enclosure with a display cutout turns the project into something that lives on a shelf. Precise tolerances matter for boards this small — measure your board and OLED before modeling, or start from the enclosure files in the original guide and adapt the cutouts.
Expected result: A self-contained temperature logger that looks store-bought.
Step 5 — Where to Take It
Goal: Use the C6's radios.
What to do: The same board can push readings to a cloud dashboard over WiFi 6, advertise them over BLE, or join a Matter/Thread network as a proper smart-home sensor. Add deep sleep between readings and it runs for a long time on a small battery.
Expected result: A clear upgrade path from desk gadget to connected sensor.
Conclusion
This project is a perfect introduction to the ESP32-C6: real sensor data, a polished centered OLED UI, serial debugging habits, and a case-ready form factor — with WiFi 6, Thread, Zigbee, and Matter waiting in the same chip when you're ready for more.
Want the exact parts used in this build? Grab them from ShillehTek.com. If you want help customizing this project, check out our IoT consulting services.
Credits
All photos and images in this tutorial are credited to Pradeep on Hackster.io. The original guide by Pradeep served as the reference for this ShillehTek version. We thank him for his excellent work in the maker community.


