All Collections
Connect your Devices
Connect Seeed Studio’s SenseCap S210X Series to Ubidots [TTN LNS]
Connect Seeed Studio’s SenseCap S210X Series to Ubidots [TTN LNS]

This article explores how to connect any of Seeed Studio’s SenseCap S210X series LoRaWAN sensors to Ubidots using The Things Network LNS.

Sergio M avatar
Written by Sergio M
Updated over a week ago

SenseCap S210X is a powerfull line of sensors with built-in Bluetooth and LoRaWAN interface, specially meant for outdoors applications such as agriculture, smart cities, among many others. This series is composed by the following devices:

This guide applies to any of the 5 devices in the S210X series.

image.png

Requirements:

Table of Contents

1. Configure the SenseCap S210X

  • Install the SenseCAP mobile application by searching “SenseCAP Mate” on your device’s application store or by scanning the following QR code:

image.png
  • Turn on your cellphone’s Bluetooth and then turn on the SenseCap by pressing and holding the config button for 3 seconds:

image.png
  • Open the SenseCAP on your mobile device and, there, select S210X Sensor, then tap on Setup

1.png
  • Select your device by tapping on it:

2.png

The following settings depend on your region, e.g. if you are located on Europe you should select EU_863, if you are located on India, you should choose IN_865. In the following link you can find out more about each country allowed band and it's regulations. This guide was developed in a country where the US_902_915 band is the allowed, but remember to change these settings according to your region.

  • Tap on the “Settings” tab and edit the following settings:

    • Platform: The Things Network

    • Frequency Plan: US915

    • Uplink Interval (optional): 5

  • Copy the following values (do not modify any). We'll use them later:

    • Device EUI

    • APP EUI

    • APP Key

  • Click on “Send”

3.png

2. Register the SenseCap S210X on TTN LNS

  • Log into your TTN console.

  • Select “Go to applications”

  • Create an application

  • Click on “+ Add end device”

4.png

In the following settings, remember to select the band according to your region as mentioned in the first section.

  • Click on “From The LoRaWAN Device Repository” and edit the following settings:

    • Brand: SenseCap

    • Model: choose the one according to the device you are currently using

    • Hardware Version: leave the default option

    • Firmware Version: leave the default option

    • Profile (Region): US_902_928

  • Scroll down to “Enter registration data” and there edit the following settings:

    • Frequency Plan: United States 902-928 MHz, FSB 2 (used by TTN)

    • End device ID: set a meaningful name such as “sensecap-humidity-sensor” or something you are familiar with.

  • Paste the previously saved DEV EUI, APP EUI and APP Key on the corresponding fields

  • Scroll down and click on “Register end device”

11.png


Pro Tip: If your device does not start to send data inmediatly, press and release the config button on your SenseCap.


3. Create the Ubidots Plugin and Decoder

  • Go to your Ubidots account on the “Devices” tab and click “Plugins”

  • Create a new “The Things Stack” plugin

7.png
  • Leave the “Ubidots device type” on its default option

  • On “Ubidots Token” select "Default Token"

  • Click on the arrow icon to go to the next step.

8.png
  • Give the plugin a name and a description

  • Click the check icon.

image2164.png
  • Click on the recently created plugin to navigate to its options.

  • Search for the “Decoder” tab and copy the “HTTPs Endpoint URL”. This will be needed later.

  • Scroll down to the “Decoding Function” section and paste the following code on the text field:

async function formatPayload(args){

var messages = args["uplink_message"]["decoded_payload"]["messages"];
var ubidotsPayload = {};
var varLabelMap =
{
4097:"air-temperature",
4098:"air-humidity",
4099:"light-intensity",
4100:"CO2-concentration",
4102:"soil-temperature",
4103:"soil-humidity",
4108:"soil-electrical-conductivity",
};

messages.forEach(msg => {
if (msg.hasOwnProperty("measurementId")) {
ubidotsPayload[varLabelMap[msg.measurementId]] = msg["measurementValue"];
}
});

return ubidotsPayload;
}


module.exports = { formatPayload };

The following GIF will serve as a guide:copy

4. Connect the Ubidots Pluging to TTN

  • Go to your TTN console.

  • Go to the application created on step 2 of this guide.

  • On the left side of the screen, look for “integrations” and click on it

  • Click on “Webhooks”

  • Click on “+ Add webhook”

9.png
  • Search for Ubidots webhook among the different partners:

13.png
  • Edit the following settings:

    • Webhook ID: set a meaningful name, it should be only lower case

    • Plugin ID: It is the last portion of your Ubidots plugin’s “HTTPs Endpoint URL” after the “/”. E.g., if your endpoint’s URL is https://dataplugin.ubidots.com/api/web-hook/lN4s2dlb4IgPgpp4Xeoq02stXcE=” then your plugin ID is just “lN4s2dlb4IgPgpp4Xeoq02stXcE=”

    • Ubidots Token: your Ubidots Token.

  • Scroll down to the “Create Ubidots webhook” button and click on it.

image3504.png

5. Configure the Payload Formatter

  • The payload formatter is chosen by default by TTN for the selected SenseCap device and is provided by Seeed Studio in the following link. You can check this by going to your device’s “Payload formatters” tab and then checking that the “Formatter type” is set to “Use Device Repository formatters”, however, if you want to check out the decoder on its official page, you can do so by going to the GitHub repository, where it is sure to be updated.

image2642.png

6. Visualize the Data on Ubidots

  • Head to the “Devices” section on your Ubidots account and you’ll be able to see a newly create device with the same name as you used for “End device ID” at step 2. Here you can check an example.

7. Feedback, Suggestion and Related Articles

Feel free to post questions or suggestions in our community portal, or contact us via support@ubidots.com.


Other users also found helpful...

Did this answer your question?