How to use Arduino with

This tutorial describes how to use with Arduino. This tutorial explores how to build an IoT based on Arduino that exchanges data with To get the data to send the cloud, we will use DHT11 sensor and BMP180 sensor. The DHT11 monitors the temperature and the humidity while the BMP180 monitors the atmospheric pressure.

Moreover, this tutorial covers another important aspect of Arduino programming such as how to send sensor readings to an IoT cloud platform so that we can store these values and analyze them later. At the end of this tutorial, you will learn all the details related to Arduino programming and how to use sensors in your next Arduino IoT project.

The final result is shown below:

DHT11 and BMP180: Monitor the temperature and pressure with Arduino

The image above shows the IoT dashboard based on the values sent by sensors, DHT11 and BMP180,  connected to Arduino.

You might be interested on: Internet of Things with Android and Arduino: Control remote Led

Components Required

To build this IoT project based on Arduino, you need the following components:

  • Temperature (DHT11)
  • Humidity (DHT11)
  • Pressure (BMP180)

This Arduino programming tutorial is useful if you want to implement an IoT project that uses Arduino and collects information displaying it using dashboards. Moreover, it is possible to use different sensors connected to Arduino because you can apply the same steps described in this Arduino project.

How to connect temperature sensor (DHT11) and the pressure sensor (BMP180) to Arduino

In this IoT Arduino programming tutorial, the Arduino board connects to a set of sensors and an ethernet shield:

  • DHT11 (Temperature and Humidity sensor)
  • BMP180 (Pressure sensor)

Both sensors are connected to +5V and they are perfect for Arduino Uno. The details of the sketch and the way the sensors are wired to Arduino are not important, so it will not be shown here (but it is very very simple!!).

Temperature and humidity DHT11 sensor

DHT11 is a very cheap sensor that is able to measure the temperature and the humidity. It is a digital sensor with the digital output signal proportional to the temperature and humidity measured.  DHT11 has only one output pin where the temperature and the humidity values are serialized. It is really simple to connect the DHT11 to Arduino because only three different pins are required.

Pressure BMP180 sensor

The Pressure BMP180 sensor is a low-cost pressure sensor used for measuring barometric pressure. It can measure the temperature also even if this Arduino tutorial uses DHT11 sensor to measure the temperature. It is a I2C sensor so it requires four different wires: Vcc, Ground, Clock and Data.

Implementing the Arduino code to read data from DHT11 and BMP180

The Arduino code to use in our sketch to read data from DHT11 and BMP180 is shown below:

#include <Adafruit_BMP085.h>
#include "DHT.h"
#define DHTPIN 2 //Arduino PIN
#define DHTTYPE DHT11 // DHT11 Type
Adafruit_BMP085 bmp;
void setup() {
void loop() {
  float h = dht.readHumidity();
  // Read temperature as Celsius (the default)
  float t = dht.readTemperature();
  float presPa = bmp.readPressure();
  float presMb = presPa * 1013.25 / 101325;
}Code language: PHP (php)

One important thing to remember is importing the BMP180 library. You can do it using Arduino Library Manager feature in Arduino IDE and look for the BMP180 sensor:

Arduino BMP180 sensor library

How to use Arduino and to Sending sensor readings

Let us focus our attention one of the most important part of this Arduino programming tutorial: how to send readings to a IoT cloud platform. Before sending data to the IoT cloud platform, it is necessary that Arduino connects to the network. To this purpose, it is necessary to have an ethernet shield or WiFi shield if you are using an Arduino Uno. if you use another version of Arduino (i.e. Arduino MKR1000) you do not need to use an Arduino shield.

Find out how to use Arduino to monitor other parameters: Monitor air quality using Arduino. is a IoT cloud platform easy to use.  Moreover, it has interesting features as creating a dashboard with received data.
You can create a free account and try it for free. This platform supports Rest services, therefore, it is possible to invoke its services using an Arduino HTTP client.
Anyway, provides an Arduino library to simplify the process. You can download it from its Github repository and install it in your IDE as described previously.
Once the library is ready, it is important to set up the Ethernet connection properly:

// Mac address
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // Arduino mac address
EthernetClient client;
IPAddress ip(192, 168, 1, 178); // Arduino IP Add
IPAddress dns1(8, 8, 8, 8);
IPAddress gw(192, 168, 1, 1);
void setup() {
  // You could use DHCP instead
  Ethernet.begin(mac, ip, dns1, gw);
}Code language: PHP (php)

The next step is configuring the platform to accept data coming from Arduino. In this case, you have to create a “thing” that is a physical object that sends data. Below a screenshot of a thing created for this tutorial:

how to integrate Arduino and

The important thing is the TOKEN. This is the unique ID to identify our thing (like Arduino board). The Arduino sketch must send this TOKEN when connecting to to identify your Arduino board. Once the platform is configured correctly, the final step is setting up the code for sending data:

// TheThings tkoken
#define TOKEN "_xxxxxxxxxxxxxxxxxxx"
// The thing server address
thethingsiOEthernet thing(TOKEN);
void sendValues(float temp, float hum, float pres) {
  Serial.print("Sending data to TheThigs...");
  thing.addValue("temp", String(temp));
  thing.addValue("hum", String(hum));
  thing.addValue("pres", String(pres));
}Code language: PHP (php)

Visualize the data using IoT dashboard: Temperature, Humidity and Pressure dashboard

Temperature and the presure: Arduino cloud data

You can check the value read from the sensors sent to the cloud:

Using the dashboard feature you can create a custom dashboard to show charts creating from the data:

IoT Arduino pressure sensor graph


IoT Arduino dashboard cloud data

It is possible to get real-time value or historical values.

Have you ever thought to send temperature and pressure information via twitter? I suggest reading this tutorial about sending Tweets from Arduino. If you want to know more about Arduino and how to use it with Android you can read Internet of Things with Android and Arduino: Step by step guide

Wrapping up….

At the end of this tutorial about how to integrate Arduino and, you gained the knowledge of how to connect Arduino to several sensors and how to send sensor reading to the cloud. Moreover, this Arduino tutorial showed how to send data to an IoT cloud platform ( to create a dashboard using values acquired from sensors.  Once you have configured your IoT dashboard you can access it from everywhere and check remotely the sensor parameters. There are several scenarios where this Arduino project can be used and it is important you gain the knowledge how to connect sensors to Arduino and how to acquire data from sensors so that Arduino can send this information to the cloud.

    1. Dineo October 19, 2018
      • Francesco Azzola October 19, 2018

    Add Your Comment