Skip to content

Commit

Permalink
Merge pull request #7 from etiiiR/patch-1
Browse files Browse the repository at this point in the history
grove.py has no grove_temperature_humidity_sensor
  • Loading branch information
tamberg authored Jun 14, 2022
2 parents 9ac45a6 + ad9d19c commit 1aa0a15
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
21 changes: 18 additions & 3 deletions data-acquisition/Python/dht/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ How to read and visualize a DHT sensor with Python on a Raspberry Pi.

The example is based on the information found in:

- the [SEEED Docs](https://github.com/Seeed-Studio/grove.py/tree/master/doc#temperature--humidity-sensordht11)
- the [SEEED Docs](https://github.com/Seeed-Studio/Seeed_Python_DHT)
- this [post](https://www.deviceplus.com/raspberry-pi/lets-build-mobile-gadget-using-compact-raspberry-pi-zero-build-environment-check-device-using-grove-sensor/)

## Hardware
Expand All @@ -28,13 +28,28 @@ Figure 1: DHT sensor connected to D16
...
```

2. Download the file [`dht.py`](dht.py) on to your Raspberry Pi.
2. Check that the library `seeed-python-dht` is installed on your Raspberry Pi, with:

```shell
$ pip3 show seeed-python-dht
Name: grove.py
Version: 0.0.2
Home-page: https://github.com/Seeed-Studio/Seeed_Python_DHT
Author: Baozhu Zuo
Author-email: [email protected]
License: MIT
...
```



3. Download the file [`dht.py`](dht.py) on to your Raspberry Pi.

This is a small python program using the DHT sensor, which is connected to PIN D16, to read out the temperature and humidity and to print these values to the console, including a timestamp.

Note that this program has no main loop.

3. Run the program with
4. Run the program with

```shell
$ python3 dht.py
Expand Down
10 changes: 8 additions & 2 deletions data-acquisition/Python/dht/dht.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import time
import math

# check, that python lib 'grove' is installed; pip3 freeze | grep grove
import grove.grove_temperature_humidity_sensor as dht
try:
import grove.grove_temperature_humidity_sensor as dht
except:
# Install pip3 install seeed-python-dht if ModuleNotFoundError: No module named 'grove.grove_temperature_humidity_sensor'
# check, that python lib 'seeed-python-dht' is installed; sudo pip3 install seeed-python-dht
import seeed_dht as dht

DHT_PIN = 16 # rasperry pi Pin16, Grove D16

Expand Down Expand Up @@ -30,4 +36,4 @@ def main():
pass

if __name__ == '__main__':
main()
main()

0 comments on commit 1aa0a15

Please sign in to comment.