Argon reading zeros from dht22/ dht11

Hello i am new to coding so i need a little help with getting an argon to show the correct values for the dht22
I have tried most every fix that i came across in the community to no avail, some libraries will only show zeros and some libraries will not show any value at all. I have tried a dht11 also with the same results

Hi,

I remember having this trouble some time ago.

I documented what I did on this hackster project.

Few things I would check, copy-pasted below from the project.

The connections are as follows:
DHT22 pin 1 is Vcc <==> 3v3 on the Argon (ok, boron in your case)
DHT pin2 is data <==> D5 on the Argon (you use what ever pin you chose here I guess?)
DHT pin 3 <==> leave disconnected
DHT pin 4 <==> connect to GND on the Argon

DO NOT FORGET to add a 4.7K - 10K resistor pullup on the data pin to Vcc.

Note: I am using the rather old PietteTech library for it, since I had issues with the latest library.

This is how I wired the things at the time:

Oh wait! I have code you can use with Particle Workbench (VS Code), the library is included in the source files since I wanted to avoid any trouble.
The code is here:

Again all that is documented here.

Let me know if that helps! The DHT sensor can be tricky sometimes…
Gustavo.

1 Like

Im getting errors when i compile your code
forgot to mention i use these sensors from amazonhttps://www.amazon.com/Digital-Temperature-Humidity-Arduino-Replace/dp/B07XBVR532/ref=sr_1_5?dchild=1&keywords=dht22&qid=1587703629&sr=8-5

Would be good to know which errors :wink:

here is a screen shot

These appear to be only IntelliSense errors not really build errors.

So im still getting the same issue, im at the point all three of them are DOA out of the box, I am wondering if someone could look at the sensors i bough of amazon [https://www.amazon.com/Digital-Temperature-Humidity-Arduino-Replace/dp/B07XBVR532/ref=sr_1_5? and tell me if they should work and tell me know how i can test them to see if they are dead or not?
thanks in advance

hi,
maybe you can upload pictures of your connections and boards, and explain how they are connected and maybe we can spot something in them?

thanks

!

Here is my setup

I can’t see the resistor we spoke about in post 2, is it there?

There is a resistor on that pcb that the sensor is soldered to

1 Like

Ive already tried that with the same results,
below are the readings that are being returned
{“Hum()”: 0.00, “Temp(°C)”: 0.00, “DP(°C)”: nan, “HI(°C)”: -8.78}

And i can’t get the PIETTETECH_DHT library to give me any readings.

what’s the firmware level on your Particle device? thanks

Device OS:
1.5.0

what im also noticing on the library that i have gotten to read zeros, the ADAFRUIT_DHT_PARTICLE library i have to reduce the delay to 500ms to give me the zero reading

I’m using this sligtly adapted DHT_Simple sample from the library and for me that works as expected
Directly plug the sensor next to D2 (GND), D3 (Data), D4 (Vcc) to the Argon and see

#include "PietteTech_DHT.h" 

const int DHTTYPE = DHT22;       // Sensor type DHT11/21/22/AM2301/AM2302
const int DHT_VCC = D4;
const int DHT_PIN = D3;          // Digital pin for communications
const int DHT_GND = D2;

PietteTech_DHT DHT(DHT_PIN, DHTTYPE);
int n;      // counter

void setup()
{
  pinMode(DHT_GND, OUTPUT);
  pinMode(DHT_VCC, OUTPUT);
  digitalWrite(DHT_GND, LOW);
  digitalWrite(DHT_VCC, HIGH);
  
  Serial.begin(9600);
  Serial.println("DHT Simple program using DHT.acquireAndWait");
  Serial.print("LIB version: ");
  Serial.println(DHTLIB_VERSION);
  Serial.println("---------------");
  
  DHT.begin();
  
  delay(1000);
}

void loop()
{
  Serial.print("\n");
  Serial.print(n);
  Serial.print(": Retrieving information from sensor: ");
  Serial.print("Read sensor: ");

  int result = DHT.acquireAndWait(1000); // wait up to 1 sec (default indefinitely)

  switch (result) {
  case DHTLIB_OK:
    Serial.println("OK");
    break;
  case DHTLIB_ERROR_CHECKSUM:
    Serial.println("Error\n\r\tChecksum error");
    break;
  case DHTLIB_ERROR_ISR_TIMEOUT:
    Serial.println("Error\n\r\tISR time out error");
    break;
  case DHTLIB_ERROR_RESPONSE_TIMEOUT:
    Serial.println("Error\n\r\tResponse time out error");
    break;
  case DHTLIB_ERROR_DATA_TIMEOUT:
    Serial.println("Error\n\r\tData time out error");
    break;
  case DHTLIB_ERROR_ACQUIRING:
    Serial.println("Error\n\r\tAcquiring");
    break;
  case DHTLIB_ERROR_DELTA:
    Serial.println("Error\n\r\tDelta time to small");
    break;
  case DHTLIB_ERROR_NOTSTARTED:
    Serial.println("Error\n\r\tNot started");
    break;
  default:
    Serial.println("Unknown error");
    break;
  }
  Serial.print("Humidity (%): ");
  Serial.println(DHT.getHumidity(), 2);

  Serial.print("Temperature (oC): ");
  Serial.println(DHT.getCelsius(), 2);

  Serial.print("Temperature (oF): ");
  Serial.println(DHT.getFahrenheit(), 2);

  Serial.print("Temperature (K): ");
  Serial.println(DHT.getKelvin(), 2);

  Serial.print("Dew Point (oC): ");
  Serial.println(DHT.getDewPoint());

  Serial.print("Dew Point Slow (oC): ");
  Serial.println(DHT.getDewPointSlow());

  n++;
  delay(2500);
}

There are occasional errors, but most readings are fine.

it still doesn’t work it doesn’t give me a reading at all. did you look at the sensor im trying to use maybe that is causing the issue

I don’t understand what could be going on when i do a voltage test on Vcc pin and digital pin it will show
1.060 vdc then after 2 seconds it will jump to 1.260vdc for a 250 milliseconds which tells me its reading the sensor and that is when i have it connected to 5v., but i have to either comment out the delay to get any reading (its reading zero) or set delay at 750ms or below to get a zero reading.

When you had 5V going to any of the GPIOs of the Argon that’s probably - at least contributing to - your issue.
None of the GPIOs on Gen3 devices are 5V tolerant.

That’s why my code is using two GPIOs to actually power the sensor - this way you can be sure the voltage will not exceed the max. ratings for the input pins.