IoT Arduino Temperature and Humidity System

Arduino Temperature Humidity System

Arduino Temperature Humidity System

Monitor my home environmental parameters remotely is one of the most desirable things I have ever wanted to make. It’s not about purchasing such a system that can get the job done for me. But, passion to create it myself.

So, today, I am going to connect the popular DHT sensor to an online MQTT broker “server”. The sensor will publish its temperature and humidity readings to the broker. Then, from even outside the home, I can get these readings on my smartphone.

As another tutorial of this continuous IoT Blog Series, I will use this sensor with Arduino and IoT Shield from 1Sheeld to get its readings over the internet. I will make an Arduino Temperature Humidity System that I can monitor anywhere, anytime on my smartphone using IoT.


In this Arduino Temperature Humidity System tutorial, I am going to connect 2 devices to an online MQTT server “broker”, the sensor, which is just an Arduino with a DHT11 sensor and the smartphone. The sensor will publish its humidity and temperature readings to certain topics. And the phone will subscribe to the same topics. Hence, it gets all the sensor readings as messages and visualizes them on the screen.

Since the broker is online, then you need to connect the Arduino to the Internet, then connect it to the broker.

But Arduino alone can’t do that, so I will use the IoT Shield from 1Sheeld+ board that will be plugged into the Arduino and connect it to the online MQTT broker.

Also, you will need an iPhone “since IoT Shield works with iOS only” to be connected to the 1Sheeld via Bluetooth. And another one “iPhone or Android” that will act as the controller device where you will use it to publish “close” and “open” message through an IoT app.

You will find all the software and Apps required for this tutorial linked in the software components section.


Getting started:

If this is your first time to deal with 1Sheeld or you want to learn more about it, then I recommend checking this quick and easy getting started tutorial.

Furthermore, if this your first time reading about MQTT broker, then I recommend you go through this MQTT before going into this tutorial.

I will use the DHT11 sensor, so you can go through this tutorial to get familiar with it. Also, you will find the sensor library. You should download it and copy it to the same folder of your Arduino sketch of this project.

Now, after you’ve become a little bit familiar with 1Sheeld and MQTT broker, let’s start!


Step 1: Hardware components:

  • Arduino Uno.
  • 1Sheeld+ board.
  • Arduino USB cable.
  • DHT sensor
  • Male-to-female jumper wires.
  • iOS phone with 1Sheeld App installed on it.
  • Android/iOS phone with the IoT MQTT Panel Pro installed on it.

Step 2: Software components:

Step 3: Connection and Schematic:

  • Plug the 1Sheeld board into your Arduino as this:


  • Connect the DHT sensor with the Arduino as illustrated below:
  • Switch the 1Sheeld power to operate on 5v (Not the 3.3v):

  • 1Sheeld have 2 modes: Uploading mode and Operating mode. You can switch between them using the switch close to the Digital pins and is called “UART SWITCH” on 1Sheeld and “SERIAL SWITCH” on 1Sheeld+.


Firstly, you slide the switch towards the “SWITCH” notation which turns the 1Sheeld board into the Uploading mode to let you upload the Arduino code.

Then, after you finish uploading the code, slide the switch towards the “UART” notation (or “SERIAL” at 1Sheeld+ board) which turns the 1Sheeld board into the Operating mode to communicate with your smartphone 1Sheeld App.


  • Finally, connect the Arduino via your PC using Arduino USB cable.

Step 4: Code:

I would recommend checking the Arduino IoT Shield documentation to know more about the Arduino IoT Shield functionalities and how to use them.

Also, you can check this IoT Shield Functions Explainer blog to know about the usage of all the Arduino functions related to the IoT shield.


Now, switch the 1Sheeld board to the Uploading mode, upload this code:

Note: change this code:

to your own broker instance credentials you got after you have created it on CloudMQTT website.

If you don’t know how to get your own CloudMQTT broker instance, please check this MQTT blog.


Then, Switch the 1Sheeld board to the Operating mode. Then open the 1Sheeld app, connect it to the 1Sheeld board via Bluetooth and select the IoT shield.


Step 5: Configure it:

Firstly, let’s configure the phone and connect it to the broker.

