
Interactive circuit guide
Run the simulation, follow the build steps one by one and try it in our real app.
Stopped
Step-by-step build
What it does
The DHT11 sends temperature and relative humidity over a single digital line. It has three legs: power, data and ground. The data leg goes to a digital pin on the Arduino, and on request the sensor produces a 40 bit frame containing humidity, temperature and a check byte. A library validates the byte and returns the values in degrees and percent. Requests must not be too close together because the sensor needs a few seconds to take a new measurement. This circuit teaches digital sensor reading and data integrity checking.
Parts you need
Use the following parts to build this circuit:
- Arduino Uno × 1 — Reads the sensor data and sends it to the serial port.
- DHT11 sensor × 1 — Measures temperature and relative humidity.
- 5 V supply connection × 1 — Powers the sensor leg.
- Ground connection × 1 — Common reference for the sensor and the board.
Build it step by step
- Place the Arduino Uno on your work area.The GND pin is index 0 in the simulator pin list.
- Connect the DHT11 power leg to 5 V.Pin 0 of the sensor is power, pin 1 is data and pin 2 is ground.
- Connect the data leg to Arduino pin 2.The data line uses a single pin and needs no extra resistor.
- Connect the sensor ground and the Arduino GND to a shared ground.Both wires can meet at the same ground pin.
- Add the library, upload the sketch and open the serial monitor.Wait a few seconds between readings.
How it works
The DHT11 encodes its measurement on one line using timing. The board first pulls the line to the supply level and then waits for the sensor to answer. The incoming 40 bit frame carries relative humidity in its first part, temperature in its second part and a check byte at the end. The check byte lets the software detect whether the data was corrupted during transfer. The library decodes the raw bits and converts them into usable units. A second request before the sensor has completed its measuring cycle can return stale or wrong data, so a wait between readings is required.
What you learn
- Read data from a digital sensor.
- Check data integrity with a check byte.
- Respect the sensor reading interval.
Tips
- Holding the sensor close to a warm surface will affect the reading.
- If no data appears in the serial monitor, check the data pin and the shared ground.
Try it yourself
- Build a weather monitor by reading temperature and humidity at regular intervals.
- Observe the pair of values shown in the serial monitor.
Expected result: Temperature and relative humidity values appear at regular intervals in the serial monitor.
Get the parts
If you want to build this project for real, you can get the parts from hobidevre.com.
Frequently asked questions
What is this circuit for?
The DHT11 sends temperature and relative humidity over a single digital line. It has three legs: power, data and ground. The data leg goes to a digital pin on the Arduino, and on request the sensor produces a 40 bit frame containing humidity, temperature and a check byte. A library validates the byte and returns the values in degrees and percent. Requests must not be too close together because the sensor needs a few seconds to take a new measurement. This circuit teaches digital sensor reading and data integrity checking.
How does it work?
The DHT11 encodes its measurement on one line using timing. The board first pulls the line to the supply level and then waits for the sensor to answer. The incoming 40 bit frame carries relative humidity in its first part, temperature in its second part and a check byte at the end. The check byte lets the software detect whether the data was corrupted during transfer. The library decodes the raw bits and converts them into usable units. A second request before the sensor has completed its measuring cycle can return stale or wrong data, so a wait between readings is required.
What should I see at the end?
Temperature and relative humidity values appear at regular intervals in the serial monitor.