0

I want to use the DHT11 sensor with my Raspberry PI 2 Model B.

I'm using pin#01 for the VCC, pin#39 for GND, but I don't know which pin should I use for DATA? Should I enable some GPIO ports to use them? I get only 0x0 data (I tried pin#37).

enter image description here

2
  • You don't mention what if any tutorial you are using, but have you tried this learn.adafruit.com/… Dec 1, 2015 at 7:54
  • Yes, I tried this Adafruit tutorial, but I get 0x0 data only. Dec 1, 2015 at 8:02

1 Answer 1

0

Use any GPIO you want.

I have some example software at http://abyz.me.uk/rpi/pigpio/examples.html#pdif2_DHTXXD to read the DHT series of temperature and humidity sensors. It should auto detect the sensor type. It requires my pigpio library.

Connect Pi 3V3 to sensor +, Pi ground to sensor ground, and any GPIO to sensor data. You ALSO need to connect a 4k7 (or thereabouts) resistor between the data line and 3V3. The sensor will not work otherwise.

4
  • Thanks! Could you tell me can I use 5V for the sensor? I read the sensor's specification and it says if I use 5V I can send the signal to 20m, which is great because I want to deploy other sensors inside the house. Dec 1, 2015 at 20:19
  • It should be possible to do as follows: Connect Pi 5V to sensor +, Pi ground to sensor ground, and any GPIO to sensor data. You ALSO need to connect a 4k7 (or thereabouts) resistor between the data line and 3V3. In other words leave the data line pull-up connected to 3V3 but power from 5V. I have not tested this but I'm told it will work by those who know more than me.
    – joan
    Dec 1, 2015 at 20:38
  • So I can use 5V too. Should I use other resistor? And can I use multiple sensors with sharing the 3.3/5V and ground and separating data lines for each sensor? Dec 2, 2015 at 12:45
  • @Panthesilea The same value resistor will be fine. You can share the power and ground lines between sensors. You will need a separate resistor for each data line pull-up to 3V3, and each data line will need its own GPIO.
    – joan
    Dec 2, 2015 at 12:50

Your Answer

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

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