Open the IoT MQTT Panel App and create a connection to the CloudMQTT broker. Again, all these MQTT broker stuff are explained in the MQTT blog.

After that, you will add a panel for the humidity reading with a type “Vertical Meter”.


Then write a name for the panel “Humidity”. Then make its topic as “sensor/operate/hum”. That’s the topic which this meter subscribes on.

A payload is just another name for the message.

Humidity min is “0” and max is “100”. So, write these values in payload min and payload max sections.

Then, add the “%” as a unit for this meter. That’s it for the humidity part.

When finished, press “CREATE”.

Then, let’s repeat for the temperature but with a different panel, the “Gauge”.

And write the topic and the min, max temperature values. DHT11 measures from 0-50 C.

Once finished, press CREATE.

Step 6: Run the Arduino Temperature Humidity System …

First of all, you will open the CloudMQTT website from here and navigate to the Websocket UI to monitor what’s going on on the broker.

Then on the App, press on the upper right cloud-shaped button to connect the phone to the broker.

Once connected, the cloud-shaped button will change its color to be orange.

Finally, press on the reset button on the Arduino and monitor the CloudMqtt WebSocket UI panel.

You will see something like this on the WebSocket UI!

That’s because once the Arduino connects to the broker, it publishes a message “ready” on the topic “sensor/state”. Just an indication that the Arduino has just connected to the broker.

Since Arduino is publishing on topics “sensor/operate/temp” and “sensor/operate/hum” which are the same topics that we configured the meter and the gauge in the App to subscribe on.

Therefore, you will get the temperature and humidity readings continuously on your phone. Cooool!



You can easily monitor all the publishing and subscribing operations on the broker from the Websocket UI console. It will be something like that:

And here is my IoT Arduino Temperature Humidity System project working 🙂

That’s it for the IoT Arduino Temperature Humidity System tutorial, guys.

And if you are interested in this IoT Blog Series, keep visiting the blog page for the upcoming IoT tutorial.

Furthermore, check my 2 IoT blogs:

And my previous IoT tutorials:

I hope you enjoyed this Arduino Temperature Humidity System tutorial. And for any questions or even opinions about this tutorial, please don’t hesitate to leave your comments down below 🙂

Related Blogs

Arduino Security Camera

Arduino Security Camera System (Arduino Home Hacks #4)

Arduino Security Camera Have you ever wanted to check your home in real time? Afraid that maybe someone has stormed in, don’t remember if you shut the door or not or maybe wanna check if your Hyper-energetic dog has broken any of your dishes AGAIN!! 🙂 Then this is the perfect place for you cause today …

Arduino IoT

Arduino IoT Shield Functions Explainer

Arduino makers …. you can connect your Arduino to MQTT brokers(servers) and launch your IoT with Arduino IoT Shield! It’s the 1Sheeld IoT shield that will do the job for you. It’s one of the most important but recent Arduino shields in 1Sheeld. Simply, it turns your Arduino into MQTT client where you can publish and …

Arduino Door Lock

IoT Arduino Door Lock using 1Sheeld and Smartphone

  “Oh God! … It seems like I have forgotten the door lock open, again” … the normal saying whenever I am in hurry to go out! Have you encountered this problem before? It always confuses me since I may even think that I have left the door lock opened, and once I go back, …

IoT Fan Control

Arduino IoT Fan Control using 1Sheeld and Smartphone

Here I am with another IoT-based home automation project; Arduino IoT Fan Control. Every day, I get back from work tired and feeling hot. No air conditioner here and the fan takes much time to start cooling the room, sadly! So, I was thinking why not controlling the fan from outside my home with my …

Arduino Light Control

IoT Arduino Light Control using 1Sheeld and Smartphone

Have you ever forgotten to turn your home lights off when you got outside? Sadly, it happens to me all the time. And this causes confusion once I get my bills! Furthermore, here is one secret about me; I am a lazy man. I always want to control my room lamp from my sweet bed. …


MQTT Protocol – How it Works

MQTT is one of the most commonly used protocols in IoT projects. It stands for Message Queuing Telemetry Transport. In addition, it is designed as a lightweight messaging protocol that uses publish/subscribe operations to exchange data between clients and the server. Furthermore, its small size, low power usage, minimized data packets and ease of implementation …