DHT11/What it is/01. Two numbers, one pin
What it is · 01 of 9

Two numbers, one pin

Under the blue grille are a humidity element, a temperature element and a small microcontroller that reads both. That last part is why one ordinary digital pin is enough, and why the numbers arrive already calibrated and already rounded to whole degrees and whole per cent.

The board in your hand

The TK38 at an angle: a black board with a gold border and a blue DHT11 sensor lying flat across its top half, its grille of square vents facing up. Below it are DHT11 in a gold box, a small resistor at the left, two round mounting holes, a row of four holes labelled GND, VCC, NC and DATA, and a black right-angle header whose four pins point out past the bottom edge. SINGLE WIRE runs up the right edge and lonely binary up the left.
The TK38. The sensor lies flat, grille up, so the header can point off the edge.

The blue part is the DHT11, made by Aosong. Its leads are bent through 90° and soldered in a column at the right, so it lies flat with its vents facing up. Air gets in through the vents; the two things measuring it stay inside.

What is behind the grille

Inside the cage
DHT11 · steps of 1 °C
The room is actually23.4 °C
The room
23.4 °C
The sketch prints
23.0 °C
Range
0 to 50 °C
Give or take
±2 °C
You are not reading a sensor, you are asking a chip. The measuring and the calibration happen inside the cage, so one digital pin is enough and there is nothing to convert. The chip also decides the step: the DHT11 reports whole degrees and whole per cent, so the room can move most of a degree while the sketch prints 23 °C throughout. And that 23 is only good to ±2 °C: anywhere from 21 to 25 °C.

Aosong's datasheet names three parts. The humidity element is a film whose electrical resistance drops as it takes up water from the air. The temperature element is an NTC thermistor, a resistor whose resistance drops as it warms. The third part is an 8-bit microcontroller that reads both.

Neither element gives a number on its own. Each would need a reference, an amplifier and a calibration table before it meant anything. The microcontroller does all of that inside the cage, applies the calibration stored at the factory, and sends the result as forty bits down one wire.

What that buys you, and what it costs

No analog wiring, no reference voltage, no resistor to calculate and nothing to calibrate. Three wires, one of which carries the answer.

It also fixes the precision. The DHT11 reports whole degrees and whole per cent, and the datasheet gives ±2 °C and ±5 % RH over its range. A reading of 23 °C means somewhere from 21 to 25. Nothing you send it changes that.

DHT11 on the TK38
Temperature0 to 50 °C, ±2 °C, in steps of 1 °C
Humidity20 to 80 % RH, ±5 %, in steps of 1 %
A new readingat most once a second

The humidity range narrows as it warms: 30 to 90 % at 0 °C, 20 to 90 % at 25 °C, 20 to 80 % at 50 °C. The back of the board prints the safe figure, 0-50°C AND 20-80% RH.

What "humidity" means here

The DHT11 reports relative humidity: how close the air is to holding as much water as it can at its current temperature. The limit moves with temperature, so the same air can read 40 % in a warm room and 80 % once it has cooled, without any water arriving or leaving. That is also why a sensor reading two degrees warm reads a few per cent dry.

When the range or the step is not enough, below freezing or for tenths of a degree, the TK39 carries a DHT22 on the same header: DHT11 or DHT22.

When it does not work

Can I read it with an analog pin instead?

No, and there is nothing analog to read. Both elements are wired to the sensor's own microcontroller, not to the header. What comes out of DATA is a digital pattern, so analogRead on it returns whatever the line happened to be sitting at.

Do I need to calibrate it?

No. Each DHT11 is calibrated at the factory and the sensor applies the result before it sends anything. You cannot adjust it from outside. A sensor that reads consistently high is usually sitting next to something warm, which is a placement problem rather than a calibration one.

Why does the temperature only move in whole degrees?

The DHT11's resolution is 1 °C and 1 % RH, so a room warming slowly shows nothing and then jumps a degree. It is not a fault and there is no setting for it. The DHT22 on the TK39 reports tenths.

Is a humidity percentage the same as how much water is in the air?

No. Relative humidity is how full the air is compared with how much it could hold at its current temperature, so the same air reads differently as it warms and cools. The DHT11 reports the relative figure.

Where this goes next

GND, VCC, NC and DATA, and the one that is connected to nothing.

The four pins

Edit this page — content/books/dht11/two-numbers-one-pin.mdx

Community

Questions about this product

See what other owners have asked, and read their solutions.

Ask a question ↗

DHT11 Temperature and Humidity Sensor

Loading discussions…

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Modules and blocks on the forum