saladtestingbox/salad/dht22-pine64
ivan c185c20a79 init 2018-12-23 18:53:54 +03:00
..
Makefile init 2018-12-23 18:53:54 +03:00
README.md init 2018-12-23 18:53:54 +03:00
c_gpio.c init 2018-12-23 18:53:54 +03:00
c_gpio.h init 2018-12-23 18:53:54 +03:00
dht22 init 2018-12-23 18:53:54 +03:00
dht22.c init 2018-12-23 18:53:54 +03:00
pine64-gpio-number.py init 2018-12-23 18:53:54 +03:00
wiringPi.c init 2018-12-23 18:53:54 +03:00
wiringPi.h init 2018-12-23 18:53:54 +03:00

README.md

DHT11/22 for Pine A64

This is simple C application that reads DHT11/22 sensor using one wire protocol.

Compile

Compile directly on Pine A64.

apt-get install build-essential
make
sudo make install

Use it

Find a PINE GPIO number: http://joey.hazlett.us/pine64/pine64_pins.html

Execute in terminal:

dht22 -p <pin-number> -d 1000

It will read DHT connected on value every 1000ms continuously.

Read specific value

dht22 -p <pin-number> -s hum
dht22 -p <pin-number> -s temp

Use with Home-Assistant

Add this to your configuration file:

sensor:
- platform: command_line
  name: office_room
  unit_of_measurement: "°C"
  command: "dht22 -r 10 -s temp -p 71"
- platform: command_line
  name: office_room
  unit_of_measurement: "humidity"
  command: "dht22 -r 10 -s hum -p 71"

Dependencies

For controlling the GPIO's I used this RPi.GPIO-PineA64: https://github.com/swkim01/RPi.GPIO-PineA64/blob/master/source/c_gpio.c

Author

Kamil Trzciński, ayufan@ayufan.eu