80 lines
2.0 KiB
Markdown
80 lines
2.0 KiB
Markdown
# DHT Humidity Sensing on Raspberry Pi
|
|
|
|
This project is a uses the AdaFruit libraries for sensing temperature using DHT11 sensor and a Raspberry Pi.
|
|
|
|
---
|
|
|
|
> [!IMPORTANT]
|
|
> Check the [requirements](https://git.kska.io/notkshitij/DHT11/src/branch/main/REQUIREMENTS.md) first.
|
|
|
|
## Main method
|
|
|
|
> [!NOTE]
|
|
> This is the main method, using AdaFruit library. For an easier method, checkout [## Alternative method](https://git.kska.io/notkshitij/DHT11#alternative-method)
|
|
|
|
1. Install some prerequisite packages:
|
|
```shell
|
|
sudo apt update &&\
|
|
sudo apt install git
|
|
|
|
```
|
|
|
|
2. Clone the project:
|
|
```shell
|
|
git clone https://git.kska.io/notkshitij/DHT11.git
|
|
```
|
|
|
|
> Alternatively, you can also [download the zip file](https://git.kska.io/notkshitij/DHT11/archive/main.zip)
|
|
|
|
3. Change the current working directory to the folder in which the project was cloned:
|
|
```shell
|
|
cd ./DHT11
|
|
```
|
|
|
|
4. Run the `setup.sh` script:
|
|
```shell
|
|
./setup.sh
|
|
```
|
|
|
|
> [!IMPORTANT]
|
|
> After running the code, and completing the execution, run `deactivate` in the terminal to exit the virtual environment.
|
|
|
|
---
|
|
|
|
## Alternative method
|
|
|
|
> [!NOTE]
|
|
> This alternative method uses the `DHT11` python library for reading the sensor data.
|
|
> This is a pure Python library for reading DHT11 sensor on Raspberry Pi.
|
|
|
|
1. Install prerequisites:
|
|
```shell
|
|
sudo apt update &&\
|
|
sudo apt upgrade -y &&\
|
|
sudo apt install python3 python3-pip -y
|
|
|
|
```
|
|
|
|
2. Setup a virtual environment & install the library:
|
|
```shell
|
|
mkdir /home/$(whoami)/temp-sensor
|
|
cd /home/$(whoami)/temp-sensor
|
|
python3 -m venv .
|
|
source bin/activate
|
|
pip install dht11 setuptools RPi.GPIO
|
|
|
|
```
|
|
|
|
3. **Download** and **run** the code [alt-temp.py](https://git.kska.io/notkshitij/DHT11/src/branch/main/alt-temp.py)
|
|
|
|
> [!IMPORTANT]
|
|
> After running the code, and completing the execution, run `deactivate` in the terminal to exit the virtual environment.
|
|
|
|
---
|
|
|
|
### License
|
|
|
|
This project is licensed under the terms of the MIT license. Read the license [here](https://git.kska.io/notkshitij/DHT11/src/branch/main/LICENSE.txt).
|
|
|
|
---
|