technion / lol_dht22

A Raspberry Pi DHT22/AM2302 polling application
81 stars 64 forks source link

loldht gives "data not good, skip" but works with AdafruitDHT.py #10

Closed convolutionbbs closed 6 years ago

convolutionbbs commented 7 years ago

Hello, I have a raspberry pi 2 and I'm trying to setup a Raspberry Pi Vivarium Controller at raspiviv.com. I purchased 2x AM2302 wired DHT22 from Adafruit.

I have one wired to GIPO pin 3 and the second to pin 5. I am able to run the example program and return the temp / humidity successfully:

sudo python AdafruitDHT.py 2302 2 sudo python AdafruitDHT.py 2302 3

The first command argument 2 corresponds to physical pin 3 and the second command argument 3 corresponds to physical pin 5. If I do a:

gpio readall

this shows that physical pin 3 yields a wPI 8 and BCM 2; physical pin 5 yields wPI 9 and BCM 3. I'm guessing the AdafruitDHT.py is looking at BCM.

I am now trying to get the wiringPi loldht command to work. If I try

sudo loldht 8

It just reads "Data not good, skip". No matter what I try for the numerical argument it doesn't work. wiringPi is the core for the vivarium controller software.

Any suggestions?

Thanks!

technion commented 7 years ago

Hi,

I've got three identical issues here and I'm afraid at this point I don't have a lot to add. I don't have many of these devices to test with, and the two I have are still working with the current codebase.

Has there been a new generation of these devices with a different specification perhaps? The "data not good" message basically says that it's read obvious garbage and it's not going to display garbage.

convolutionbbs commented 7 years ago

Yes I saw the other posts and they look similar. As I'm new to this I don't know if an older hardware rev used to work or not.

Could I run some verbose output or change the code slightly to provide diagnostics? Because the Adafruit example python code works it tells me at some level the hardware is working. They are $15 so perhaps we could chip in and send you one for testing.

Thanks for your help!

mhors commented 6 years ago

Also wish to use RasPiViv to control my conservatory climate (3 fans, one heater, external DHT and internal DHT).

Seeing same problem as #7, #9 and #10. Also successfully run AdaFruit as convolutionbbs shows above and appear to get a good reading:

sudo python AdafruitDHT.py 2302 3 (connect to Phy 3 / wPi 8) Temp=23.0* Humidity=59.3%

sudo python AdafruitDHT.py 2302 3 Temp=23.1* Humidity=60.0%

sudo python AdafruitDHT.py 2302 3 Temp=23.5* Humidity=81.8% (my hot breath)

Could the website be altered to use AdafruitDHT rather than loldht?

Adafruit just provides 1 reading rather than a polled reading, but maybe create a loop and capture the output to the database?

Any way forward appreciated otherwise climate control of my plants will be manual this winter :(

convolutionbbs commented 6 years ago

I was never able to get this working. I have two of the DHT22's that don't do anything for me right now - I could donate one to someone who can fix the code.

ghost commented 6 years ago

same bug here on kernel 4.9.28-v7+ (pi2) working on pi2 fresh setup with kernel 4.9.56-v7+ only "data not good, skip"

make me nuts..

technion commented 6 years ago

I'm seeing from a lot of people the suggestion that it's an issue associated with the latest kernel. I can't possibly understand what changes however.

steve-techno commented 6 years ago

works for me using Raspbian 8 Jessie haven't tried with Stretch Raspbian 9 using AM2320B sensors in 3 wire mode Ground the white wire (SCL) and use 4.7K resistor to pull up data line , resistor between yellow wire (data(SDA)) & red wire (vcc (+))

technion commented 6 years ago

Paulv has a series of suggestions for modern kernels that I've found in this thread - actually updating the original thread I announced this driver in:

https://www.raspberrypi.org/forums/viewtopic.php?f=37&t=27215&start=75

Can anyone advise if this helps?

mrbashshell commented 6 years ago

I have tried it with activated SPI driver. But unfortunately it still does not work.

technion commented 6 years ago

This is believed to be fixed as per #9.