DHT22 reading randomly dropping 10-15°F

I have a simple DHT22 circuit with a 4x20 LCD display showing the values. Most of the time it reads temperature and humidity values that are as expected and confirmed with other measurement tools. Every minute or so the temperature reading will drop 10-15°F for a cycle or two then return to the correct temperature.

I've spent some time searching and have not found anyone having this same issue. The default unmodified "DHTtester" sketch that comes with the library does this anomaly. I have the 10K pull-up resistor across the output pin and Vcc and have also tried it without it. I've tried various read delays from 2000ms to 4000ms and the problem still occurs. I have 3 different sensors and have tried them all and all do the same thing. With the LCD backlight on voltage is 4.89 and w/o it is exactly 5.0V. The temp jump will occur at both input voltages. When the temp jumps the voltage does not change.

The only change to the "DHTtester" sketch I did is change the input pin to #7.

Any ideas or suggestions?



Which library? Please provide a link to the particular code you are using, we cannot always guess which library
even by name as many people write libraries and put them online.

Here is the code for the DHTtester sketch. I try this code directly and it does it. Also, I didn't mention that I'm running the sensor at 5V as well.

Thanks for the input.

// Example testing sketch for various DHT humidity/temperature sensors
// Written by ladyada, public domain

#include "DHT.h"

#define DHTPIN 7     // what pin we're connected to

// Uncomment whatever type you're using!
//#define DHTTYPE DHT11   // DHT 11
#define DHTTYPE DHT22   // DHT 22  (AM2302)
//#define DHTTYPE DHT21   // DHT 21 (AM2301)

// Connect pin 1 (on the left) of the sensor to +5V
// NOTE: If using a board with 3.3V logic like an Arduino Due connect pin 1
// to 3.3V instead of 5V!
// Connect pin 2 of the sensor to whatever your DHTPIN is
// Connect pin 4 (on the right) of the sensor to GROUND
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor

// Initialize DHT sensor.
// Note that older versions of this library took an optional third parameter to
// tweak the timings for faster processors.  This parameter is no longer needed
// as the current DHT reading algorithm adjusts itself to work on faster procs.

void setup() {
  Serial.println("DHTxx test!");


void loop() {
  // Wait a few seconds between measurements.
  // delay(2000);

  // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  float h = dht.readHumidity();
  // Read temperature as Celsius (the default)
  float t = dht.readTemperature();
  // Read temperature as Fahrenheit (isFahrenheit = true)
  float f = dht.readTemperature(true);

  // Check if any reads failed and exit early (to try again).
  /*if (isnan(h) || isnan(t) || isnan(f)) {
    Serial.println("Failed to read from DHT sensor!");

  // Compute heat index in Fahrenheit (the default)
  float hif = dht.computeHeatIndex(f, h);
  // Compute heat index in Celsius (isFahreheit = false)
  float hic = dht.computeHeatIndex(t, h, false);

  Serial.print("Humidity: ");
  Serial.print(" %   ");
  Serial.print("Temperature: ");
  Serial.print(" *C ");
  Serial.print(" *F   ");
  Serial.print("Heat index: ");
  Serial.print(" *C ");
  Serial.println(" *F");
  Serial.write(27);       // ESC command
  //Serial.print("[2J");    // clear screen command
  Serial.print("[H");     // cursor to home command

Try 4K7 resistor.
Also a 0.1uF cap across Vcc and gnd.

How long are the wires from the DHT22 to the UNO?

Tom.... :slight_smile:

You might also remove the calculations and just print a hex value
of the data to look for any signature of the failure, such as
dropping bits or such.
After you've munged it into floating point all such information is
essentially lost.

Thanks guys for the tips. I'll try the different resistor and add the cap to see if that helps. If not I'll take look at the raw data and see if I can see any anomalies.

The circuit is just on a breadboard at the moment so wires are only a couple inches long. I did try a longer wire, about 10', for the sensor for a while, same problem occurred. My original intent for this setup was to monitor the condition of the air coming out of my home A/C vent. Worked ok except for the odd 10-15° drop now and then.


The 0.1uF cap and/or the 4.7K resistor did not make any difference. Haven't had a chance to look at the raw data yet.


Update to this issue. I did some research and found I was using an older DHTxx library. I downloaded the latest library I could find and re-downloaded the same program. It has now been running for about 3 hours and it is stable for both humidity and temperature. The random temperature drop has stopped at least for now. I will keep an eye on it for a few more days and make sure it's resolved. I will report back if the issue returns.

Currently using the "DHT sensor library" by Adafruit, version 1.2.3 which looks like it's fixed the instability problem.

By the way, it's working now w/o the pull up resistor in place on the DHT22 output. I read that this sensor has a pull up resistor built in.

Thanks for all the input.


Glad you got this working. Just wanted to let you know that I have also seen issues with several DHT sensors. Your problem seems to be with the library but mine with the device itself.

The sensors I was looking at were part of a science lab project at local high school. Some of the sensors
were purchased from Mouser Electronics and others from eBay and Amazon. What I found was that the
sensors purchased from Mouser were very accurate but the sensors from eBay were not stable. Some worked great with temperature but off by several percent when reading humidity. They would also drift up and down with time. Main issue is with humidity readings.

The eBay sensors seem to work better on 3.3 volts. Keep lead length as short as possible. 5V is only needed if the sensor is located several feet from the I/O pins.

If the sensor is off but seems to be stable, you could adjust the reading by adding or subtracting a value in you sketch. I recommend to all students to calibrate their projects using this method.

Another code issue my be with frequency of you read. Reads should be no more than one per second. On the DHT11, that would be one reading every two seconds.

The SHT31-D breakout from Adafruit is quite stable and communicates by I2C.

I have also used the DHT22 in the past but have abandoned that device.

Any chance you have experience with the Bosch BME280? Also from Adafruit. An upcoming lab has requirement for pressure readings. Cost is around $20 so would like to be sure it works before suggesting it.

We do have the SHT31 in our cabinet but no student has used it to date. There are so many to choose from.
Nice thing about Adafruit is they almost always have a library available and instructions. I recommend each lab group write their own library but nice to have a starting point.

No experience with the BME280.

I like to use Adafruit breakouts because of simplified interfacing, libraries, and working examples. The students could use the libraries and add new functions to make the sensor more versatile.

I've been using the SHT31 to monitor temp and humidity at various places on the property and radio the data to another Arduino via Adafruit RFM69HCW(915MHz) breakouts. The data is displayed on the serial monitor in CSV format. From there, it's copied and pasted into SciDAVis for plotting and evaluation.