The Beetle ESP32C6 is a pocketsized powerhouse, bringing WiFi 6, BLE, Thread, ZigBee, and Matter support into a tiny form factor. In this project, I combined it with a DHT11 sensor and a 0.9inch I²C OLED display to create a compact environmental monitor.
The goal was simple:
- Read temperature and humidity from the DHT11.
- Display values centered on the OLED (important because my custom 3Dprinted case has wide borders).
- Provide debugstyle serial output for easy troubleshooting.
- Beetle ESP32C6 (DFRobot) – ultra compact ESP32 C6 board with WiFi 6, BLE, Thread, ZigBee, Matter.
- DHT11 sensor – basic temperature and humidity sensor, connected to GPIO2.
- 0.9" OLED SSD1306 display – I²C interface, address 0x3C, resolution 128×64.
- USBC cable – for programming and serial debugging.
- Jump wires – for connecting the sensor and display.
- Role: The core microcontroller board.
- Why chosen: Ultra‑compact size, WiFi 6 support, Matter/Thread compatibility, and low power consumption.
- Usage: Handles sensor data acquisition, OLED display updates, and can be extended for IoT/cloud logging.
- Role: Measures ambient temperature and humidity.
- Why chosen: Simple, inexpensive, and widely supported.
- Usage: Provides real‑time environmental readings. Note: accuracy is limited compared to DHT22 or ENS160, but sufficient for basic monitoring.
- Role: Visual output for sensor readings.
- Why chosen: Compact, low‑power, and easy to integrate via I²C.
- Usage: Displays temperature and humidity values with centered text for readability inside the enclosure.
💡 Tip for readers: You can swap the DHT11 with more advanced sensors like DFRobot ENS160 (multi‑gas air quality) or MICS‑4514 (CO/NO₂ detection) to expand functionality. The Beetle ESP32‑C6 has enough capability to handle multiple sensors simultaneously.Wiring:
- DHT11 → VCC, GND, GPIO2
- OLED → VCC, GND, SDA, SCL
The sketch initializes the DHT11 and OLED, then continuously reads sensor data. Each cycle:
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include "DHT.h"
// --- OLED setup ---
#define SCREEN_WIDTH 128 // 0.9" OLED width
#define SCREEN_HEIGHT 64 // 0.9" OLED height
#define OLED_RESET -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
// --- DHT setup ---
#define DHTPIN 17 // GPIO for DHT11 data pin
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(115200);
Serial.println("=== Beetle ESP32-C6 Debug Start ===");
// Initialize DHT
dht.begin();
Serial.println("✅ DHT11 initialized on pin " + String(DHTPIN));
// Initialize OLED
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println("❌ OLED not found at 0x3C");
for (;;);
}
display.clearDisplay();
display.setTextColor(SSD1306_WHITE);
Serial.println("✅ OLED initialized at 0x3C");
}
void loop() {
// Read DHT11
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(h) || isnan(t)) {
Serial.println("⚠️ Failed to read from DHT11 sensor");
return;
}
// Debug output
Serial.print("[DEBUG] Temp: ");
Serial.print(t);
Serial.print(" °C | Humidity: ");
Serial.print(h);
Serial.println(" %");
// --- OLED display ---
display.clearDisplay();
display.setTextSize(2); // larger text for readability
// Temperature line
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);
// Humidity line
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 2s
}Prints debug messages to the Serial Monitor.
Clears the OLED and prints centered text for temperature and humidity.
To give the project a professional finish, I housed the Beetle ESP32 C6, DHT11, and OLED inside a JUSTWAY 3Dprinted enclosure.
- Precision engineering: Exact tolerances for small boards like the Beetle ESP32 C6.
- Durability: Strong materials withstand repeated handling.
- Aesthetic appeal: Clean lines and modern finish.
- Customization: Options for tailored cutouts and branding.
- Print the enclosure using PLA or PETG for durability.
- Insert the Beetle ESP32C6 into the base slot.
- Mount the OLED flush with the front cutout — centered text ensures readability even with wide borders.
- Place the DHT11 sensor through the side vent for airflow.
- Secure with screws or snapfit depending on your enclosure design.
- Close the lid and connect via USB C.
The enclosure not only protects the electronics but also makes the project look like a polished product ready for showcase.
ConclusionThis project demonstrates how the Beetle ESP32C6 can be paired with simple sensors and displays to create compact IoT devices. The centered text ensures readability inside a 3Dprinted case with wide borders, while the debug logs make troubleshooting straightforward.
Next steps could include:
- Adding WiFi logging to a cloud dashboard.
- Expanding with more sensors (UV, pressure, light).
- Integrating Matter/Thread for smart home automation.











Comments