Canedje
Posts: 265
Joined: Thu Mar 26, 2015 7:18 am

more then 1 DHT22 sensors to Pi2

Fri Mar 27, 2015 12:07 pm

Hello,

I'm a Raspberry Pi2 user and busy programming it for a week now.
All works fine and I finished just a project reading a energy measurement p1 port by USB and displays the results at a website in graphs
.
I like to start now a new project to read more then one DHT22 temp/humidity sensors at the Raspberry
I know that it is possible to connect more then one DS18B20 sensors parallel at the GPIO port 4.
Is this also possible with the DHT22 sensor? If not. Is it possible to connect several DHT22 sensors to different GPIO ports and read the different sensors?

I did search the internet and didn't found answers yet.

Thanks for the answers

User avatar
joan
Posts: 14936
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: more then 1 DHT22 sensors to Pi2

Fri Mar 27, 2015 12:18 pm

Without adding additional hardware (line multiplexors, I guess) you need one gpio per DHT22.

It may use 1 wire for control/data but it is not a 1-wire bus system (aka Dallas).

Yes, you can have as many DHT22 as you have spare gpios.

Canedje
Posts: 265
Joined: Thu Mar 26, 2015 7:18 am

Re: more then 1 DHT22 sensors to Pi2

Sat Mar 28, 2015 1:52 pm

Thanks for the clear answer.

I'm looking around the internet for a while and find a lot of information about reading DTH22 and ds18b20.
The ansers are all slightly different.

Addition to this question:

I do like to write code in Python to read both sensors. The result I like to write into een logfile.
In PHP i will read the file again and present it on the web

I wonder what basic software and libaries do I need to install to read the GPIO and both the sensors on the Raspberry needed for Python
Is there a clear link or tutorial to find out what basic is needed to write sw in Python to read both types of sensors.

Thanks again

danjperron
Posts: 3502
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: more then 1 DHT22 sensors to Pi2

Wed Apr 01, 2015 6:21 pm

i put some code in python on this post for the dht22,dht11 and the ds18b20.

I used rdtool and highcharts but it should be easy to use an sql database and php.

http://www.raspberrypi.org/forums/viewt ... 06#p672406

Return to “Advanced users”