DHT11 Temperature and Humidity Sensor


Dave Slotter, W3DJS
 

I am wanting to get a Pi to read current time temperature and humidity for an APRS weather station. This should be simple to hook up, no?

I already searched this group, and came up with no hits on "DHT11". I am wondering if anyone on this list has experience with hooking up a DHT11 Temperature and Humidity Sensor to a Pi? I bought a batch from Amazon, and apparently they're a bad batch or I'm not hooking them up right to the Pi... Although there are only three pins to hook up... Power, Ground and Data.

I followed the tutorial on https://www.circuitbasics.com/how-to-set-up-the-dht11-humidity-sensor-on-the-raspberry-pi/ and quickly found out that my DHT11 have different pinout ordering than the tutorial. Once hooked up, the attached LED glowed once I powered up the Pi, so things looked pretty good, until I attempted to read the sensor data, and then it came up totally empty. (I double and triple-checked that I was connected to the correct pins.) Maybe I got a bad batch of sensors? (These were the three pin variety, not four pin.)

If anyone has any "reputable" vendors to buy from, please advise. It looks like the "wild west" on Amazon with retailers selling these for wildly different price points. Also, any advice on using DHT11 to read temperature and humidity is welcome. Like I said, this is for an APRS weather station.

73,

--
- Dave
  W3DJS


Timothy Mollman
 

Is your I2C turn on?  It's under the pi config program.   


On Mon, Feb 8, 2021, 15:02 Dave Slotter, W3DJS <slotter@...> wrote:
I am wanting to get a Pi to read current time temperature and humidity for an APRS weather station. This should be simple to hook up, no?

I already searched this group, and came up with no hits on "DHT11". I am wondering if anyone on this list has experience with hooking up a DHT11 Temperature and Humidity Sensor to a Pi? I bought a batch from Amazon, and apparently they're a bad batch or I'm not hooking them up right to the Pi... Although there are only three pins to hook up... Power, Ground and Data.

I followed the tutorial on https://www.circuitbasics.com/how-to-set-up-the-dht11-humidity-sensor-on-the-raspberry-pi/ and quickly found out that my DHT11 have different pinout ordering than the tutorial. Once hooked up, the attached LED glowed once I powered up the Pi, so things looked pretty good, until I attempted to read the sensor data, and then it came up totally empty. (I double and triple-checked that I was connected to the correct pins.) Maybe I got a bad batch of sensors? (These were the three pin variety, not four pin.)

If anyone has any "reputable" vendors to buy from, please advise. It looks like the "wild west" on Amazon with retailers selling these for wildly different price points. Also, any advice on using DHT11 to read temperature and humidity is welcome. Like I said, this is for an APRS weather station.

73,

--
- Dave
  W3DJS


Dana KN4BEV
 

Hi Dave,

Adafruit has some pretty good tutorials about the DHT sensors at this link https://learn.adafruit.com/dht. I seem to remember that the 3pin variety are identical to the 4pin. The 4pin model has one pin marked as "no contact". If you'd like more than just temperature, take a look at bme280 or bme680 chips. https://www.adafruit.com/product/2652.

You may already know about direwolf weather reporting features. Direwolf can read text files in special formats and map them to data points in APRS messages.


On Mon, Feb 8, 2021 at 6:02 PM Dave Slotter, W3DJS <slotter@...> wrote:
I am wanting to get a Pi to read current time temperature and humidity for an APRS weather station. This should be simple to hook up, no?

I already searched this group, and came up with no hits on "DHT11". I am wondering if anyone on this list has experience with hooking up a DHT11 Temperature and Humidity Sensor to a Pi? I bought a batch from Amazon, and apparently they're a bad batch or I'm not hooking them up right to the Pi... Although there are only three pins to hook up... Power, Ground and Data.

I followed the tutorial on https://www.circuitbasics.com/how-to-set-up-the-dht11-humidity-sensor-on-the-raspberry-pi/ and quickly found out that my DHT11 have different pinout ordering than the tutorial. Once hooked up, the attached LED glowed once I powered up the Pi, so things looked pretty good, until I attempted to read the sensor data, and then it came up totally empty. (I double and triple-checked that I was connected to the correct pins.) Maybe I got a bad batch of sensors? (These were the three pin variety, not four pin.)

