Long was the rein of the DHT11 temperature and humidity sensor as a main component in ESPHome and other DIY projects. But is it time we started considering newer and potentially better sensors? How does the cheap DHT11 hold up against the more modern competition? Read on to find out which digital temperature and humidity sensor you should be using in your future ESPHome projects.
The DHT11 has many issues
The DHT11 is a very basic and ultra-low-cost temperature and humidity sensor. It uses a capacitive humidity sensor and a thermal resistor (thermistor) to measure the temperature and a very basic chip converts the analog signal in to a digital one. A thermistor’s resistance changes ever so slightly with temperature. However, that change is miniscule and difficult to measure.
The thermistor leads to inaccuracy
You will find the DHT11 used in a myriad of online guides. But the DHT11 has some serious issues. First and foremost is its accuracy due to the use of a thermistor. For the temperature, it can be up to ±2 °C out. It doesn’t read like much but being in a flat that is 18 °C and one that is 20 °C is a big difference.
Additionally, the DHT11 only has a resolution of 1 °C (meaning it can only tell the temperature in whole numbers and not fractions). The DHT11 doesn’t do much better when sensing the relative humidity, where it can be up to ±5％ off the actual relative humidity.
The DHT11 is unreliable
The next major issue is reliability. It is not recommended that you place the DHT11 sensor in a humid environment. This makes them pretty useless for use in bathrooms or in the room you have your clothes drying rack, which are of course the rooms where you will most likely want to keep an eye on the relative humidity.
- DHT11 digital temperature and humidity sensor is a digital signal output with a calibrated temperature and humidity combined sensor.
- It uses a dedicated digital modules and acquisition of temperature and humidity sensor technology to ensure that products with high reliability and excellent long term stability.
The DHT11 might be cheap, but if you have to frequently replace it, a slightly more expensive but more reliable option will turn out to be cheaper eventually.
Verdict: Don’t use the DHT11 for anything other than tests
The answer to whether you should be using the DHT11 in your future ESPHome projects is a definite no. It isn’t accurate or reliable and should only be used for testing purposes. I say that because they are still cheaper than most of the competition. If you’re building a project that might kill your sensor you might want to use the cheapest one available for testing purposes. After all, the low cost is still an advantage in certain situations.
What about the DHT22?
The DHT22 is the DHT11’s successor. It generally costs slightly more than the DHT11 but can definitely still be considered a low-cost option. It is more accurate than the DHT11, coming in with a temperature accuracy of ±0.5 °C and relative humidity accuracy of ±2-5%. Additionally, the DHT22 has a higher resolution than the DHT11 at 0.1% for the relative humidity and 0.1 °C for the temperature, making it much more useful for ESPHome projects.
- The sensor can be operated with both 3.3V and 5V, it is suitable for connection to all standard boards such as Arduino, RN-Control, Raspberry Pi and all other microcontrollers.
- This sensor can build thermometer electric circuit microcontroller, it can be used for robotics development kit, suit for engineer to make projects.
The DHT22 does appear to be a good alternative to the DHT11 on paper, but it still uses a thermistor to measure the temperature, which, as explained earlier, are difficult to measure. Once we compare the DHT22 to other available sensors, specifically the BME280, you will see why I don’t recommend it either.
A quick search online, using your search engine of choice, will bring up many reports of DHT22 sensors breaking after only being used for a short period of time. It appears that it too suffers from poor reliability, just like its predecessor, the DHT11, does.
BME280: The gold standard
The BME280 is an incredibly accurate temperature and humidity sensor. As an added bonus, you get a third sensor measuring pressure in the same package. That sensor could be used to predict thunderstorms if that tickles your fancy. The BME280 is extremely fast to react to changes and has a temperature resolution of 0.01° C, a relative humidity resolution of 0.008%, and a pressure resolution of 0.18Pa.
At a glance
Sensors: Temperatures, humidity, atmospheric pressure
You’ll find a BME280 board priced roughly the same as the DHT22. Considering that, you have absolutely no reason to use a DHT22 over this sensor. With the BME280, you get a more reliable, more accurate, and more feature-rich sensor compared to the DHT11 and DHT22.
One thing you want to consider when using the BME280 in ESPHome projects is self-heating. This occurs when the sensor is frequently being used to measure the temperature and humidity. As with any electronic device, the BME280 sensor isn’t perfectly efficient and does produce a bit of heat as a byproduct. Because of the high accuracy, the temperature sensor can pick up those changes caused by the board itself. Make sure you don’t read the values too often to avoid this issue. If you keep it above 30 seconds you should be fine.
BME680: One step further
If you want to take your projects one step further you have the option of going with the almighty BME680. What makes this sensor so special? Besides measuring temperature, humidity, and atmospheric pressure it can also measure gas resistance.
- The BME680 Environmental Sensor is a four-in-one MEMS environmental sensor that measures VOC (Volatile Organic Compounds), temperature, humidity, and air pressure and is ideal for monitoring air quality.
Gas resistance might not sound noteworthy until you find out what you can do with it. Using a rather complex formula you can calculate the Indoor Air Quality (IAQ) of the room the sensor is located in. Just keep in mind, that the BME680 doesn’t measure the concentration of particulates in the air. To get PM 2.5 and PM 10.0 readings you will need a laser dust detection sensor such as the SDS011.
Alternatives to the BME280
Were the BME280 to be sold out in your local hardware store, you might want to consider the following options. This selection includes further digital sensors with a relatively high accuracy.
Sensirion STS3X and SHTCX
Sensirion has a reputation for making very reliable and accurate sensors. The only reason these weren’t considered as the best replacement for the DHT11 and DHT22 is the fact that they aren’t used as much, and thus you will find fewer examples of projects using them online. You will also find these sensors available at fewer stores. The Sensirion STS3X line of sensor will only measure the temperature, so I’d definitely recommend the Sensirion SHTC3 (the newest sensor in the SHTC line) over them.
- Humidity measurement range: 0~100%RH
- Temperature measurement range: -40~125°C
HDC1080 temperature and humidity sensor
The HDC1080 is another accurate I2C digital humidity sensor. The humidity output has a typical accuracy of ±4% and the temperature output has a typical accuracy of ±0.2 °C. As with the Sensirion sensors, the HDC1080 might be hard to come by though for a different reason. Adafruit, the popular manufacturer of breakout boards, isn’t making them any more.
- The main chip of this item is GY-213V-HTU21D The HTU21D is a low-cost, easy to use, highly accurate, digital humidity and temperature sensor.
MCP9808 temperature sensor
Another cheap and accurate alternative to the BME280 is the MCP9808 temperature and humidity sensor. The MCP9808 has an impressive accuracy of ±0.25 °C and resolution of 0.0625 °C, and as with the other recommendations in this article, is an I2C digital temperature sensor. As the title suggests, the MCP9808 sensor can only measure the temperature and not the humidity.