8 years, 2 months ago.

error 2 in frdm k64f for dht 11 sensor

hi,i am using a dht 11 sensor ad frdm k64 f board for temperarture measurement,i used the code in the website and connected pin 1 of dht 11 to vcc,pin 2 to d4,4 to ground and after compiling and running the downloaded file it is showing an error 2 continuosly,can anyone one help me?

Question relating to:

/ DHT
Temp and Humidity sensor device driver. DHT11, DHT22

1 Answer

8 years, 2 months ago.

Have you added the pull-up resistor on pin 2 of the DHT11 module ?

http://embedded-lab.com/blog/measurement-of-temperature-and-relative-humidity-using-dht11-sensor-and-pic-microcontroller/

ftp://imall.iteadstudio.com/Electronic_Brick/IM120710021/DS_IM120710021.pdf

Hi,yes I have added a pull up resistor on pin 2 of dht 11,then it is showing as error 1 after compiling,can you help on error 1 and what does these errors specifies

posted by tholeti chaitanya sudarsan 11 Jan 2016

The posted error codes are derived from the attached .h file from this imported library. Specifically, see here:

typedef enum eError eError; enum eError { ERROR_NONE = 0, BUS_BUSY, ERROR_NOT_PRESENT, ERROR_ACK_TOO_LONG, ERROR_SYNC_TIMEOUT, ERROR_DATA_TIMEOUT, ERROR_CHECKSUM, ERROR_NO_PATIENCE };

so this means that Error Code 1 = BUS_BUSY

While we do not own the DHT11 module, the module is very timing critical to get working properly. Please review the supplied links and other user experiences to see if you can get this module to work. Your target is the M4 processor which is very powerful and should be ample fast enough to support this single wire protocol. I would advise that you experiment with the delays to see if you can tweak the delays to meet the require specification. See the above supplied URLs for more details on how the 1 wire interface works. In the near future, we will source this module as it looks to be very interesting - most likely will buy from offshore and then can review on our logic analyzer. Do you have such a tool ? There are many low cost logic analyzers which will help you to debug this case very quickly. It is important now to review the pin 2 transitions while running your code to see if the module is chatting back with your CPU. As noted, it is very timing critical.

Have you tried another DHT11 library for MBED ? Try for example this one:

https://developer.mbed.org/users/s_inoue_mbed/code/DHT11/

and post your results. According to this library, the Error Code 1 means you are attempting to read from the module too quickly. If this is true, test with a single read or delay a lot between reads to see if this is the issue.

  • 1: Reading the data too often. from the .h file
posted by Sanjiv Bhatia 11 Jan 2016