DHT22 - anyone got one working?

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
uhclem
 
Posts: 107
Joined: Sun Jul 08, 2007 6:03 pm

DHT22 - anyone got one working?

Post by uhclem »

I'd like to do some environmental monitoring with my BBB and want to use a DHT22. I have found a few examples online but have had no luck getting any to work.

Closest I've come to "working" is with this code:
https://github.com/lhuet/beaglebone-pro ... ster/DHT22

Note that it will not complile until Beagle_GPIO_dht22.cc has this library added:
#include <unistd.h>

Using the default pin of P8_3, I can get a nonsense output of "Temp = 0°C, Hum = 0%". If I change that to, say, P8_7, it returns nothing and "echo $?" gives "135" which is some sort of error. I am running the program as root.

I would contact the code author, but there's no obvious contact info on github and he's French speaking and I'm not.

I am following the DHT sensor tutorial for the Pi for wiring. I am powering the DHT22 from P9_3 (3.3v) and am using a 6.8k pullup resistor.

I will readily admit I am mostly an ATMEL C/C++ coder and very rusty with posix stuff. Also I am very new to the beaglebone and its GPIO config system. It could be I am missing something obvious or doing something simple wrong.

Any help much appreciated! I have a fallback, which will be to use an attiny to read the DHT22 and software serial to send the result.

User avatar
uhclem
 
Posts: 107
Joined: Sun Jul 08, 2007 6:03 pm

Re: DHT22 - anyone got one working?

Post by uhclem »

I scoped out the data pin and I see it going low for about 10 us, but not with any correlation to my code running.

User avatar
uhclem
 
Posts: 107
Joined: Sun Jul 08, 2007 6:03 pm

Re: DHT22 - anyone got one working?

Post by uhclem »

FWIW, my DHT22 works perfectly fine being read from an ATTINY85. I'll probably just let it talk to one of the UARTs via serial.

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: DHT22 - anyone got one working?

Post by adafruit_support_mike »

Honestly, that's probably the easiest solution.

Linux computers are good for a lot of things, but direct sensor IO doesn't play to their strengths. Things like I2C kernel modules/DTOs make it easier, but then you run into devices with nonstandard interfaces like the DHT22, and things get annoying again.

Locked
Please be positive and constructive with your questions and comments.

Return to “Beagle Bone & Adafruit Beagle Bone products”