Jump to content
  • 0

communication with DHT11


chipkit_ar

Question

Hello: some days I'm trying to communicate with sensor DHT11 ago. inside loop () it includes these statements

 pinMode(DHT11PIN, OUTPUT);
 digitalWrite(DHT11PIN, LOW);
 delay(20);
 digitalWrite(DHT11PIN, HIGH);
 delayMicroseconds(40);
 pinMode(DHT11PIN, INPUT);

what they do:
chipKIT sends a level of 0 [V] 20 [us] and then 3V3 by 40 [us] to request communication. Then put the entry into high impedance state awaiting a response, the sensor should respond with 0 [V] by 80 [us] and other 3v3  with 80 [us] and then 40 bit data. With the oscilloscope I see chipKIT sends the request, but when this pin communication gets as input to await the response of the sensor, the output is high indefinidadmente state. Why does this happen. Will the pic32 of chipKIT is with pull-up resistors and not let the sensor put the pin on 0 [V]. Do I have to put a resitencia pull_down ?.
Any advice or suggestion will be well received
regards:)
Daniel

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Hi Daniel,

I personally haven't worked with the DHT11, but I would definitely recommend checking out this Arduino library that is available on GitHub. Looking at their code, it looks like they first set the pin to a high state for 250 milliseconds before bringing the pin low for 20 millseconds and then high again for 40 microseconds (like you do in your code snippet).

Adafruit (who also sells this component) recommends having a pull-up resistor attached to the data line on the humdity sensor (as per this page). 

Let me know if you have any more questions.

Thanks,
JColvin

Link to comment
Share on other sites

The problem was I had tried to feed the sensor from the same port I/O pins as outputs setting
pinMode (VCCPIN, OUTPUT);
pinMode (GNDPIN, OUTPUT);
and writing HIGH (source) and LOW (sink) respectively. If I take directly from chipKIT GND, pin Sensor Data begins to successfully send 40 bits of it.
To replace the resistance of 4k7 did the following
pinMode (pin, INPUT_PULLUP);
Thanks for your interest and rapid response
regards
Daniel

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...