Python implementation for Adafruit_DHT sensor for Raspberry Pi.
Project description
Python implementation for Adafruit_DHT sensor for Raspberry Pi.
RPi.DHT is using DHT sensor with Raspberry Pi GPIO.
To connect to Raspberry Pi plug DHT sensor data into GPIO PIN 9 (Physical pin 21) and GROUD and POWER PINs. Install and execute RPi.DHT and it should work. Alternatively you can user different PIN and execute raspi-dht with parameter: raspi-dht --pin pin_number.
RPi.DHT supports number of parameters and also configuration file. For more details see raspi-dht --help or sample config.
Sensor is based on RPi.Sensor library, which make base for implementing different types of sensors in Python.
There is an Ansible role at galaxy, which will do all the dependencies, config creation, and creates systemd service. Otherwise follow install instructions below…
Pre-Installation requirements
Update system and install required dependencies:
sudo apt-get update
RPi.DHT needs Adafruit Python DHT Sensor Library. Make sure your system is able to compile Python extensions. On Raspbian or Debian/Ubuntu image you can ensure your system is ready by executing:
sudo apt-get install build-essential python3-dev python3-pip
Installation
Install the latest released version using pip:
pip install https://github.com/ricco386/RPi.DHT/tarball/master/
Alternatively install latest released version from pypi:
pip install --upgrade RPi.DHT
Integration as a systemd service
Make sure all dependencies (listed below) are installed (done automatically when installing via pip)
The raspi-dht command should be installed somewhere in your PATH (done automatically when installing via pip), make sure raspi-dht.service has corect path in ExecStart set to raspi-dht executable.
Systemd scripts are available: https://github.com/ricco386/RPi.DHT/tree/master/init.d to install them you will need root privileges, so we execute them as sudo:
sudo cp init.d/raspi-dht.conf /etc/tmpfiles.d/ sudo cp init.d/raspi-dht.service /etc/systemd/system/ sudo systemd-tmpfiles --create /etc/tmpfiles.d/raspi-dht.conf sudo systemctl enable raspi-dht.service # Enable service to start at system boot sudo systemctl start raspi-dht.service # Start
Systemd scripts should be run under default Raspberry Pi user (pi), scripts have to be able access GPIO.
Dependencies:
RPi.Sensor (0.5.3+)
Usage
You have to create a .sensor.cfg file and place into /home/pi/.sensor.cfg you can find example file in RPi.Sensor repo: https://github.com/ricco386/RPi.Sensor/blob/master/raspi_sensor/sensor.cfg.example and create section [DHT] where you can override default values.
raspi-dht also support multiple parameters to overwrite config parameters. For more info run:
raspi-dht --help
License
For more information see the LICENSE file.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file RPi.DHT-0.5.0.tar.gz
.
File metadata
- Download URL: RPi.DHT-0.5.0.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac13011d04f28bcc57599685fa036446ec2d06e98b2fe55999e1bee21f8b69a8 |
|
MD5 | 38f756a81e086607f0f1cd14f714d71d |
|
BLAKE2b-256 | 6501fac069d50af0f5199b66043a4a2e2ab02815712d86f37ec431560b00a6c4 |
File details
Details for the file RPi.DHT-0.5.0-py3-none-any.whl
.
File metadata
- Download URL: RPi.DHT-0.5.0-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6cac33cb2fd9cb6259112f092163cd202c89df811e399fa7412593f4ac80f1d8 |
|
MD5 | df6e08b61f22c51a552c66ec4b32b9e4 |
|
BLAKE2b-256 | aa1c23e4df6bd2f77d264c8c0a9c9ca2adc74fa432f4281246cbb84575497b6d |