ESP32 C3 Super Mini - DHT11 - OLED
This tutorial shows you how to use the ESP32 C3 Super Mini to read the temperature and humidity from a DHT11 module and display them on an OLED. You will build a small room monitor that works without a computer once the code is uploaded.
In this tutorial, you'll learn:
- How to wire a DHT11 module and an OLED to the ESP32 C3 Super Mini
- How to install the SSD1306 and DHT libraries in Arduino IDE
- How to read temperature and humidity with the ESP32 C3 Super Mini
- How to show both values in the center of the OLED
- How to check the same readings on the Serial Monitor

Hardware Preparation
Or you can buy the following kits:
| 1 | × | DIYables Sensor Kit (18 sensors/displays) |
Additionally, some of these links are for products from our own brand, DIYables .
Overview of OLED Display and DHT11 Temperature Humidity Sensor
A DHT11 is a digital sensor that measures temperature and humidity, and an OLED is a small screen that shows the result.
Key Features:
- Two readings in one: The DHT11 gives both temperature and humidity
- One data wire: The DHT11 needs only one GPIO pin
- Easy to read: The OLED shows clear, high-contrast text
- Simple wiring: The OLED uses only two I2C signal wires
Technical Specifications:
- DHT11 voltage: 3V to 5V
- DHT11 temperature range: 0°C to 50°C (±2°C)
- DHT11 humidity range: 20% to 80% (±5%)
- DHT11 reading rate: One reading per second at most
- OLED driver: SSD1306
- OLED size: 128x64 or 128x32 pixels
- OLED I2C address: 0x3C (used in the code below)
We have specific tutorials about each part. They cover the hardware pinout, how it works and how to program it:
- ESP32 C3 Super Mini - OLED 128x64 tutorial
- ESP32 C3 Super Mini - OLED 128x32 tutorial
- ESP32 C3 Super Mini - DHT11 tutorial
DHT11 Module Pinout
The DHT11 module has three pins:
- VCC: Connect to 3.3V
- GND: Connect to ground (0V)
- DATA: Sends the temperature and humidity readings to the board
OLED Pinout
The I2C OLED module has four pins:
- VCC: Power for the display
- GND: Connect to ground (0V)
- SCL: I2C clock line
- SDA: I2C data line
Wiring Diagram
Connect the DHT11 module and the OLED to the ESP32 C3 Super Mini as shown below.
- Note: The built-in LED also uses GPIO8, so it may flicker while the OLED updates. This is normal.
- Note: Check every wire before you power the board.

This image is created using Fritzing. Click to enlarge image
DHT11 module connections:
| DHT11 Module Pin | ESP32 C3 Super Mini Pin |
|---|---|
| VCC | 3.3V |
| GND | GND |
| DATA | GPIO4 |
OLED connections:
| OLED Pin | ESP32 C3 Super Mini Pin |
|---|---|
| VCC | 3.3V |
| GND | GND |
| SDA | GPIO8 |
| SCL | GPIO9 |
ESP32 C3 Super Mini Code - DHT11 Sensor - OLED
The code below reads the DHT11 module again and again and shows the temperature and humidity on the OLED.
What This Code Does:
- Starts the OLED: Uses the default I2C pins of the board: GPIO8 (SDA) and GPIO9 (SCL)
- Starts the sensor: Uses the DHT11 data wire on GPIO4
- Reads the values: Gets the humidity and the temperature in Celsius
- Handles errors: Shows "Failed" on the OLED if a reading does not work
- Shows the result: Prints the values on the OLED and the Serial Monitor
※ NOTE THAT:
The above code automatically horizontal and vertical center aligns the text on OLED display.
※ NOTE THAT:
The code is set for the 128x64 OLED. If you use the 128x32 OLED, change SCREEN_HEIGHT to 32 and change setTextSize(3) to setTextSize(1), so both lines fit on the screen.
Detailed Instructions
Follow these bullets to run the project on your ESP32 C3 Super Mini.
- New to ESP32 C3 Super Mini? Complete our Getting Started with ESP32 C3 Super Mini tutorial first to set up your development environment.
- Wire the parts: Connect the DHT11 module and the OLED as shown in the wiring diagram above.
- Connect the board: Connect the ESP32 C3 Super Mini to your computer with a USB Type-C cable.
- Open Arduino IDE: Start Arduino IDE on your computer.
- Select the board: Make sure ESP32 C3 Super Mini is selected in Tools > Board.
- Select the port: Choose the COM port of your board.
- Open Libraries: Click the Libraries icon on the left bar of the Arduino IDE.
- Find the OLED library: Search “SSD1306”, then find the SSD1306 library by Adafruit.
- Install it: Click the Install button to install the library.

- Add the extras: You will be asked to install some other library dependencies. Click the Install All button to install them.

- Find the sensor library: Search “DHT”, then find the DHT sensor library by Adafruit.
- Install it: Click the Install button to install the library.

- Add the extras: You will be asked to install some other library dependencies. Click the Install All button to install them.

- Copy the code: Copy the above code and open it with Arduino IDE.
- Upload the code: Click the Upload button to upload the code to your ESP32 C3 Super Mini.

- Test the sensor: Hold the sensor in your hand, or put it near a warm or cold object. Do not put it in water.
- Read the OLED: See the result on the OLED.
- Open Serial Monitor: Click the Serial Monitor icon and set the baud rate to 115200 to see the same result.

- Pro Tip: If the OLED shows "Failed", the board cannot read the sensor. Check the DATA wire on GPIO4.
Serial Monitor Output
The code has no delay in its loop, so lines appear quickly. The sensor value changes only about every 2 seconds, so you will see the same line many times.
Application and Project Ideas
This ESP32 C3 Super Mini DHT11 and OLED project is a good base for many small builds.
- Room monitor: Show the room temperature and humidity on your desk.
- Bedroom comfort check: See if the air is too dry or too humid while you sleep.
- Plant corner display: Show the air conditions near your plants.
- Closet or storage monitor: Watch for high humidity that can damage clothes or tools.
- Incubator display: Keep an eye on the values inside a small box.
Challenge Yourself
Ready for more? Try these ESP32 C3 Super Mini challenges.
- Easy: Show the temperature in Fahrenheit instead of Celsius.
- Easy: Add a small "Temp" and "Humi" label in front of each value.
- Medium: Keep the lowest and highest temperature and show them on the OLED.
- Medium: Add a buzzer that beeps when the humidity gets too high.
- Advanced: Draw a small graph of the last readings on the OLED.