Read the statement by Michael Teeuw here.
MMM-DHT22 Humidity and Temperature Module
-
@DocVooDoo I guess that depends on how you installed magicmirror… did you use sudo?
-
@ryck no, without sudo. only with the command
bash -c “$(curl -sL https://raw.githubusercontent.com/MichMich/MagicMirror/master/installers/raspberry.sh)” -
Some modules or dependencies require access to the GPIO
The DHT sensor module I wrote needs this as well.
In terminal please try this
sudo adduser -g $USER gpio
I can’t remember if you need to reboot afterwards, but it won’t hurt. Then try again accessing the sensor
-
@yawns
Hi. Thanks for your help. The user “pi” is already a member of the group “gpio”.With Adafruit works the Sensor. Whether with or without sudo…
-
Any updates on this? I have the same problems as @DocVooDoo and others, i.e. Adafruit code works like a charm, dht_var not.
Difference I noticed is that dht_var uses wiringpi library and Adafruit not?! I tried a reinstall of wiringpi package without success.
Next, I compared the implementations of
dht_var
and the Adafruit driver for DHT22.The essence of the Adafruit code is in file
Adafruit_Python_DHT/source/Raspberry_Pi_2/pi_2_dht_read.c
. It is meant for Pi2 and Pi3, implemented in C, and defines a functionint pi_2_dht_read(int type, int pin, float* humidity, float* temperature)
. It implements the communication with the sensor using a 1-wire bus. The rest of the Adafruit package is mostly (well-done) sugar-coating for Python usage and selecting the right driver for any given platform.We could simply rewrite dht_var by using this driver code. What do you think?