SenseCAP S2100 Data Logger is a powerful edge device featuring a LoRa transceiver which allows sending data to your prefered network server supporting frequency plans such as 863MHz ~928MHz. The S2100 is able to communicate to any sensor via MODBUS-RTU RS485 as well as Analog 4~20mA/0~10V and also GPIO level/pulse sensors.

One of its most remarkable features is its capabitily to work in harsh environments, since it implements the IP66 rated enclosure, suitable for outdoor use, high UV exposure, heavy rain, dusty conditions, etc.

Requirements

Table of contents

  1. Configure the SenseCap S2100

  2. Register the SenseCap S2100 on TTN LNS

  3. Create the Ubidots plugin and decoder

  4. Connect the Ubidots pluging to TTN

  5. Configure the payload formatter

  6. Visualize the data on Ubidots

  7. Feedback, suggestions and related articles

1. Configure the SenseCap S2100

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

  • Turn on your cellphone’s Bluetooth and then set the SenseCap on Bluetooth pair mode by pressing and holding the config button for 3 seconds:

image(2) 1.png
  • Launch the SenseCap App on your mobile device.

  • Select S2100 Data Logger, then tap on Setup

Component 47.png
  • Select your device by tapping on it:

  • The following settings were adopted according to the allowed frequency for the region in which the device was configured. Visit the following link in order to get to know the regulations on your region

  • Tap on the “Settings” tab and edit the following settings according to your needs

    • Platform: The Things Network

    • Frequency Plan: US915

    • Uplink Interval (optional): 5

  • Copy the following values to be used for later (do not modify any):

    • Device EUI

    • APP EUI

    • APP Key

  • Click on “Send”

2. Register the SenseCap S2100 on TTN LNS

  • Login to your TTN console.

  • Select “Go to applications”

  • Create an application

  • Click on “+ Add end device”

4(1) 1.png
  • 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, in this case, S2100.

    • 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 which 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”


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

  • Leave the “Ubidots device type” on its default option if you wish, however, you can set any name for your device type

  • On “Ubidots Token” select "Default Token" or the token that you wish to use for this plugin

  • Click on the Arrow icon to go to the next step

  • Give the plugin a name and a description

  • Click the Check icon

image2164 1(1).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 for further steps.

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

function format_payload(args){

var messages = args["uplink_message"]["decoded_payload"]["messages"];
var ubidotsPayload = {};
var varLabelMap =
{
1:"measurement1",
2:"measurement2",
3:"measurement3",
4:"measurement4",
5:"measurement5",
6:"measurement6",
7:"measurement7",
8:"measurement8",
9:"measurement9",
10:"measurement10",
};


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

return ubidotsPayload;
}



module.exports = { format_payload };

The following GIF will serve as a guide:

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”

  • Search for Ubidots webhook among the different partners:

13 1.png

Edit the following settings:

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

webhook_settings 1.png

5. Configure the Payload Formatter

  • Go to the left panel and click on “Payload formatters”

  • Click on “Uplink”

  • Set the “Formatter type” to “Custom Javascript Formatter”

Component 48.png
  • Note: the following decoder is officially supported and mantained by Seeed Studio on their. You should copy the decoder from there in order to get the most updated version

  • Delete all the code there and paste Seeed Studio's official decoder for this device from their GitHub repository

  • Click “Save changes”

6. Visualize the Data on Ubidots

  • Head to your Ubidots Account, to the “Devices” section 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.

image

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?