I'm intending to use DHT22s to get temperatures from multiple sites using a RPi2.

Since I'm not much of an electronics guy, how many DHT22s can I connect? From the schematics, it uses the 3V port for power, and RPi has 2 of those only.

  • I don't know if the OP got this issue resolved, but I thought I would mention this for future reference. While the pi has plenty of GPIO pins, it cannot support reading from more than one of these sensors simultaneously. To read the sensors, you need to bit-bang the data line, and the timing is critical, so if the process gets swapped out by the Linux scheduler, it will have to repeat the measurement. You can, of course, read from multiple by reading from them one after another.
    – techdude
    Commented Jan 26, 2017 at 23:02
  • @techdude You can read as many as you can connect "simultaneously" with pigpio. It works differently to the other solutions.
    – joan
    Commented Feb 14, 2017 at 9:17

2 Answers 2


You can connect as many as you have spare gpios, so potentially 26 on the 40 pin expansion header Pis.

There is a variant which claims to use the I2C bus (it has a designation of something like AM2321). You could potentially connect a hundred of those. However I2C is a short distance bus (50 cm say) so your multiple sites will have to be close together. Also I have seen doubts raised about how well the device implements I2C.

All the Pis gpios are 3V3. For any distance you should be powering the devices from 5V and using a suitable divider to feed 3V3 to the Pis gpios.

You can feed multiple devices from one 3V3 or 5V pin (port in your terms).

Please remember the Pi expansion header has many pins, not all are connected to gpios. You connect the output of a DHT22 to an individual gpio. You power the DHT22 from the 3V3 or 5V power rails and the ground (0V) rail.

           pin  pin
3V3         1    2      5V
0/2 (SDA)   3    4      5V
1/3 (SCL)   5    6      0V
4           7    8      14 (TXD)
0V          9   10      15 (RXD)
17 (ce1)   11   12      18 (ce0)
21/27      13   14      0V
22         15   16      23
3V3        17   18      24
10 (MOSI)  19   20      0V
9 (MISO)   21   22      25
11 (SCLK)  23   24      8 (CE0)
0V         25   26      7 (CE1)
0 (ID_SD)  27   28      1 (ID_SC)
5          29   30      0V
6          31   32      12
13         33   34      0V
19 (miso)  35   36      16 (ce2)
26         37   38      20 (mosi)
0V         39   40      21 (sclk)
  • Thanks,50 cms would be a problem tho,anyway to increase the distance?
    – Sin5k4
    Commented Jul 23, 2015 at 13:09
  • @Sin5k4 Don't use the I2C variant. Have you any feel for the distances you want to use?
    – joan
    Commented Jul 23, 2015 at 13:11
  • Could extend up to 5 meters for per sensor.
    – Sin5k4
    Commented Jul 23, 2015 at 13:12
  • @Sin5k4 I've only used short breadboard distances with the DHT22, say 30 cms, so can't answer from personal experience. However I think 5 meters should not be a problem. Have a search for Arduino and DHT22 to get some real world examples.
    – joan
    Commented Jul 23, 2015 at 13:18

As joan says, you cannot easily make several DHT22:s share a gpio pin.

If you only want temperatures and don't care about humidity, you can look at the DS18B20, also on Adafruit. For outdoors use you can get a waterproof version. Several of these can be connected to the same I/O pin. Adafruit has a great tutorial about connecting them to the Pi and reading the temperature.

I've also found that DS18B20:s handle long cables (several meters) better than the DHT11, which is similar to the DHT22.

  • Unfortunately i need humidity values as well...
    – Sin5k4
    Commented Jul 23, 2015 at 13:06

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.