The Autonomo is a compact Arduino-compatible board that uses the Atmel Cortex M0+ 32bit microcontroller. It was designed to be autonomous (self-sufficient) by enabling it to be powered by a solar panel.

This guide explains how to send data to Ubidots from the SODAQ Autonomo over WiFi using the RN171 chip, also known as WiFibee.

Requirements

Setup

  1. Download the Arduino IDE here
  2. In the Arduino IDE go to File -> Preferences -> Additional Boards Manager URLs and add this line there “http://downloads.sodaq.net/package_sodaq_index.json”.
  3. Open the Boards Manager via Tools -> Board -> Boards Manager and search for SODAQ boards, then select the SODAQ SAMD boards for the Autonomo.
  4. Download the ubidots-sodaq-wifibee library here
  5. Go to the Arduino IDE, click on Sketch -> Include Library -> Add .ZIP Library
  6. Select the downloaded .ZIP file and then click on “Accept” or “Choose”
  7. Close the Arduino IDE and open it again.

This library uses WiFly library of SeeedStudio. For this reason I added it to this repository

This library creates a new Ubidots data source named “SODAQWiFly”, Inside that the library will save the variables

Send one value to Ubidots

In the next example we explain how to send a Temperature value to Ubidots API from your device. Please don’t forget to change SSID, KEY, AUTH and TOKEN.

#include <SODAQWiFibee.h>

/* Change the AUTH according to your network settings
   If is open change to WIFLY_AUTH_OPEN
   If is WPA1 change to WIFLY_AUTH_WPA1
   If is WPA1_2 change to WIFLY_AUTH_WPA1
   If is WPA2 change to WIFLY_AUTH_WPA1
*/

// To add space in RN171 you just put "$" instead of " "
#define SSID "WIFI$SSID"  
#define KEY "WiFi_Pass"
#define AUTH WIFLY_AUTH_WPA2_PSK
#define TOKEN "asdasenas12321adaxxxxx"  // Replace it with your Ubidots token

Ubidots client(TOKEN);

void setup() {
    client.wifiConnection(SSID, KEY, AUTH);    
}

void loop() {
    float value = analogRead(A0);
    client.add("Tmeperature", value);
    client.sendAll();
    delay(1000);
}

Get one value from Ubidots

In the next example we will explain you how to get the last value from a Ubidots variable. Please don’t forget to change SSID, KEY, AUTH and TOKEN.

#include <SODAQWiFibee.h>

/* Change the AUTH according to your network settings
   If is open change to WIFLY_AUTH_OPEN
   If is WPA1 change to WIFLY_AUTH_WPA1
   If is WPA1_2 change to WIFLY_AUTH_WPA1
   If is WPA2 change to WIFLY_AUTH_WPA1
*/

// To add space in RN171 you just put "$" instead of " "
#define SSID "WIFI$SSID"  
#define KEY "WiFi_Pass"
#define AUTH WIFLY_AUTH_WPA2_PSK
#define TOKEN "asdasenas12321adaxxxxx"  // Replace it with your Ubidots token

Ubidots client(TOKEN);

void setup() {
    client.wifiConnection(SSID, KEY, AUTH);    
}

void loop() {
    float value = client.getValue(ID);
    delay(1000);
}
Did this answer your question?