DHT22/Why the DHT22/01. DHT11 or DHT22
Why the DHT22 · 01 of 9

DHT11 or DHT22

The DHT22 reads −40 to 80 °C to ±0.5 °C and 0 to 100 % humidity to ±2 %, in tenths. The DHT11 stops at 0 °C and is worth ±2 °C and ±5 %. Same board, same three wires, same library: what the white cage buys is range and precision, and it only matters once something acts on the number.

Where the two ranges end

Move the marker to the coldest the sensor will ever see, then say what the number is for.

Which board for this job
-5 °C · plot it
Coldest it will ever see-5 °C
What you will do with the number
DHT11
out of range
DHT22
fine
Use the
DHT22
Use the DHT22. Below 0 °C the DHT11 is outside its range entirely. It does not read low and warn you; it either returns nothing or returns a number that is simply wrong, so an outdoor logger built on one goes blind on the night you most wanted the data.

The range is the hard limit. Aosong gives the DHT11 0 to 50 °C and says nothing about what it does below that, so a DHT11 in a freezer or a winter garden is outside its specification with no way for your sketch to know. The DHT22 goes down to −40 °C, and it has a sign bit to say so: tenths and the sign bit is how the minus arrives.

The accuracy is the soft limit. It costs nothing on a display you glance at and a great deal on a graph, where ±2 °C is wider than most of the change you wanted to see.

The numbers

Every row is from the two datasheets, the DHT22's in its §3 and §7.

DHT22 · TK39DHT11 · TK38
Temperature−40 to 80 °C0 to 50 °C
Temperature accuracy±0.5 °C±2 °C
Steps0.1 °C, 0.1 %1 °C, 1 %
Humidity0 to 100 % RH20 to 80 % RH
Humidity accuracy±2 % typical, ±5 % max±5 %
Supply3.3 to 6 V3 to 5.5 V
One reading everymore than 2 s1 s
Cagewhiteblue

Two of those rows carry a catch.

The DHT22's ±2 % is its typical humidity accuracy. The same line of the datasheet gives ±5 % as the maximum, and adds a repeatability of ±1 % and a drift of up to ±0.5 % a year. So two DHT22s agree better with themselves over a week than with each other on day one.

The supply starts at 3.3 V, not the DHT11's 3 V. A 3V3 pin is the bottom of the DHT22's range, which is fine and leaves nothing spare; the first reading wires it there anyway, because the data line has to idle at your board's logic voltage.

The rule

Look at the number: either. A display in the hallway, a first sketch, a demonstration. The kit has three of each, and a DHT11 is the one to make mistakes on.

Plot it, or let it switch something: DHT22. A log you will compare with last week, a fan, a heater, a dehumidifier. With ±2 °C the graph shows the sensor rather than the room.

Below 0 °C, or in air near saturation: DHT22. The DHT11 is not specified below 0 °C, and its own board prints 20 to 80 % RH.

What does not change

The board, the wiring, the library and the protocol. The TK39 and the TK38 are the same circuit with a different sensor on it, so everything the DHT11 book explains about the four pins, the start pulse and the forty bits is true here too, and this book does not repeat it. One word in the sketch differs, DHT22 for DHT11, and getting it wrong does not fail: the wrong type shows what it prints instead.

When it does not work

Two DHT22s in the same room disagree by half a degree

That is inside the datasheet's ±0.5 °C for each of them, so they may legitimately be a whole degree apart. Put them side by side, away from anything warm, for half an hour before deciding either is faulty.

Is ±2 % humidity a promise?

It is the typical figure. The same line of the datasheet's specification gives a maximum of ±5 % RH, which is what the DHT11 manages typically. Plan around ±2 % for comparing readings from one sensor over time, and around ±5 % for trusting one reading absolutely.

Can a DHT22 go outdoors in winter?

Its range goes down to −40 °C, so the cold is fine. The datasheet's warnings are about water and light: avoid using it where dew forms on it, and keep it out of long exposure to strong light and ultraviolet. A vented, shaded box that rain cannot reach is the usual answer.

The box says AM2302 on the cage. Is that a different sensor?

No. Aosong's datasheet is titled DHT22 and says AM2302 is another name for it. The cages in the DHT sensor kit are printed AM2302 DHT22, and the library type is DHT22 either way.

Where this goes next

The TK39 part by part: the sensor lying flat, the pull-up under it, and the holes you wire and the ones you do not.

What is on the board →

Edit this page — content/books/dht22/dht11-or-dht22.mdx

Community

Questions about this product

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

This page covers several products. Choose yours to see the right 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 →