DHT22 sensor data pin reading low

Hi Team Nordic,

According to the AM2302 (DHT22) datasheet, the data pin will be pulled to high state in idle state. But in my case, when i am reading the data pin before even sending any signal to the sensor, i am reading 0 on the data pin. I am using p0.07 (pin 9 ) as data pin. VCC -> 5V, GND -> GND.

Am i not reading the pin correctly or is it a communication protocol error that i have to figure out?

Please find attached the image with output. 

Thanks, 

Parents Reply Children
  • Hi,

    I have no experience with the DHT22, but I see your code is similar to this example. Your code is missing some of the comments, but referring to the code I linked to it seems that what this is what is supposed to happen:

    1. Configure pin as output.
    2. Pull pin down for some time (I have not read the DHT22 datasheet, but I assume this should tell it to send data).
    3. Configure pin as input
    4. Loop for reading each input bit
      1. Read pin continuously to detect a transition (change in state)
      2. Ignore first 3 transitions (I guess this is for synchronization as there is no clock, but I have not checked 1-wire spec)
      3. shift received bit into correct position in RX buffer
    5. Check that the correct number of bits is received, and that the checksum is correct

    Have you verified the timing of your implementation? Is duration of your waits sensible? I suggest you add a bit of logging along the way printing the data you read so that you can see what happens and that it matches what you would expect. You could also verify that the incoming signal is correct by using a logic analyzer that support the 1-Wire protocol (for instance Saleae Logic Pro).