Skip to main content
All CollectionsConnect your Devices
Connect an Intel Edison to Ubidots using the Arduino IDE over HTTP
Connect an Intel Edison to Ubidots using the Arduino IDE over HTTP

Learn how to setup the Intel Edison to speak with Ubidots using Arduino IDE over HTTP.

Sergio M avatar
Written by Sergio M
Updated over 3 months ago

The Intel Edison is a tiny computer-on-module offered by Intel as a development system for the Internet of Things (IoT). It features a dual-core Intel Quark x86 CPU at 400 MHz communicating via Bluetooth and Wi-Fi. 

The Intel Edison offer an Arduino KIT which provided the pinout Arduino 1.0 and standard connectors. Designed to be compatible with hardware and software with any Arduino Uno R3 Shield.

In this step-by-step guide you will learn to:

  • Assemble and connect cables to your Intel® Edison board.

  • Run the setup tools to install USB drivers and flash to your Intel® Edison board's firmware.

  • Set a device password and connect your development board to Wi-Fi.

  • Collect, analyze, and organize your Ubidots dashboard for device and data management.

Requirements

The Intel® Edison compute module is meant to be used with a breakout board and is typically bought together with a kit containing the compute module and a breakout board.

  • Intel® Edison compute module

  • Arduino* expansion board

  • Micro-B USB to Standard-B USB cables (x 2)

  • Direct current (DC) power supply (see specs)

Step-by-Step

  1. Setting up the Intel Edison

  2. Setting the Arduino IDE

  3. Sending (POST) Data to Ubidots

  4. Summary

1. Setting up the Intel Edison

1. Assemble the Intel Edison Board. Click here for additional support if you are not familiar with the board's assembly. 

2. Download the latest configuration tool based on your system to access the features in the current Intel® IoT Developer Kit release. 

3. Follow step-by-step the instructions of the configurations tool to get your board set-up.

4. Install the USB drivers.

IMPORTANT NOTE: The drivers allow your computer to recognize the boards as devices. For this reason, be sure all the driver were properly installed.  

5. Download the latest firmware and flash it to your Intel Edison. Please be patient as this will take a few minutes.  

 6. Once finished, the below screen will appear. Please ensure your board is properly connected to your PC and power unit to allow for the flash and reboot.

7. Set a device name and password to enable SHH, if you want to use this. (For this, a guide is not needed).

8. Connect your board to Wi-Fi. It will scan for the available networks, select the correct signal and security for the network, and enter the Wi-Fi password. If you change any wifi settings, do not forget to write them down for next time.

9. Once your device connects to the network, you will see the IP address.

10. Ensure all the configuration are already checked. Click on the “Finish” button once confirmed. 

2. Setting up the Arduino IDE

1. Open the Arduino IDE, if you don’t have it, download here

2. To be able to work with the Intel  platform in the Arduino IDE, you will need to install the Intel platform using the preconfigured Arduino Board Manager. If you are not familiar with adding a board with the Arduino IDE, refer to this article for additional guidance.

  • Intel Platform to be installed:  Intel i868 Boards - Edison

3.  With the Intel platform installed, select the Intel device you are working with. In the case, we are working with a “Intel Edison”. To select your board from the Arduino IDE, select Tools > Board Intel Edison”. Then, select the board and choose the COM port assigned to the board.

3. Sending (POST) Data to Ubidots

With the following sample code you will be able to post the readings taken from ANALOG pins A0 and A1 of the Intel Edison Arduino Kit.

1. To post your first value in Ubidots, open the Arduino IDE and paste the sample code below. Once you have pasted the code, you will need to assign your unique Ubidots TOKEN, SSID (WiFi Name) and Password of the available network. 

/*************************************************************************************************
 * This Example sends  harcoded data to Ubidots and serves as example for users which
 * desire build a HTTP request to the Ubidots API with any device. Please reference to the link below
 * to find more information about it - Ubidots REST API Reference - https://ubidots.com/docs/api/
 *
 * You will find a help guide for this code on the link below:
 * http://help.ubidots.com/connect-your-devices/connect-your-intel-edison-to-ubidots-using-arduino-over-http
 *
 * This example is given AS IT IS without any warranty.
 *  
 * Made by María Carlina Hernández.
 *************************************************************************************************/

/********************************
 * Libraries included
 *******************************/
#include <WiFi.h>
#include <SPI.h>

/********************************
 * Constants and objects
 *******************************/
/* Assigns the network parameters */
char* WIFI_SSID = "Assign_your_WIFI_SSID_here"; // your network WIFI_SSID (name)
char* WIFI_PASSWORD = "Assign_your_WIFI_PASSWORD_here"; // your network password

