Skip to content

Raspberry Pi GPIO17 with DHT22 no longer working #1889

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kowenhouston opened this issue Mar 9, 2017 · 4 comments
Closed

Raspberry Pi GPIO17 with DHT22 no longer working #1889

kowenhouston opened this issue Mar 9, 2017 · 4 comments

Comments

@kowenhouston
Copy link

Hi There,

I have a few raspberry pi's wired with DHT22 sensors. It would be very expensive for me to wire them all back up.

This is a working raspberry pi with raspbian:

root@localhost:~# python AdafruitDHT.py 22 17
Temp=24.2*  Humidity=29.9%

The non working raspberry pi with rasbian is:

root@localhost:~# python AdafruitDHT.py 22 17
Traceback (most recent call last):
  File "AdafruitDHT.py", line 41, in <module>
    humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)
  File "/usr/local/lib/python2.7/dist-packages/Adafruit_DHT/common.py", line 90, in read_retry
    humidity, temperature = read(sensor, pin, platform)
  File "/usr/local/lib/python2.7/dist-packages/Adafruit_DHT/common.py", line 77, in read
    return platform.read(sensor, pin)
  File "/usr/local/lib/python2.7/dist-packages/Adafruit_DHT/Beaglebone_Black.py", line 206, in read
    raise ValueError('Pin must be a valid GPIO identifier like P9_12 or GPIO1_28.')
ValueError: Pin must be a valid GPIO identifier like P9_12 or GPIO1_28.

The only difference between the two Raspberry Pis is that I ran rpi-update on one, which is now not working. The are both wired up identically, have the identical image (however I updated one).

My Wiring looks like this:
GPIO17 / Raspberry Pi Pin 11 - DHT22 Pin 2
+5VDC / Raspberry Pi Pin 2 - DHT22 Pin 1
GND / Raspberry Pi Pin 6 - DHT22 Pin 4

@pelwell
Copy link
Contributor

pelwell commented Mar 9, 2017

The filename Beaglebone_Black.py suggests the library has failed to identify that this is running on a Pi. There is a commit on Jan 20th to AdaFruit's Github repo for AdafruitDHT that looks like it might help, so can you update?

On this page you'll find all of the different firmware+kernel releases, along with a long SHA hash identifying the commit. You can get rpi-update to install a specific version by giving the hash. I suggest you start with the last release built from the 4.4 kernel, labelled "kernel: Bump to 4.4.50":

sudo rpi-update 52241088c1da59a359110d39c1875cda56496764

if you are keen you can then jump backwards or forwards from that point to find the first failing commit, but just knowing the result of testing with that one release would help.

@kowenhouston
Copy link
Author

I've downgraded to the following, which as far as I can see is the last one I can downgrade to before breaking the raspberry pi 2 v1.2 compatibility

Commits on Sep 22, 2016
@popcornmix
platform: Enable support for Pi2+
21505f3fb5d8e2a5abbf95baf441a7a6415d4a82

rpi-update 21505f3fb5d8e2a5abbf95baf441a7a6415d4a82

Which still gives me an error, but it's different again.

python AdafruitDHT.py 22 17
Traceback (most recent call last):
  File "AdafruitDHT.py", line 41, in <module>
    humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)
  File "/usr/local/lib/python2.7/dist-packages/Adafruit_DHT/common.py", line 90, in read_retry
    humidity, temperature = read(sensor, pin, platform)
  File "/usr/local/lib/python2.7/dist-packages/Adafruit_DHT/common.py", line 76, in read
    platform = get_platform()
  File "/usr/local/lib/python2.7/dist-packages/Adafruit_DHT/common.py", line 51, in get_platform
    import Raspberry_Pi_2
  File "/usr/local/lib/python2.7/dist-packages/Adafruit_DHT/Raspberry_Pi_2.py", line 22, in <module>
    import Raspberry_Pi_2_Driver as driver
ImportError: No module named Raspberry_Pi_2_Driver

Is there any way to see how the pin mapping differs without getting to deep into the code? Or even better is there a way to enable Pi2 v1.2 compatibility but still regaining the ability to run this library?

@pelwell
Copy link
Contributor

pelwell commented Mar 9, 2017

It sounds like you haven't installed the library properly and/or need to update it for the 4.9 kernel. I'm sure the good people at Adafruit (or their forums) will be able to help.

@kowenhouston
Copy link
Author

Ok, Thank you for your time. I have opened an issue over on the library page too:
adafruit/Adafruit_Python_DHT#63

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants