How can i use DHT11 on Jetson nano?

When I use GitHub - GrgoMariani/NVidia-Jetson-DHT22-Python: A python library to read temperature and humidity from DHT22 sensor I got some wrong , export tips me gpioSetDirection:Unknow error 517 gpioSetValue:Operation not premitted. How can i solve the problem? Thanks.

Hi,

Thanks for your question.
We are checking this with our internal team. Will update more inforamtion later.

Thanks.

Hi 1362244737,

Which GPIO pin do you want to use?

Board mode 37pin

Do you mean gpio12 SPI_2_MOSI?

https://www.jetsonhacks.com/nvidia-jetson-nano-j41-header-pinout/

yes but i use other GPIO like 33 or 31 it tips me the same error

Hi,

We cannot guarantee the functionality of your “jetsonGPIO.c”. It is not an official tool.

Please try below command and see if you would hit error.
https://www.kernel.org/doc/Documentation/gpio/sysfs.txt

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

Thank you! it works

@1362244737: Was it 3 pin DHT 11, or 2 pin DHT11?

Was the configuration which worked using two or three pins from nano GPIO? or just one pin gpio12 SPI_2_MOSI for data?

Was it using the github code from GitHub - GrgoMariani/NVidia-Jetson-DHT22-Python: A python library to read temperature and humidity from DHT22 sensor ? or the external tool GitHub - jetsonhacks/jetsonGPIO: A straightforward library to interface with the Jetson TK1 GPIO pins ? or just the code quoted above?

Could you provide steps on how to reproduce your success in connecting DHT11 to nano, please?

Thanks.

Hi, were able to get this working? GitHub - GrgoMariani/NVidia-Jetson-DHT22-Python: A python library to read temperature and humidity from DHT22 sensor

Its mentioned that there are 2 pins, PIN0 and PIN1, but DHT11/DHT22 has only 1 data pin. how do we go about this?

yes it worked somehow
there are variations of dht some of them have 3 legs, some 2, as far as I remember. What prevents fom reading from one data pin?

Thannks for your reply. I currently have 4 pin version, VCC, DATA, NULL, GND. I am connecting Data pin to pin 12 of Jetson Nano(pin 12 on board, 18 BCM). I tried 2 things:

  1. GrgoMariani library, in this C_DHT.c there are 2 pins to set PIN0 and PIN1. one will be data, what should be the other one? I gave both the same pins (for experiment) and it gave me dummy values.

  2. Installed adafruit_dht library for python and then tried running as mentioned GitHub - adafruit/Adafruit_CircuitPython_DHT: CircuitPython support for DHT11 and DHT22 type temperature/humidity devices, I am getting the error “please check the connection” which is very generic error. I tried with different pins.

It will be great if you can suggest me something.

what dummy values are you getting?
as long as you getting dtta from sensor it might be the data it outputs.
I just used one pin as I have not had second pin; it is up to user which pin to querry. you may also try raising a thread at github, as the author is very helpful with sorting out script running issues.
BTW: Do you have kernel module dht11 loaded?

I am getting -39909, which I think you get if not detected properly.
Can you please tell me what did you do with C_DHT.c? ( #define PIN1 )

may be it is correct vvalue with reverted polarity? thus 39909?
It was a long time ago,
I used to consult with the author.
If I find my notes I will share them. However they should be somewhere at the forum already

I used dht22
it would send many dumy then one actual value, like that

-39909.0, -39909.0, 0)
(-39909.0, -39909.0, 0)
(-39909.0, -39909.0, 0)
(-39909.0, -39909.0, 0)
(-39909.0, -39909.0, 0)
(-39909.0, -39909.0, 0)
(25.200000762939453, 53.900001525878906, 1)

from archives

You can also find more here : https://www.jetsonhacks.com/nvidia-jetson-agx-xavier-gpio-header-pinout/

It looks like all the pins on Xavier are 3v3. This should not be a problem as dht11 should be able to work with it.
Did you try recompiling and reinstalling the py library once you changed the pin definitions.

So the procedure to find which pin would suit you would be:
1. Change the pin definition in C_DHT.c
#define PIN0 jetsonxavier_pin18
#define PIN1 jetsonxavier_pin37

2. Recompile and reinstall
sudo python setup.py build
sudo python setup.py install
3. Test
import C_DHT
while True:
    C_DHT.readSensorDHT11(0)
    C_DHT.readSensorDHT11(1)   

The readSensorDHT11(0) in this case reads the pin18 while the readSensorDHT11(1) reads the pin37.

THE IDEA WAS TO SET PINS AND RUN WHILE LOOP CYCLE

Hi, I’m trying DHT11 on TX2 J21.
And I alreay follow your method.
But it’s still get (-33909.0, -33909.0, 0)

Did you know any debug methods?~
Thank you.

@t109598044 are you running the reading in a loop?
As per my experiencethere were four-five null values before every sensor output value as in

(-39909.0, -39909.0, 0)
(-39909.0, -39909.0, 0)
(-39909.0, -39909.0, 0)
(-39909.0, -39909.0, 0)
(-39909.0, -39909.0, 0)
(25.200000762939453, 53.900001525878906, 1)

@Andrey1984 Thanks for you reply.

Below is my code and tx2

144382585_1052126678616928_343427907698903322_n 144920069_839402273567306_8720729192102699711_n