/* Assigns the Ubidots parameters */
char const * TOKEN = "Assign_your_Ubidots_TOKEN_here"; // Assign your Ubidots TOKEN
char const * DEVICE_LABEL = "edison"; // Assign the unique device label
char const * VARIABLE_LABEL_1 = "temperature"; // Assign the unique variable label to publish data to Ubidots (1)
char const * VARIABLE_LABEL_2 = "humidity"; // Assign the unique variable label to publish data to Ubidots (2)

/* Parameters needed for the requests */
char const * USER_AGENT = "EDISON";
char const * VERSION = "1.0";
char const * SERVER = "industrial.api.ubidots.com";
int PORT = 80;
char topic[700];
char payload[300];

/* initialize the library instance */
WiFiClient client;

/********************************
 * Auxiliar Functions
 *******************************/

void SendToUbidots(char* payload) {

  int i = strlen(payload);
  /* Builds the request POST - Please reference this link to know all the request's structures https://ubidots.com/docs/api/ */
  sprintf(topic, "POST /api/v1.6/devices/%s/?force=true HTTP/1.1\r\n", DEVICE_LABEL);
  sprintf(topic, "%sHost: industrial.api.ubidots.com\r\n", topic);
  sprintf(topic, "%sUser-Agent: %s/%s\r\n", topic, USER_AGENT, VERSION);
  sprintf(topic, "%sX-Auth-Token: %s\r\n", topic, TOKEN);
  sprintf(topic, "%sConnection: close\r\n", topic);
  sprintf(topic, "%sContent-Type: application/json\r\n", topic);
  sprintf(topic, "%sContent-Length: %d\r\n\r\n", topic, i);
  sprintf(topic, "%s%s\r\n", topic, payload);
 
  /* Connecting the client */
  client.connect(SERVER, PORT);

  if (client.connected()) {
    /* Sends the request to the client */
    client.print(topic);
    Serial.println("Connected to Ubidots - POST");
  } else {
    Serial.println("Connection Failed ubidots - Try Again");
  }  
   
  /* Reads the response from the server */
  while (client.available()) {
    char c = client.read();
    //Serial.print(c); // Uncomment this line to visualize the response on the Serial Monitor
  }

  /* Disconnecting the client */
  client.stop();
}

/********************************
 * Main Functions
 *******************************/
 
void setup() {
  Serial.begin(115200);
  Serial.print("Connecting to ");
  Serial.println(WIFI_SSID);
  /* Connects to AP */
  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
   
  Serial.println(F("WiFi connected"));
  Serial.println(F("IP address: "));
  Serial.println(WiFi.localIP());
}

void loop() {
  /* Reads sensors values */
  float temperature = analogRead(A0);
  float humidity = analogRead(A1);
 
  /* Builds the payload - {"temperature":25.00,"humidity":50.00} */
  sprintf(payload, "{\"");
  sprintf(payload, "%s%s\":%f", payload, VARIABLE_LABEL_1, temperature);
  sprintf(payload, "%s,\"%s\":%f", payload, VARIABLE_LABEL_2, humidity);
  sprintf(payload, "%s}", payload);
 
  /* Calls the Ubidots Function POST */
  SendToUbidots(payload);
  /* Prints the data posted on the Serial Monitor */
  Serial.println("Posting data to Ubidots");
  Serial.print("Temperature: ");
  Serial.println(temperature);
  Serial.print("Humidity: ");
  Serial.println(humidity);

  delay(5000);
}


2. Verify your code within the Arduino IDE. To do this, in the top left corner of our Arduino IDE you will see the "Check Mark" icon; press it to verify your code. 

3. Upload the code into your “Intel Edison”. To do this, choose the "right-arrow" icon beside the "check mark" icon. 

4. To verify the connectivity of the device and the data sent, open the serial monitor by selecting the "magnifying glass" icon in the top right corner of the Arduino IDE to see the connectivity logs.

5. Confirm your data in Ubidots. Now you should see the posted data in your Ubidots account, located the device called "edison". 

Open to the device called "edison" and you’ll find the variables you assigned on the code, humidity and temperature:

4. Summary

With this simple tutorial you are able to POST data to Ubidots with the ease of the Arduino IDE and an Intel Edison. If you desire to handle context or timestamp values in your request checkout Ubidots REST API and modify the request built in the sample code provided. Also, check the GET documentation to start controlling your devices remotely with Ubidots!  

Now its time to create Ubidots Dashboards to visualize your data and deploy your IoT solution!  Happy Hacking! :)

Other readers have also found useful...

Did this answer your question?