Skip to main content
All CollectionsConnect your Devices
Connect the SODAQ Autonomo with mDot and Ubidots
Connect the SODAQ Autonomo with mDot and Ubidots

Learn how to send multiple values to Ubidots using a SODAQ board.

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

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

  1. Download Arduino IDE here

  2. Go to Arduino IDE File -> Preferences -> Additional Board Manager URLs and add this line: “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 SODAQ SAMD boards for the Autonomo.

  4. Download the ubidots-sodaq-mdot 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.

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);
}
Did this answer your question?