How can i use DHT11 on Jetson nano?

When I use I got some wrong , export tips me gpioSetDirection:Unknow error 517 gpioSetValue:Operation not premitted. How can i solve the problem? Thanks.


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


Hi 1362244737,

Which GPIO pin do you want to use?

Board mode 37pin

Do you mean gpio12 SPI_2_MOSI?

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


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.

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 ? or the external tool ? or just the code quoted above?

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


Hi, were able to get this working?

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, 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 :

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 build
sudo python install
3. Test
import C_DHT
while True:

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