Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DHT22 Sensor import Adafruit_DHT error

So I've properly attached DHT22 Humidity Sensor to my BeagleBone Black Rev C. I'm running OS Mavericks on my MacBook Pro and I followed the directions provided by Adafruit on how to use my DHT22

The website I used was pretty clear: https://learn.adafruit.com/dht-humidity-sensing-on-raspberry-pi-with-gdocs-logging/software-install-updated

Also here is the github files I cloned: https://github.com/adafruit/Adafruit_Python_DHT

I put in these lines:

git clone https://github.com/adafruit/Adafruit_Python_DHT.git

cd Adafruit_Python_DHT

sudo apt-get upgrade

sudo apt-get install build-essential python-dev

sudo python setup.py install

cd examples

sudo ./AdafruitDHT.py 22 P8_11

I am successful until that last line. Once I enter that last line (sudo ./AdafruitDHT.py 22 P8_11), I get the following error message:

Traceback (most recent call last):
  File "./AdafruitDHT.py", line 23, in <module>
    import Adafruit_DHT
ImportError: No module named Adafruit_DHT

I know there is an Adafruit_DHT file somewhere because when I ls in the Adafruit_Python_DHT directory, I get this:

root@beaglebone:~/Adafruit_Python_DHT# ls
Adafruit_DHT  examples  ez_setup.py  ez_setup.pyc  LICENSE  README.md  setup.py  source

I've tried reinstalling the setup.py, but the outcome is still the same.

I've followed all the directions Adafruit provided, but I just can't seem to get past this. Any idea on what is going on? It seems like a simple problem, but it's proving to be one major obstacle in getting readings from my DHT22. If there is more information needed to help answer this problem please let me know.

like image 719
FooLingYu2 Avatar asked Oct 07 '14 22:10

FooLingYu2


People also ask

Which of the following is true humidity sensor is DHT22?

Also the DHT22 sensor has better humidity measuring range, from 0 to 100% with 2-5% accuracy, while the DHT11 humidity range is from 20 to 80% with 5% accuracy. There are two specification where the DHT11 is better than the DHT22.

Which Python library is required for humidity and temperature sensing?

GitHub - adafruit/Adafruit_Python_DHT: Python library to read the DHT series of humidity and temperature sensors on a Raspberry Pi or Beaglebone Black.


1 Answers

Easy fix:

cd Adafruit_Python_DHT

sudo apt-get update

sudo apt-get install build-essential python-dev python-openssl

sudo python setup.py install

Try to run sudo ./AdafruitDHT.py ## ## ... file again

You may have forgot to run the setup properly.

like image 149
ndb23 Avatar answered Sep 28 '22 22:09

ndb23