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

1 Answers1

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.

joan
  • 71,024
  • 5
  • 73
  • 106
  • 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. – Panthesilea Dec 01 '15 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 01 '15 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? – Panthesilea Dec 02 '15 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 02 '15 at 12:50