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.
The MultiConnect® mDot™ is a LoRaWAN™ ready module with an Xbee form-factor, capable of 2-way communication over distances in excess of 10 miles / 16 km outdoors.
Here you will learn how to use your Multiconnect mDot with SODAQ Autonomo and Ubidots with our library.
Requirements
To be able to see the data streamed by the mDot you will need a LoRa gateway. Check out our LoRa MultiTech MultiConnect Conduit tutorial here
Setup
Download Arduino IDE here
Go to Arduino IDE File -> Preferences -> Additional Board Manager URLs and add this line: “http://downloads.sodaq.net/package_sodaq_index.json”.
Open the Boards Manager via Tools -> Board -> Boards Manager and search for SODAQ boards, then select SODAQ SAMD boards for the Autonomo.
Download the ubidots-sodaq-mdot library here
Go to the Arduino IDE, click on Sketch -> Include Library -> Add .ZIP Library
Select the downloaded .ZIP file and then click on “Accept” or “Choose”
Close the Arduino IDE and open it again.
Send one value to Ubidots
The next example explain how to send a Temperature value from SODAQ Autonomo + Multiconnect mDot to Multitech Multiconnect Conduit. Please don’t forget to change your GATEWAY_SSID, GATEWAY_PASS and GATEWAY_SUB_BAND.
#include <SODAQMdot.h>
// Put here your SSID of LoRa gateway
#define GATEWAY_SSID "Your_Lora_Gateway_SSID"
// Put here your PASS of LoRa gateway
#define GATEWAY_PASS "Your_Lora_Gateway_PASS"
// Put here the frequency sub-band of the LoRa gateway
#define GATEWAY_SUB_BAND "1"
Ubidots loraClient;
void setup()
{
// The code will not start unless the serial monitor is opened or 10 sec have passed
// in case you want to operate the Autonomo with an external power source
while ((!SerialUSB) && (millis() < 10000))
;
SerialUSB.begin(115200);
SerialUSB.println("Here we start !! ");
Serial1.begin(115200);
loraClient.setOnBee(BEE_VCC, BEEDTR, BEECTS);
while(!loraClient.loraConnection(GATEWAY_SSID, GATEWAY_PASS, GATEWAY_SUB_BAND));
}
void loop() {
float value = analogRead(A0);
loraClient.add("Temperature", value);
loraClient.loraSend();
delay(1000);
}
Send multiple values to Ubidots
The next example explain how to send Temperature, Humidity, Heat Index and Wind speed from SODAQ Autonomo + Multiconnect mDot to your Multitech Multiconnect Conduit. Please don’t forget to change your GATEWAY_SSID, GATEWAY_PASS and GATEWAY_SUB_BAND.
#include <SODAQMdot.h>
// Put here your SSID of LoRa gateway
#define GATEWAY_SSID "Your_Lora_Gateway_SSID"
// Put here your PASS of LoRa gateway
#define GATEWAY_PASS "Your_Lora_Gateway_PASS"
// Put here the frequency sub-band of the LoRa gateway
#define GATEWAY_SUB_BAND "1"
Ubidots loraClient;
void setup()
{
// The code will not start unless the serial monitor is opened or 10 sec have passed
// in case you want to operate the Autonomo with an external power source
while ((!SerialUSB) && (millis() < 10000))
;
SerialUSB.begin(115200);
SerialUSB.println("Here we start !! ");
Serial1.begin(115200);
loraClient.setOnBee(BEE_VCC, BEEDTR, BEECTS);
while(!loraClient.loraConnection(GATEWAY_SSID, GATEWAY_PASS, GATEWAY_SUB_BAND));
}
void loop() {
float value0 = analogRead(A0);
float value1 = analogRead(A1);
float value2 = analogRead(A2);
float value3 = analogRead(A3);
loraClient.add("Temperature",value0);
loraClient.add("Humidity",value1);
loraClient.add("Heat Index",value2);
loraClient.add("Wind speed",value3);
loraClient.loraSend();
delay(1000);
}