7 years, 7 months ago.

mDot with DHT22 temperature/humidity sensor?

Hi, I'm having trouble getting the DHT22 temperature/humidity sensor to work with the mDot. I've proven that the circuit and library for the DHT sensor works on a ST Nucleo board and I'm able to get temperature and humidity readings. I have a pull up resistor on the DHT sensor data line.

But on the mDot, I get zero for humidity and (oddly) 32 for temperature on the F scale. I get those same values if I remove the sensor's data wire from the mDot.

I'm using this library: https://developer.mbed.org/users/Wimpie/code/DHT/

In the code below, I'm able to see the sanity check value correctly, but the temperature and humidity comes back as 32 and 0, respectively.

include the mbed library with this snippet

#include "DHT.h"

DHT mydht22(PC_1,DHT22); // DHT22 on Pin 16.  I've also tried PA_7, pin 11.

int main()
{
        float test = 60.3;  //sanity check
        float mytemp = mydht22.ReadTemperature(FARENHEIT);  //value=32 all the time
        float myhum= mydht22.ReadHumidity(); //value=0 all the time
}

Question relating to:

The MultiConnect® mDot™ offers significantly longer range and improved radio performance compared to traditional wireless solutions—resulting in greater transmission range and reduced capital expense.

typo in the comment. PC_1 is pin 15, not 16. It was wired correctly, just commented incorrectly.

posted by Eric Tsai 20 Sep 2016
Be the first to answer this question.