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.
Requirements:
Any of Seeed Studio’s SenseCap S210X Series
An active account on The Things Network
An active account on Ubidots
A cellphone running either Android or iOS with Bluetooth
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:
Turn on your cellphone’s Bluetooth and then turn on the SenseCap by pressing and holding the config button for 3 seconds:
Open the SenseCAP on your mobile device and, there, select S210X Sensor, then tap on Setup
Select your device by tapping on it:
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”
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”
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”
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
On “Ubidots Token” select "Default Token"
Click on the arrow icon to go to the next step.
Give the plugin a name and a description
Click the check icon.
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”
Search for Ubidots webhook among the different partners:
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.
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.
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...