The Alorium Technology device Snō is an FPGA-based development board in a compact, ready-for-integration footprint. It is programmed with the popular and easy to use Arduino IDE. To learn more about Snō, click here.
Following this quick set-up guide you will be able to connect the Snō using the ATWINC1500 WiFi breakout board to send and receive data from/to Ubidots.
Requirements
1. Setting up the Arduino IDE with Snō board
1. Download the Arduino IDE if you have not already done so. Open the Arduino IDE, select Files -> Preferences and enter the url below into Additional Board Manager URLs field. You can add multiple URLs, separating them with commas
https://raw.githubusercontent.com/AloriumTechnology/Arduino_Boards/master/package_aloriumtech_index.json
IMPORTANT NOTE: To be able to connect and program the Snō you need to install the FTDI drivers required. For this, please reference to the FTDI Driver Installation step from the Alorium Official Getting Started guide.
2. Open Boards Manager from Tools -> Board -> Boards Manager and install the Alorium XLR8 Boards platform. To simply find the correct device, search XLR8 within the search bar:
3. Confirm that the XLR8 board package now exists in your list of available boards. Go to Tools > Board and choose the new selection titled “Alorium XLR8 Boards”. Select your new Snō board from the Board menu.
FYI, after selecting the Snō board, you will find a new menu item at Tools -> FPGA Image, where you will find a number of FPGA images that provide different operating speeds and different XB configurations.
4. Next, install the Ubidots library into the Arduino IDE using one of the following 2 options:
Option 1: From the Github Repository
Go to Alorium Tech's Github repository and download the Alorium XLR8 Ubidots Library. To download the library click the green button called "Clone or download" and select "Download ZIP".
2. Now back in the Arduino IDE, click Sketch -> Include Library -> Add .ZIP Library.
3. Select the .ZIP file recently saved and then “Accept” or “Choose”
4. Close the Arduino IDE and open it again.
For additional resources, see the Alorium Official Getting Started Guide.
Option 2: From Library Manager of the Arduino IDE
Go to Sketch/Program –> Include Library –> Library Manager and install the XLR8 Ubidots library. To simply find the correct library, search "XLR8 Ubidots" within the search bar.
Then press "Install" and wait until the installation is complete.
Close the Arduino IDE and reopen it again.
2. Hardware Setup
Connect the Alorium Snō to the ATWINC1500 module by connecting the SPI interfaces together following the pin-out below:
3. Managing data with Ubidots Platform
Posting data to Ubidots
1. Copy and paste the below sample code in the Arduino IDE. Be sure to assign the parameters required to establish the connection and communication with Ubidots Platform.
SSID, name of your WiFi network
PASS, password of your WiFi network
//--------------------------------------------------------------------
// XLR8UbidotsSimple.ino
//--------------------------------------------------------------------
// Copyright (c) 2018 Alorium Technology. All rights reserved.
// by Jason Pecor Alorium Technology
//
// This file is a simple example for using the Alorium Technology
// XLR8 development board with Ubidots.
//
// The hardware setup for this example requires SPI connection to an
// Adafruit ATWINC1500 WiFi breakout module.
//--------------------------------------------------------------------
#include <UbidotsXLR8.h>
#include <SPI.h>
#include <WiFi101.h>
WiFiClient client;
// Ubidots Token
#define TOKEN ""
char ssid[] = ""; // WiFi SSID
char pass[] = ""; // WiFi Password
Ubidots ubidots(TOKEN);
int sensor0, sensor1, sensor2;
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(9600);
// Configure SPI for ATWINC Module
WiFi.setPins(8,7,4);
// Initialize and connect to Ubidots
ubidots.initialize();
ubidots.setDeviceName("sno");
ubidots.setDeviceLabel("sno");
ubidots.wifiConnection(ssid,pass);
}
void loop() {
// Send random values for sensor variables
sensor0 = random(100,199);
sensor1 = random(100,199);
sensor2 = random(100,199);
Serial.println("Send sensor data");
Serial.print("sensor0: "); Serial.println(sensor0);
Serial.print("sensor1: "); Serial.println(sensor1);
Serial.print("sensor2: "); Serial.println(sensor2);
ubidots.add("sensor0", sensor0);
ubidots.add("sensor1", sensor1);
ubidots.add("sensor2", sensor2);
ubidots.sendAll();
// Delay
delay(10000);
}
2. Once you've pasted the code, updated the WiFi parameters, and your Ubidots TOKEN, then Verify your code in the Arduino IDE. To do this, from the top left corner of the Arduino IDE choose the "Check Mark" icon to verify the code.
3. Next, Upload the code into your board. To do this, choose the "right-arrow" icon beside the check mark icon.
4. With the code uploaded to the board, the first data-point that is sent to Ubidots will automatically create a new device in your Ubidots account! Go to the Device section of your Ubidots account to find the new device created.
PRO TIP: If your device sensors are not connected, you can still visualize your device's connection and response through the Serial Monitor. To do this, in the top right corner of our Arduino IDE select the "magnifying glass" icon to display a serial monitor.
Getting data from Ubidots
Copy and paste the code below into your Arduino IDE. Then, assign the parameters required to establish the connection and communication with Ubidots Platform.
SSID, name of your WiFi network
PASS, password of your WiFi network
//--------------------------------------------------------------------
// XLR8UbidotsSimple.ino
//--------------------------------------------------------------------
// Copyright (c) 2018 Alorium Technology. All rights reserved.
// by Jason Pecor Alorium Technology
//
// This file is a simple example for using the Alorium Technology
// XLR8 development board with Ubidots.
//
// The hardware setup for this example requires SPI connection to an
// Adafruit ATWINC1500 WiFi breakout module.
//--------------------------------------------------------------------
#include <UbidotsXLR8.h>
#include <SPI.h>
#include <WiFi101.h>
WiFiClient client;
// Ubidots Token
#define TOKEN ""
char ssid[] = ""; // WiFi SSID
char pass[] = ""; // WiFi Password
Ubidots ubidots(TOKEN);
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(9600);
// Configure SPI for ATWINC Module
WiFi.setPins(8,7,4);
// Initialize and connect to Ubidots
ubidots.initialize();
ubidots.setDeviceName("sno");
ubidots.setDeviceLabel("sno");
ubidots.wifiConnection(ssid,pass);
// Create the variable to be controlled
ubidots.add("control", 0);
ubidots.sendAll();
}
void loop() {
// Get values from ubidots control widget
Serial.println("Get values");
float control = ubidots.getValueWithDeviceLabel("sno", "control");
Serial.print("control:");
Serial.println(control);
Serial.println("");
// Delay
delay(1000);
}
2. Once you've pasted the code, updated the WiFi parameters, and Ubidots TOKEN, you must then Verify this within the Arduino IDE. To do this, from the top left corner of our Arduino IDE choose the "Check Mark" icon to verify the code.
3. Next, Upload the code into your board. To do this, choose the "Right-Arrow" icon beside the check mark icon.
4. Now you're able to GET data from Ubidots! Go to the Device section of your Ubidots account to confirm the new device i automatically created with a variable called "control":
5. To start sending values from the Ubidots to your Snō device, simply create a control widget in any of your Ubidots dashboard. To add a new Control Widget, click on the "+" icon in the top right of the dashboard. For additional assistance creating a control widget, check out this Control Widget setup guide.
5.1. To create the widget for your Snō click Control > Switch > Snō > control > Finish.
Summary
In just a few minutes you have integrated the Alorium Snō board with Ubidots. You are now able to build your IoT Apps to monitor and control any system or environment. The value of data is in the decisions we make with it. Now with your Alorium device connected to and communicating with Ubidots, it's up to you to complete the solution.
Learn more about Alorium Technology at http://www.aloriumtech.com/