Argon reading zeros from dht22/ dht11

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.

I hadn’t tried 5v until a day ago and and still had issues before that

I have a boron and a couple xenons sitting around I should try it on those

Personally, I use @rickkas7’s DHT22Gen3_RK library *(also available on the Web IDE) which has given me zero problems.

1 Like

I will give that a go see if I can make it work

As mentioned, I have been running the PietteTech_DHT library just fine (<10% error rate), so it’s most likely not the library and trying another lib without knowing why an otherwise working lib doesn’t work seems like trying every tablet you got in your medicine cupboard without first knowing what’s causing the ailment :wink:

1 Like

Well Im new to this so you’ll have to be patient with me im trying to learn :upside_down_face:
But it didnt work anyway the main issue with the PietteTech_DHT library im having is i cant get it to even initate a read it will just upload the code and the events reads success the sensor is cycling a reading every 2 seconds according to my meter but it doesn’t show up in the events

Then it would be best to take things in small steps.
This is what my code would show.

Take this project, hit the COPY THIS APP button and flash it to your device.
Then unplug the device, plug your DHT22 sensor directly next to the Argon aligning the sensor pins with D2 (-) D3 (out) D4 (+)
When you then power up the device again and connect it to your computer via USB and watch the Serial output via particle serial monitor --follow you should see valid readings.

When you just click the link you will get a Web IDE project ready to use.

Desktop IDE (aka Particle Dev) is being discontinued and should be replaced with Particle Workbench (VS Code).

Sorry for all the time in-between responses, but has been a busy spring around here
anyway I got the sensor working using ADAFRUIT_DHT_PARTICLE that showed return reading of 0 temp and 0 humidity but it did read the sensor i tested it with a multi-meter.
Since im a noob at coding i then started replacing code and used code from ADAFRUIT_DHT library and that fixed it. Now im wondering if someone could explain to me why that fixed it.
Below is the code that fixed the problem. thanks


```DHT dht(DHTPIN, DHTTYPE);
int loopCount;

void setup() {
	Serial.begin(9600); 
	Serial.println("DHTxx test!");
	Particle.publish("state", "DHTxx test start");


	dht.begin();
	loopCount = 0;
	delay(3000);
	
}

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

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.