ESP32 C3 Super Mini - DHT11 - LCD
This tutorial shows you how to use the ESP32 C3 Super Mini to read temperature and humidity from a DHT11 sensor and show them on an LCD I2C. It is a simple project that turns your board into a small room climate display, with no computer needed to read the result.
In this tutorial, you'll learn:
- How to connect a DHT11 sensor and an LCD I2C to the ESP32 C3 Super Mini
- How to read temperature and humidity from the DHT11
- How to show both values on the LCD
- How to show a message on the LCD when a reading fails
- How to upload and test the project step by step

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 .
Buy Note: Most LCD I2C displays available on the market are 5V displays. They may work with this board, but it is unsafe and can damage the board. We strongly recommend using the 3.3V LCD I2C display recommended above.
Overview of DHT11 and LCD
The DHT11 is a digital sensor that measures temperature and humidity, and the LCD I2C is a display that shows text using only two data wires.
Key Features:
- DHT11: Measures temperature and humidity with one data wire
- LCD I2C: Shows 2 rows of text with 16 characters in each row
- Few wires: The project uses only 3 signal wires in total
Technical Specifications:
- DHT11 power: 3.3V on this board
- DHT11 data: One digital pin
- LCD I2C size: 16 columns and 2 rows
- LCD I2C power: 5V
- LCD I2C address: Usually 0x27, but it can be different from each manufacturer
We have a full tutorial for each part, with the hardware pinout, how it works, wiring and code:
Pinout
The DHT11 module has 3 pins and the LCD I2C has 4 pins.
DHT11 module:
- VCC (or +): Connect to 3.3V power
- GND (or -): Connect to ground (0V)
- DATA (or OUT): Sends the temperature and humidity readings to the board
LCD I2C:
- VCC: Connect to 5V power
- GND: Connect to ground (0V)
- SDA: I2C data signal
- SCL: I2C clock signal
Wiring Diagram
Connect both parts to the ESP32 C3 Super Mini as shown below.
- Note: Unplug the USB cable before you change any wire.
- Note: The DHT11 uses 3.3V, the LCD uses 5V, and both share the same GND.

This image is created using Fritzing. Click to enlarge image
You can also build this circuit without a breadboard. Here is the same wiring:

This image is created using Fritzing. Click to enlarge image
| DHT11 Module Pin | ESP32 C3 Super Mini Pin |
|---|---|
| VCC (or +) | 3.3V |
| GND (or -) | GND |
| DATA (or OUT) | GPIO4 |
| LCD I2C Pin | ESP32 C3 Super Mini Pin |
|---|---|
| VCC | 5V |
| GND | GND |
| SDA | GPIO8 |
| SCL | GPIO9 |
ESP32 C3 Super Mini Code - DHT11 Sensor - LCD I2C
The code below reads the DHT11 sensor and shows the temperature and humidity on the LCD.
What This Code Does:
- Uses I2C: The LCD uses the default I2C pins of the board: GPIO8 (SDA) and GPIO9 (SCL)
- Starts the parts: Starts the DHT11 on GPIO4 and turns on the LCD backlight
- Reads the sensor: Reads the humidity and the temperature in Celsius
- Shows the result: Prints the temperature on row 1 and the humidity on row 2
- Handles errors: Prints "Failed" on the LCD if a reading fails, then waits 2 seconds before the next reading
※ NOTE THAT:
The LCD I2C address can be different from each manufacturer. In the code, we used address of 0x27 that is specified by DIYables manufacturer
Detailed Instructions
Follow these bullets to run the project.
- 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 parts as shown in the wiring diagram.
- Connect your board: Plug the ESP32 C3 Super Mini into your computer with a USB Type-C cable.
- Open the IDE: Launch the Arduino IDE on your computer.
- Select your board: Make sure ESP32 C3 Super Mini is selected in Tools > Board.
- Select your port: Choose the matching COM port.
- Open the Library Manager: Click the Libraries icon on the left bar of the Arduino IDE.
- Search for the DHT library: Type “DHT” in the search box, then look for the DHT sensor library by Adafruit.
- Install the library: Click the Install button.

- Install the dependencies: When a window asks about dependencies, click the Install All button.

- Search for the LCD library: Type “DIYables LCD I2C” in the search box, then look for the DIYables_LCD_I2C library by DIYables.
- Install the LCD library: Click the Install button.

- Copy the code: Copy the code above and paste it into the Arduino IDE.
- Upload the code: Click the Upload button to compile and upload the code to your ESP32 C3 Super Mini.
- Test it: Make the sensor colder or hotter. For example, put the sensor near a hot cup of coffee.
- See the result: Watch the temperature and humidity change on the LCD.
- Pro Tip: If the LCD backlight is on but you see no text, turn the small contrast screw on the back of the LCD.
If LCD displays nothing, see Troubleshooting on LCD I2C
Application and Project Ideas
You can use this ESP32 C3 Super Mini DHT11 LCD project as the base for many useful builds.
- Room climate display: Show the temperature and humidity of a room on your desk
- Greenhouse monitor: Check the air around your plants at a glance
- Storage room check: Watch the humidity where you keep tools or books
- Bathroom humidity display: See how fast the air dries after a hot shower
- Pet home monitor: Keep an eye on the air in a pet's home
Challenge Yourself
Ready to do more with your ESP32 C3 Super Mini and DHT11 sensor? Try these challenges.
- Easy: Show the temperature in Fahrenheit instead of Celsius
- Easy: Change the "Failed" message to a longer one that fits on the LCD
- Medium: Show "Too hot!" on the LCD when the temperature goes above a limit you choose
- Medium: Add a button that switches the LCD between Celsius and Fahrenheit
- Advanced: Show the lowest and highest temperature since the board started
- Advanced: Add a relay that turns on a fan when the room is too hot