I want to connect both a fan, set in slow cooling mode, and a DHT22 sensor to my RPi.

My wirings:

fan in cooling mode:

  • power wire: connected to pin 17
  • ground wire: connected to pin 20

and it works fine.

Now I want to add a DHT22 sensor, whose vendor sent me the connection schema, that is the following:

enter image description here


  • red wire = power, connected to pin 1
  • blue wire = data/GPIO, connected to pin 3
  • black wire = ground, connected to pin 6

I connected the sensor as indicated, but I can't find a library that allows me to get data from my DHT22 sensor without using a board.

Is it possible? Can anybody point me one out?

I tryed Adafruit_DHT but with little success since I have a Raspberry Pi 4.

  • 2
    There are many tutorials. Work through one or two and ask again if you have a problem.
    – joan
    Commented Sep 27, 2020 at 23:21
  • if you install with pip3 run with python3, not python...
    – Abel
    Commented Oct 5, 2020 at 1:33

1 Answer 1



By now, the only library I found allowing one to get data from DHT22 sensor without using a board is the already mentioned Adafruit Python library.

The problem is that this library is deprecated and not updated to work with Raspberry Pi 4, so it does not recognize the RPi4 software.

In order to solve it, I had to change the library a little and to reinstall it on my RPi4, here is described how.

Then I navigated to path Adafruit_Python_DHT/examples of the library installed on my RPi and I called this function from command prompt

python AdafruitDHT.py 22 4

which returned me the data recorded by my sensor DHT22.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.