Connecting multiple DHT11 to photon

I have a doubt regarding the adafruit DHT library.

I want to connect 3 DHT11 sensors, and I was wondering if thats possible.

I should define, the 3 pins used,

#define DHTPIN 2     // what pin we're connected to

and three types one for each

// Uncomment whatever type you're using!
#define DHTTYPE DHT11        // DHT 11 

I have some doubts regarding setup(), it only shows:


Will it work for 3 sensors?


Would you be willing to consider the piettetech library? It’s know to be stable, and functioning exceptionally well over the last year or so. With other libraries (adafruit included) there have been various issues. I believe the piettetech even has an example application for multiple sensors which you should be able to expand.

Moors7, sure, I am at Testing Stages… so any ideas are welcome

This is the link? Is not added as one of the libraries on the web-ide?

you create an instance of the library like this:


and in ```setup()` you use this to initialize the instance of the library:


you add another instance like this:


and in setup() like this:


and so you call the functions with either instance…

You should find it if you search the library system :smile:

@BulldogLowell Thanks begginers question! Will test it. Thanks

@Moors7 Will also try the other library just for comparison!

Thanks both!

1 Like

@aleza84, did it work? I am looking at the DHT11 or DHT22 for an indoors & outdoors comparison to regulate indoor-climate.

Works perfectly!!! Sorry for the late reply, I got three DHT11 working just fine.

Let me know if yours works, if not feel free to ping me.

1 Like

Which library did you prefer to use finally ? Adafruit or Piet ? why ? (just starting to implement this on a sensors farm)

They both work fine, in my experience.

there seems to be a lot more support here for the Piettetech library, but I can vouch for the Adafruit too… have a few working on Cores for more than a year, photon’s working well too…

Would you be willing to share the code on this project ?
im looking to do something similar but i am a bit lost