Friday , 9 June 2023
Breaking News
Home > Tutorials > Arduino Tutorials > Read Multiple DHT11 Temperature Sensor with single Wemos

Read Multiple DHT11 Temperature Sensor with single Wemos


Once again welcome to my Temperature sensor tutorials series. As you know we are working on DHT11 temperature sensor, previously we successfully completed our sensor programming with MySQL and PHP programming. We added our sensor data into database and then retrieved it using PHP. In today’s tutorial we are going to read multiple sensors and then we will save it into database. If you not read my previous tutorial, please read it frist from here:

Now lets start our lesson.

We need to connect two DHT11 temperature sensors on two pins (data pin). It is your choice to select pins, I selected D1 and D2, D1 for reading first sensor D2 for second sensor. Now second thing you have to do is connecting + and – wires. You both wire should connect with same pin. Now your hardware requirement is OK. Here is code for arduino:-

As you can see in above code that we are getting two sensors data and then calling two tables. Now you need code to handle these requests. Here is PHP code for first sensor:-

and here is code for second sensor:-

As you can see there is no difference except $_GET[] values. You can write single page code for both sensors. To store data of these sensors you also need 2 tables, here is MySQL table schema:-

Now test you code.

Note:- Everything is discussed in detail in previous tutorials, not no need to explain it here that how to test the code.

Complete source code is here for download:

About Muhammad Faryad

Muhammad Faryad is a professional web application developer. He has been working for 5 years in ICE786 Technologies Pvt. Ltd as a Senior Programmer and Developer. You can contact him on facebook at


  1. Hi mohammad

    Thank you very much for the good training

    Can this be extended to 4 sensors?

Leave a Reply

Ad Test

%d bloggers like this: