Next you’ll need to install the library we cloned earlier:
sudo python setup.py install
To confirm that you’ve successfully installed the library, test the sensor by navigating to the Examples folder and running the test python script:
cd examples sudo ./AdafruitDHT.py 11 4
This tests pin GPIO 4 for the DHT11 sensor and returns the temperature and humidity values.
As you can see, the result seems to be pretty accurate.
The parameters at the end can be modified to suit your setup. If you’re using the DHT22 sensor, replace 11 with 22 , or if you’re using another GPIO pin, substitute 4 for the appropriate GPIO pin number.
For example, sudo ./AdafruitDHT.py 22 17 refers to a DHT22 on GPIO17
Stay tuned for future posts on how we’ll connect this data to the cloud and Power BI!
//gcits.com.au/wp-content/uploads/GCITSlogowordpress.png00Elliot Munro//gcits.com.au/wp-content/uploads/GCITSlogowordpress.pngElliot Munro2015-09-13 03:45:512015-09-13 03:45:51Connect a DHT11 Temperature/Humidity sensor to a Raspberry Pi