DHT11 Permissioned Denied

Hello,
I am trying to connect and use a DHT11 Temp sensor on a jeston nano.
I am using C_DHT.c lib

Below is the kind of error msg I get:

gpioSetDirection: Unknown error 517
gpioSetValue: Operation not permitted
gpioSetValue: Operation not permitted
gpioSetDirection: Unknown error 517
gpioSetDirection: Unknown error 517
gpioSetValue: Operation not permitted
TG(-39909.0, -39909.0, 0)

Build and install C_DHT.c done successfully with sudo,

Could somebody help ?

Tks

Hi @Tery_Gr,

Welcome to the NVIDIA Developer forums! I am going to move your topic to the Jetson Nano category for better visibility.

Cheers,
Tom

1 Like

Thanks

1 Like

Hello so I just fixed the permission issue, pin number was wrong because refering to a wrong jetson card type (xavier and not nano … ) But everytime I read the value I still get TG(-39909.0, -39909.0, 0) with no value and 0 at the end. 0 at the end means “communication error” if I am not mistaking. I am using a 3 pin DHT11, left pin connected to 3.3v center pin to pin 37 of the jetson nano for the data and right pin to grn through a 10k resistor. Anything wrong in my setup ?

hello Tery_Gr,

are you refer to this github, NVidia-Jetson-DHT22-Python?
did you modify the C code to change the definition for which connected to Jetson.

Hello,
Yes this is the git I am referring to.
And yes I modified the c code to refer to the correct pin and the correct jetson card, Nano in my case.

At the end I removed the 10k resistor because I found several connection example on the web without any resistor, can you advice on this ?

Thanks

hello Tery_Gr,

do you still see Operation not permitted failures by using root permission?
BTW, there’re level shifters, you may see-also application note for 40-Pin Expansion Header.

No I don’t have permissions error anymore. I am always getting (-39909.0, -39909.0, 0) as answer where, if I am right the last 0 means communication error.

At the moment my DHT11 sensor is connected as follows:
left pin of DHT11 to pin 17 of Jetson nano (3.3v)
center pin of DHT11(Data) to pin 37 of Jetson nano
right pin of DHT11 to pin 9 of Jetson nano (Grn)

hello Tery_Gr,

you may read the values in a loop, so on 4 checksums error there will be likely 1 correct value.

Hello Jerry,

Still the same even with a loop … my code below:

import C_DHT
import time

while True:
C_DHT.readSensorDHT11(0)
C_DHT.readSensorDHT11(1)
time.sleep(2)

output:

TG(-39909.0, -39909.0, 0)
TG(-39909.0, -39909.0, 0)
TG(-39909.0, -39909.0, 0)
TG(-39909.0, -39909.0, 0)
TG(-39909.0, -39909.0, 0)
TG(-39909.0, -39909.0, 0)
TG(-39909.0, -39909.0, 0)
TG(-39909.0, -39909.0, 0)
TG(-39909.0, -39909.0, 0)
TG(-39909.0, -39909.0, 0)
TG(-39909.0, -39909.0, 0)
TG(-39909.0, -39909.0, 0)
TG(-39909.0, -39909.0, 0)
TG(-39909.0, -39909.0, 0)

hello Tery_Gr,

it should be checksum failure, are you able to examine the byte values, its last 8-bit for the check-sum.
BTW, how about using the other approach to fetch the values? i.e. C_DHT.readSensor(0), and C_DHT.readSensor(1).

Hello,

C_DHT.readSensor(0), and C_DHT.readSensor(1)`. is giving the same result.
I will try to examine the byte values and let you know,

Thanks for your help.

So, within the readSensorDHT11 function in C_DHT.c there is a test if(isCheckSumOK(bytes)).
This if is never satisfied in my case …

I have this error when launching sudo python setup.py build

aarch64-linux-gnu-gcc -pthread -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-MQK6UF/python2.7-2.7.17=. -fstack-protector-strong -Wformat -W
error=format-security -fPIC -I/usr/include/python2.7 -c jetsonGPIO/jetsonGPIO.c -o build/temp.linux-aarch64-2.7/jetsonGPIO/jetsonGPIO.o
aarch64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-MQK6UF/python2.7-2.7.17=. -fstack-protector-strong -Wformat -W
error=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-MQK6UF/python2.7-2.7.17=. -fstack-protector-strong -Wformat -W
error=format-security -fPIC build/temp.linux-aarch64-2.7/C_DHT.o build/temp.linux-aarch64-2.7/jetsonGPIO/jetsonGPIO.o -o build/lib.linux-aarch64-2.7/C_DHT.so

hello Tery_Gr,

may I also know how long is the cable? you may also try reduce the length to avoid line voltage drop.
this is also mentioned in the datasheet, please try configure the wait time to 5-sec for reading data.

when power is supplied to sensor, don’t send any instruction to the sensor within one second to pass unstable status.

by checking this. DHT11 Humidity And Temperature Sensor Package | Hackaday
it looks 3.3v is slightly small than its supported power supply. how about connect it to a 5.0v voltage?

Still not … even with 5V and with 5 sec.
The picture is showing the model I Use, 3 pins with embedded resistor.
I tried with signal connected to pin 29 and with signal connected to pin 37.

My C_DHT.c
#define PIN0 jetsonnano_pin37
#define PIN1 jetsonnano_pin29

My Code:

import C_DHT
import time

while True:
C_DHT.readSensorDHT11(0)
C_DHT.readSensorDHT11(1)
time.sleep(5)

according to the snapshot, you’ve wrong pin connections.

Yes I know but this has been corrected already.
Now connections are correct and the output is still the same …

Thanks

hello Tery_Gr,

could you please try toggle the pin-37 settings as below for confirmation.
for exmaple,

sudo -i
cd /sys/class/gpio/
echo 12 > export 
#if no error
cd gpio12
echo out > direction

if above works, please also update pin-29 settings, its gpio number is 149.

I ditched this type of sensor, I switched to an I2C sensor and I have now a working solution. Thanks