CiaoRestClient-ThingSpeak only for ESP-Link firmware

This example shows the interaction between the Ciao Library and the ThingSpeak Cloud. In particular in this example is shown how to create a channel on ThingSpeak to monitor the Humidity and Temperature.
This tutorial is available only for the Arduino UNO WiFi board and using the Arduino IDE 1.7.7 or later.


This sketch requests to works the Ciao library. To run Ciao you will need:

  • Ciao Core: it can be installed, via package manager or from source, more information are provided below;
  • Ciao Library: it's available in the Arduino IDE since version 1.7.7 and in the Arduino Studio since version 0.0.4. It can also be added manually by importing the library, following more details; 
  • a compatible board: check this link to verify the list of boards compatible with Ciao.

Follow CIAO SETUP to install Ciao Core.

In the Arduino UNO WiFi, Ciao is already integrated.


ThingSpeak is an open data platform and API for the Internet of Things that enables you to collect, store, analyze, visualize, and act on data from sensors or actuators, such as Arduino. For example, with ThingSpeak you can create sensor-logging applications, location-tracking applications, and a social network of things with status updates, so that you could have your home thermostat control itself based on your current location. The primary element of ThingSpeak activity is the channel, which contains data fields, location fields, and a status field. After you create a ThingSpeak channel, you can write data to the channel, process and view the data with MATLAB® code, and react to the data with tweets and other alerts. The typical ThingSpeak workflow lets you:

  • Create a Channel and collect data
  • Analyze and Visualize the data
  • Act on the data using any of several Apps

The ThingSpeak API is available on GitHub and includes the complete ThingSpeak API for processing HTTP requests, storing numeric and alphanumeric data, numeric data processing, location tracking, and status updates.

Create a ThingSpeak channel

To run this sketch you need to register an account on and create a new channel. Follow these steps:

ThingSpeak registration

  • create a channel, clicking on Channels > My Channels > New Channel menu, as shown in the below image:

Create a new channel

  • Rename the new channel and add two fields. The first one refers to the humidity data and the second one to the temperature value.

Setting new channel 
Save channel

  • Replace the "XXXXXXXXX" value of APIKEY_THINGSPEAK with "Write API key" value reported in the API Keys section of the channel, as shown in the picture.


Now upload the code on your board.


Upload the code using IDE. You can dowload it from here if you haven't already done. 
Keep in mind to replace "XXXXXXXXXX" API KEY using "your Write API key", as said above.

If you are using the Arduino IDE 1.7.x then continue to use the ArduinoWiFi.h library.
Instead if you are using the Arduino IDE 1.8.x then download the UNOWiFiDev.Edition library from Library Manager and modify the code, replacing #include <Ciao.h> with #include <UnoWiFiDevEd.h>
This example show the interaction between the Ciao Library and the Thingspeak Cloud.
To run the example you need to register an account on and create a
new channel by clicking "Channels" section in the website (Channels -> My Channels -> New Channel).
In the new channel you need to add two fields. The first one refers to the humidity data and the second one to the temperature value.
After that, replace the "XXXXXXXXX" value of APIKEY_THINGSPEAK with "Write API key" value reported in the API Keys section of the channel.
#include <Wire.h>
#include <Ciao.h>// if you are using the Arduino IDE 1.8.x then: //#include <UnoWiFiDevEd.h>
#define CONNECTOR     "rest"
#define SERVER_ADDR   ""
short hum = 60;
short temp = 22;
void setup() {
Ciao.begin(); // CIAO INIT
void loop() {
  String uri = "/update?api_key=";
  uri += "&field1=";
  uri += String(hum);
  uri += "&field2=";
  uri += String(temp);
  Ciao.println("Send data on ThingSpeak Channel");
  CiaoData data = Ciao.write(CONNECTOR, SERVER_ADDR, uri);
  if (!data.isEmpty()){
    Ciao.println( "State: " + String (data.get(1)) );
    Ciao.println( "Response: " + String (data.get(2)) );
    Ciao.println("Write Error");
delay(30000); // Thinkspeak policy


Open the ThingSpeak Channel to saw the humidity and temperature value: 
Output ThingSpeak 
If you use an Arduino UNO WiFi, access to the WIFI CONSOLE of the web panel and it will be shown this screen: 
Output on WiFi console 
In this sketch are used of default values for humidity(60) and temperature(22). 
Try to modify the sketch reading the real value provided by an humidity and temperature sensor connected to your board.


For other examples about the Ciao Library look below or visit the github repository using this link: