I've just bought a DHT22 sensor to connect to my RPi but most tutorials mention there should be a resistor connected between the sensor and the GPIO pin. Is this necessary? Will it work without or will I end up melting something?

3 Answers 3


The short answer is yes. The pull up resistor ensures a valid logic level when the pins are switching from input to output, you won't melt anything but it may not function correctly. so you should add a 4.7K - 10KΩ resistor between the Data pin and the VCC pin.

This tutorial froim Adafruit has a schematic and some info on logging your data.

  • 7
    The Pi also has pull-up resistors build-in. You could just add a line of code instead. (elinux.org/…)
    – Gerben
    Commented Dec 8, 2013 at 12:26
  • 8
    @Gerben May I suggest you add an answer with the code needed to enable the pullup resistor? Commented Dec 9, 2013 at 22:14
  • 3
    If you are using python and the RPi.GPIO library, you'd use GPIO.setup(12, GPIO.IN, pull_up_down=GPIO.PUD_UP) where 12 in the pin number
    – Gerben
    Commented Dec 10, 2013 at 16:22
  • 3
    @Gerben instead of a comment to my answer I encourage you to make this a separate answer. It can stand on its own and provides an alternative that does not involve an additional purchase. Also, it will increase the number of answers per question ratio we need to improve to graduate from beta status. Commented Dec 10, 2013 at 16:44
  • RPI's internal pull resistors are 50K. DHT22 requires 10K at most, as I know. Hence you have to use an external pull up resistor if you care you sensor works as supposed to.
    – Dmitry
    Commented Nov 17, 2021 at 13:29

It seems necessary for reliable readings. I started my project without pull up resistor and the humidity measurement started dropping down. It may start correctly but deterioate later. Since I was using pigpio module, I enabled internal pull up resistor as below:

  pi.set_pull_up_down(gpio, pigpio.PUD_ON)

The gpio refers to your data pin.


I use a 10K pull-up from pin 2 (DATA) to pin 1 (VCC), and always use 3V3 to pin 1.

On 5V the sensor heats up a few degrees celsius. Also, pay attention to nearby heatsources (laptop, your breath, power supplies) when testing/calibrating the sensor.

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.