ESP32 C3 Super Mini - DHT11

This beginner-friendly tutorial shows you how to use the ESP32 C3 Super Mini with a DHT11 temperature and humidity sensor to monitor environmental conditions. You'll learn to wire the DHT11 sensor to your ESP32 C3 Super Mini, program it to read data, and display real-time temperature and humidity readings on the Serial Monitor.

In this tutorial, you'll learn:

ESP32 C3 Super Mini - DHT11

Hardware Preparation

1×ESP32 C3 Super Mini
1×USB Cable Type-A to Type-C (for USB-A PC)
1×USB Cable Type-C to Type-C (for USB-C PC)
1×DHT11 Temperature Humidity Sensor Module
1×10 kΩ Resistor
1×Breadboard
1×Jumper Wires
1×Optionally, DC Power Jack

Or you can buy the following kits:

1×DIYables Sensor Kit (18 sensors/displays)
Disclosure: Some of the links provided in this section are Amazon affiliate links. We may receive a commission for any purchases made through these links at no additional cost to you.
Additionally, some of these links are for products from our own brand, DIYables .

Overview of DHT11 Temperature and Humidity Sensor

The DHT11 is a low-cost digital sensor that measures both temperature and humidity in the environment.

Key specifications:

  • Humidity range: 20% to 80%
  • Humidity accuracy: ±5%
  • Temperature range: 0°C to 50°C
  • Temperature accuracy: ±2°C
  • Reading rate: 1Hz (one reading per second)
  • Operating voltage: 3V to 5V

Why beginners love the DHT11:

  • Very affordable and easy to find
  • Simple digital interface - no complex analog reading needed
  • Works perfectly with ESP32 C3 Super Mini projects
  • Available as both raw sensor and ready-to-use module

DHT11 Pinout

The DHT11 comes in two forms: a raw sensor with 4 pins and a convenient module with 3 pins.

DHT11 sensor module Pinout

DHT11 Raw Sensor (4 pins):

  • GND: Connect to ground (0V)
  • VCC: Connect to power (3.3V or 5V)
  • DATA: Communication pin to send readings to ESP32 C3 Super Mini
  • NC: Not connected (leave unconnected)

DHT11 Module (3 pins):

  • VCC (or +): Connect to power
  • GND (or -): Connect to ground
  • DATA (or OUT): Communication pin to ESP32 C3 Super Mini

Recommendation: Use the DHT11 module version as it has a built-in pull-up resistor, making wiring simpler and more reliable.

Wiring Diagram between DHT11 and ESP32 C3 Super Mini

Follow these wiring diagrams to connect your DHT11 sensor to the ESP32 C3 Super Mini.

  • Note: If using the raw DHT11 sensor, you'll need a 10kΩ pull-up resistor between DATA and VCC pins for reliable communication.

ESP32 C3 Super Mini - DHT11 Sensor Wiring

The wiring diagram between ESP32 C3 Super Mini DHT11 Temperature and humidity Sensor

This image is created using Fritzing. Click to enlarge image

DHT11 Sensor Pin ESP32 C3 Super Mini Pin
GND GND
VCC 3.3V
DATA D4
  • Note: Connect a 10kΩ resistor between DATA and VCC pins.

ESP32 C3 Super Mini - DHT11 Module Wiring

Most DHT11 modules have a built-in pull-up resistor, eliminating the need for external components.

The wiring diagram between ESP32 C3 Super Mini DHT11 Temperature and humidity Module

This image is created using Fritzing. Click to enlarge image

DHT11 Module Pin ESP32 C3 Super Mini Pin
GND (or -) GND
VCC (or +) 3.3V
DATA (or OUT) D4

ESP32 C3 Super Mini Code - DHT11

The following code reads temperature and humidity from the DHT11 sensor and displays the results on the Serial Monitor.

What this code does:

  • Initializes the DHT11 sensor on D4
  • Reads temperature and humidity every 2 seconds
  • Displays humidity as a percentage
  • Shows temperature in both Celsius and Fahrenheit
  • Handles sensor read errors gracefully