If anyone has any "reputable" vendors to buy from, please advise. It looks like the "wild west" on Amazon with retailers selling these for wildly different price points. Also, any advice on using DHT11 to read temperature and humidity is welcome. Like I said, this is for an APRS weather station.

73,

--
- Dave
  W3DJS



--


Dave Slotter, W3DJS
 

I'm not using an I2C pin. I'm using pin 7 which is GPIO: https://pinout.xyz/pinout/i2c

And this wasn't mentioned in any of the tutorials?


On Mon, Feb 8, 2021 at 06:13 PM, Timothy Mollman wrote:
Is your I2C turn on?  It's under the pi config program.   

 
--
- Dave
  W3DJS


Dave Slotter, W3DJS
 

Hi Dana,

Thanks for your response. I took a look at the dht tutorial on Adafruit.com and saw this mention:

  • The second pin is data. Connect a 10K pullup resistor from this pin to 3.3V. If you are using a DHT11 it's required. If you're using a DHT22 or AM2302 you can sometimes leave this off


I am now wondering why the Adafruit tutorial mentions adding a pullup resistor to the data line from the power lead when the other tutorials do not. I think I will give this a try. Thank you for that link. This electronics newb learned something today.



On Mon, Feb 8, 2021 at 06:15 PM, Dana KN4BEV wrote:

Adafruit has some pretty good tutorials about the DHT sensors at this link https://learn.adafruit.com/dht. I seem to remember that the 3pin variety are identical to the 4pin. The 4pin model has one pin marked as "no contact". If you'd like more than just temperature, take a look at bme280 or bme680 chips. https://www.adafruit.com/product/2652.
 
You may already know about direwolf weather reporting features. Direwolf can read text files in special formats and map them to data points in APRS messages.

 
--
- Dave
  W3DJS


Basil Gunn
 

Check out my repository (n7nix/rpi-temp-graph) which uses a DHT11 module to measure ambient temperature

https://github.com/n7nix/rpi-temp-graph

/Basil n7nix


Steve Spence
 

Dht11 does not use i2c. Did you connect the resistor between data and vcc? Did you install the correct library? I assume you are using python.


On Tue, Feb 9, 2021, 02:14 Timothy Mollman <mollmant@...> wrote:
Is your I2C turn on?  It's under the pi config program.   

On Mon, Feb 8, 2021, 15:02 Dave Slotter, W3DJS <slotter@...> wrote:
I am wanting to get a Pi to read current time temperature and humidity for an APRS weather station. This should be simple to hook up, no?

I already searched this group, and came up with no hits on "DHT11". I am wondering if anyone on this list has experience with hooking up a DHT11 Temperature and Humidity Sensor to a Pi? I bought a batch from Amazon, and apparently they're a bad batch or I'm not hooking them up right to the Pi... Although there are only three pins to hook up... Power, Ground and Data.

I followed the tutorial on https://www.circuitbasics.com/how-to-set-up-the-dht11-humidity-sensor-on-the-raspberry-pi/ and quickly found out that my DHT11 have different pinout ordering than the tutorial. Once hooked up, the attached LED glowed once I powered up the Pi, so things looked pretty good, until I attempted to read the sensor data, and then it came up totally empty. (I double and triple-checked that I was connected to the correct pins.) Maybe I got a bad batch of sensors? (These were the three pin variety, not four pin.)

If anyone has any "reputable" vendors to buy from, please advise. It looks like the "wild west" on Amazon with retailers selling these for wildly different price points. Also, any advice on using DHT11 to read temperature and humidity is welcome. Like I said, this is for an APRS weather station.

73,

--
- Dave
  W3DJS


Steve Spence
 

On Tue, Feb 9, 2021, 02:02 Dave Slotter, W3DJS <slotter@...> wrote:
I am wanting to get a Pi to read current time temperature and humidity for an APRS weather station. This should be simple to hook up, no?

