Discover how to build an Arduino cloud data logger project based on Xively.

This post describes how to develop an Arduino cloud data logger that sends data (retrieved from sensors) to Xively IoT cloud platform. This platform is very interesting and provides several useful features for building IoT projects. Moreover, using the data collected, we will build an IoT dashboard to visualize the results using charts.

What is an Arduino cloud data logger? Well, the answer is very easy. It is a system data acquires data from sensors connected to Arduino (or other devives) and stores this information somewhere. In this Arduino data logger project, we will connect Arduino to Xively (the IoT cloud platform). We get the data using sensors, logging the values to the cloud. In the end, we will explore how to create a dashboard using the data collected.

Before starting it is useful to look at Xively IoT platform.

What is Xively Platform?

Before diving into the details of this Arduino cloud data logger project is useful to know more about Xively. This is the IoT cloud platform that will store the data.

Xively is an IoT cloud platform that is “an enterprise platform for building, managing, and deriving business value from connected products”. Moreover, it provides a cloud-based API with an SDK that simplifies the development process. It supports several prototyping board and technologies:

  • Android
  • Arduino
  • Arm mbed
  • C
  • Java

and much more. Please, refer to their library web site to find more information. In other words, Xively is a Paas(Platform As a Service) that exposes its services via RESTful APIs.
Moreover, Xively supports messaging service based on MQTT protocol.If you want to have more information about this IoT platform read Xively Architecture. In this IoT project tutorial, we will use the free Xively account.

Arduino cloud data logger overview

Now we know a bit more about Xively and the services it provides, it is time to start the  IoT data logging project and discover how to make our Arduino data logger. As an example, we will build a simple system that monitors the plant status health using a set of sensors that help us to measure environmental conditions and the soil moisture. In more details, we will create an IoT data logging system that logs temperature, pressure and so on.
If you remember, we have already explained this project in a previous post called “Smart plant system“. In this post, we will explore how we can achieve the same result using a different IoT cloud platform.

The picture of how sensors are connected to Arduino is shown below:

 

Arduino cloud data logger system overview with sensors
This data logger project uses Arduino Uno and a set of sensors:

  • DHT11: Temperature and humidity sensor
  • TEMT6000: Light intensity sensor
  • YL-38 + YL-69: Soil moisture sensor

Arduino logs all values read from these sensors to Xively that in turn stores the values to the cloud. We will use these values to create an IoT dashboard to visualize the logged data.

Xively definitions

Xively uses some basic concepts:

Xively device: It is your “device” or the IoT project you are building. Consider it as an envelope containing the data.

Channels: It is the streaming coming from your sensors. Usually, the channel number is equal to the sensor number (as long as you want to monitor them all). So the first step is adding the “device” to our account:
xively device setup

Then we define the channels. In this example we have 4 channels as it is clear in the picture below:

xively channel config

That’s all. Now you have to use the Xively library for your device (in our example Arduino Uno) and start sending data to the cloud. The code is very simple:

Please notice that the sketch defines a XivelyDatastream that holds the four stream we send to Xively platform.
Each channel defined previously using Xively interface corresponds to the  XivelyDatastream. Remember to use the data stream the same name used in the Xively interface.
Now if we upload the sketch to Arduino and run it, we will notice that Xively receives the data:

arduino temperature and humidity logger
xively cloud data
arduino data logger project

This is the first step in our journey to build an IoT data logger project based on Arduino.

As you can notice from the pictures above, Arduino logs data acquired from sensors. At the end of this step, we build an Arduino temperature and humidity data logger that sends the data to the cloud. The next step in this Arduino data logger project is visualizing this information using charts.

Create an IoT dashboard

Once the software part is working and the wiring aspects are defined the last step is analyzing how to create an IoT dashboard using the data stored in Xively. This is the last part of this IoT data logging project based on Arduino.
For this purpose, we will use Freeboard.io. This is a free IoT dashboard tool that can be integrated with Xively easily.
It helps us to represent the information stored in Xively using charts.
The first step is connecting Freeboard.io to Xively. This can be done easily using API Key provided by Xively.

freeboard xively integration

Now it is very simple to create charts connecting them to the Xively channels covered before.

freeboard.io add chart

At the end, you can create your IoT dashboard:

IoT dashboard

 

At the end of this post, hopefully, you gained the knowledge about how to build an Arduino data logger project. The interesting part of this project is the acquiring part where we log data from the sensors sending it to the cloud. You can use other IoT cloud platforms to store the data, the main concepts related to the data logging are still valid.

LEAVE A REPLY

Please enter your comment!
Please enter your name here