/* * This ESP32 C3 Super Mini code was developed by newbiely.com * * This ESP32 C3 Super Mini code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/esp32-c3/esp32-c3-super-mini-dht11 */ #include <DHT.h> #define DHT11_PIN D4 // The ESP32 C3 SuperMini pin D4 connected to DHT11 sensor DHT dht11(DHT11_PIN, DHT11); void setup() { Serial.begin(9600); dht11.begin(); // initialize the DHT11 sensor } void loop() { // read humidity float humi = dht11.readHumidity(); // read temperature in Celsius float temperature_C = dht11.readTemperature(); // read temperature in Fahrenheit float temperature_F = dht11.readTemperature(true); // check whether the reading is successful or not if ( isnan(temperature_C) || isnan(temperature_F) || isnan(humi)) { Serial.println("Failed to read from DHT11 sensor!"); } else { Serial.print("Humidity: "); Serial.print(humi); Serial.print("%"); Serial.print(" | "); Serial.print("Temperature: "); Serial.print(temperature_C); Serial.print("°C ~ "); Serial.print(temperature_F); Serial.println("°F"); } // wait a 2 seconds between readings delay(2000); }

Detailed Instructions

  • New to ESP32 C3 Mini? Complete our Getting Started with ESP32 C3 Mini tutorial first to set up your development environment.
  • Set up your Arduino IDE: If this is your first time with ESP32 C3 Super Mini, follow the environment setup tutorial for Arduino IDE.
  • Wire the components: Follow the wiring diagram above to connect DHT11 to ESP32 C3 Super Mini.
  • Connect the board: Plug your ESP32 C3 Super Mini into your computer using a USB Type-C cable.
  • Open Arduino IDE: Launch the Arduino IDE on your computer.
  • Select your board: Choose ESP32 C3 Super Mini and select the correct COM port.
  • Open Library Manager: Click the Library Manager icon on the left sidebar.
  • Search for DHT library: Type "DHT" in the search box and find the DHT sensor library by Adafruit.
  • Install the library: Click the Install button.
ESP32 C3 Super Mini DHT sensor library
  • Install dependencies: When prompted, click Install All to install required dependencies.
ESP32 C3 Super Mini Adafruit Unified sensor library
  • Copy the code: Copy the code provided above and paste it into Arduino IDE.
  • Upload the code: Click the Upload button to compile and upload to your ESP32 C3 Super Mini.
  • Test the sensor: Try changing the temperature by placing the sensor near something warm (like a coffee cup) or cool.
  • Open Serial Monitor: View your readings in the Serial Monitor at 9600 baud rate.
  • Pro Tip: Wait at least 2 seconds after powering up before taking your first reading for accurate results.

Serial Monitor Output

Open the Serial Monitor and you'll see temperature and humidity readings updating every 2 seconds:

Newbiely | Arduino IDE 2.3.8
──
File
Edit
Sketch
Tools
Help
ESP32C3 Dev Module
Newbiely.ino
···
8 Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'ESP32C3 Dev Module' on 'COM15')
New Line
9600 baud
Humidity: 42.00% | Temperature: 22.00°C ~ 71.60°F Humidity: 43.00% | Temperature: 22.00°C ~ 71.60°F Humidity: 43.00% | Temperature: 23.00°C ~ 73.40°F Humidity: 44.00% | Temperature: 23.00°C ~ 73.40°F Humidity: 44.00% | Temperature: 24.00°C ~ 75.20°F Humidity: 45.00% | Temperature: 24.00°C ~ 75.20°F Humidity: 46.00% | Temperature: 25.00°C ~ 77.00°F Humidity: 46.00% | Temperature: 25.00°C ~ 77.00°F
Ln 11, Col 1
ESP32C3 Dev Module on COM15
2

Application and Project Ideas

Now that you can read temperature and humidity with your ESP32 C3 Super Mini and DHT11, try these project ideas:

  • Smart home climate monitor: Track indoor temperature and humidity levels throughout the day
  • Greenhouse automation: Monitor and log environmental conditions for plants
  • Weather station: Build a basic weather monitoring system with data logging
  • Comfort level indicator: Create LED alerts when humidity or temperature goes outside comfortable ranges
  • Data logger: Record temperature and humidity to SD card or cloud service
  • Terrarium controller: Monitor and maintain optimal conditions for reptiles or plants

Video Tutorial

Watch the video below for a visual walkthrough of this project.

Challenge Yourself

Ready to take your ESP32 C3 Super Mini DHT11 project further? Try these challenges:

  • Easy: Add an LED that turns on when temperature exceeds 25°C
  • Easy: Display "Comfortable" or "Uncomfortable" based on humidity levels (comfortable range: 30-60%)
  • Medium: Add a push button to switch between Celsius and Fahrenheit display
  • Medium: Store the last 10 readings and display minimum and maximum values
  • Advanced: Send temperature and humidity data to a web server or IoT platform like ThingSpeak
  • Advanced: Create a heat index calculator that combines temperature and humidity for "feels like" temperature

※ OUR MESSAGES

  • As freelancers, We are AVAILABLE for HIRE. See how to outsource your project to us
  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!