LM35, DHT11 or DHT22: Which Temperature Sensor?

Quick answer

  • Choose LM35 if you only need temperature and want to learn analogRead.
  • Choose DHT11 if you want humidity too, at low cost.
  • Choose DHT22 if you're building a project that lists it.

Learning? LM35 for analog, DHT11 for humidity. In any DHT project you can swap the two DHT sensors if you change the type in the code.

Side by side

LM35

Who it's for
Beginners learning analog input
Level
beginnerintermediate
Cost
Low
Main parts
LM35, 3 LEDs, 3 resistors
Wiring
Easy
Code
About 47 lines, no library
It can
Temperature as a smooth voltage, fast readings
It can't
Humidity

DHT11

Who it's for
Beginners building a weather station
Level
intermediateadvanced
Cost
Low
Main parts
DHT11 module and 3 wires
Wiring
Easy
Code
About 25 lines with a DHT library to install
It can
Temperature and humidity on one wire
It can't
Fast readings: the lesson waits 5 seconds between them

DHT22

Who it's for
Project builders
Level
intermediate
Cost
Medium
Main parts
DHT22 (some of these builds let you use a DHT11), other sensors for the project
Wiring
Medium
Code
Same Adafruit library, only the type changes
It can
Temperature and humidity with a wider range than the DHT11
It can't
A lesson of its own here: it's part of bigger projects

Written from the parts lists and code in these tutorials. Cost is a rough guide to the parts they list, compared with each other; line counts are of the main program.

More comparisons