17

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?

12

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.

  • 3
    The Pi also has pull-up resistors build-in. You could just add a line of code instead. (elinux.org/…) – Gerben Dec 8 '13 at 12:26
  • 6
    @Gerben May I suggest you add an answer with the code needed to enable the pullup resistor? – Steve Robillard Dec 9 '13 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 Dec 10 '13 at 16:22
  • 2
    @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. – Steve Robillard Dec 10 '13 at 16:44
6

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.

3

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, privacy policy and cookie policy

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