I already searched this group, and came up with no hits on "DHT11". I am wondering if anyone on this list has experience with hooking up a DHT11 Temperature and Humidity Sensor to a Pi? I bought a batch from Amazon, and apparently they're a bad batch or I'm not hooking them up right to the Pi... Although there are only three pins to hook up... Power, Ground and Data.

I followed the tutorial on https://www.circuitbasics.com/how-to-set-up-the-dht11-humidity-sensor-on-the-raspberry-pi/ and quickly found out that my DHT11 have different pinout ordering than the tutorial. Once hooked up, the attached LED glowed once I powered up the Pi, so things looked pretty good, until I attempted to read the sensor data, and then it came up totally empty. (I double and triple-checked that I was connected to the correct pins.) Maybe I got a bad batch of sensors? (These were the three pin variety, not four pin.)

If anyone has any "reputable" vendors to buy from, please advise. It looks like the "wild west" on Amazon with retailers selling these for wildly different price points. Also, any advice on using DHT11 to read temperature and humidity is welcome. Like I said, this is for an APRS weather station.

73,

--
- Dave
  W3DJS


N5XMT
 

check to see if the DHT has a resistor on the board.  Some already have it, some do not.  The ones I bought from ADAFRUIT had it, but the DHT11 is squirrely.  sometimes they read, other times they don't.  the tutorial I believe mentions that.  you also have to enable 1-wire interface in raspi-config


On Tue, Feb 9, 2021 at 2:48 AM Dave Slotter, W3DJS <slotter@...> wrote:

Hi Dana,

Thanks for your response. I took a look at the dht tutorial on Adafruit.com and saw this mention:

  • The second pin is data. Connect a 10K pullup resistor from this pin to 3.3V. If you are using a DHT11 it's required. If you're using a DHT22 or AM2302 you can sometimes leave this off


I am now wondering why the Adafruit tutorial mentions adding a pullup resistor to the data line from the power lead when the other tutorials do not. I think I will give this a try. Thank you for that link. This electronics newb learned something today.



On Mon, Feb 8, 2021 at 06:15 PM, Dana KN4BEV wrote:

Adafruit has some pretty good tutorials about the DHT sensors at this link https://learn.adafruit.com/dht. I seem to remember that the 3pin variety are identical to the 4pin. The 4pin model has one pin marked as "no contact". If you'd like more than just temperature, take a look at bme280 or bme680 chips. https://www.adafruit.com/product/2652.
 
You may already know about direwolf weather reporting features. Direwolf can read text files in special formats and map them to data points in APRS messages.

 
--
- Dave
  W3DJS


Perry Ogletree
 

Boy howdy! The DHT11 is a "guess and bygolly" sensor. The DHT22 is workable but the temp readings aren't too reliable. I'd go with other sensors from Adafruit like the AHT20 for temp and humidity, the LPS22 for baro, and I have a Sparkfun AS3935 Lightning Detector in my mix. I don't hook them directly to the Pi though, I use a ESP32 to collect and format the data which is transmitted to the Pi over WiFi with TCP/IP. All those sensors are "Qwiic" connected with a 4-wire daisy chain that makes I2C easy to hook up.

Perry K4PWO


Basil Gunn
 

The DHT11 is a "guess and bygolly" sensor.

I read the DHT11 close to 100% using some C code to read the sensor & a script. See dht11_temp.c & rpiamb_gettemp.sh in github repo https://github.com/n7nix/rpi-temp-graph

In the product description for the DHT11 there is a distinction between a raw sensor & a module which contains a pull up resistor. It is not necessary to enable the 1-wire interface


N5XMT
 

if you are using the methods in the Adafruit tutorials, you do need to enable 1-wire


On Tue, Feb 9, 2021 at 10:13 AM Basil Gunn <basil@...> wrote:

The DHT11 is a "guess and bygolly" sensor.

I read the DHT11 close to 100% using some C code to read the sensor & a script. See dht11_temp.c & rpiamb_gettemp.sh in github repo https://github.com/n7nix/rpi-temp-graph

In the product description for the DHT11 there is a distinction between a raw sensor & a module which contains a pull up resistor. It is not necessary to enable the 1-wire interface