0

Good morning everyone, I wanted to ask a question about the usage of a DHT22 sensor (AM2302). I was about to buy a sensor mounted on a board, as you can see in the link on amazon:

Amazon DHT22

It says that the sensor is for an Arduino board but does that mean that I cannot use it / connect it to a RPi? Should I go and buy the one I find on Adafruit?

Adafruit DHT22 Wired

I am asking this question because I am new to RPi and MCU in general and from the description it says that Adafruit also wrote a library for the usage of the DHT22 for Arduino, does that mean also that I cannot use it on a RPi? Is there a library somewhere that can be of use for the RPi instead of the Arduino?

Thanks in advance! :D

1 Answer 1

0

That will be fine.

The DHT22 will output on its DATA pin up to the voltage supplied on VCC (its power pin).

So if you power the DHT22 from 5V it will output 5V.

I mention that as the Pi's GPIO are only 3V3 tolerant. If you feed more than 3V3 into a Pi GPIO you may damage the GPIO and/or the Pi.

The solution is to power the DHT22 from a Pi 3V3 pin.

If you absolutely must power from 5V (because you are using the device at a long distance) you will need to use a voltage divider to drop the DATA pin to a Pi safe 3V3.

There is plenty of software to read the DHT22. Probably the most reliable (without using specialist techniques) is my DHTXX software.

2
  • Thanks for the answer @joan! The sensor will be at 30cm from the RPi (almost 1ft), it will be connected through jumpers (I think). Would that be problematic for a 3V3?
    – tdprince
    Commented Sep 9, 2016 at 9:49
  • @tdprince That distance will be fine. By the way I'd probably go for an I2C sensor at that (close) distance. The Si7021 is likely to be more accurate and more reliable.
    – joan
    Commented Sep 9, 2016 at 10:13

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.