Skip to main content
All CollectionsConnect your Devices
Connect Seeed Studio SenseCAP T1000-x LoRaWAN tracker to Ubidots[TTS LNS]
Connect Seeed Studio SenseCAP T1000-x LoRaWAN tracker to Ubidots[TTS LNS]

This article will illustrate the process of connecting the T1000-x tracker to Ubidots through the TTS LNS

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

Requirements

  • An Ubidots active account

  • An active account in the TTS console

  • An cellphone supporting either Google Play Store or AppStore as well as Bluetooth.

1. Install SenseCAP Mate app and configure the tracker

Scan the following QR code. It will take you to Seeed Studio's SenseCAP Mate app official download page.

Once it is installed, enable the Bluetooth on your cellphone and launch the app. If you don't have an account already, you will have to register to use the app.

After that, press and hold the tracker's button for at least 3 seconds or until the LED starts flashing. Then, from the list of devices, select Tracker T1000

Tap on your device:

Go to the settings tab and then LoRa tab. There select as platform Helium and select the Frequency plan according to your requirements, also, make sure to copy the Device EUI, APP EUI and APP Key for you are going to need it in later steps. Once finished, tap the Send button to save the settings.

2. Register the tracker on TTS LNS

Login to your TTN console and go to your applications, then, either create or select the application in which you wish to place the device and click on +Add end device:

4(1) 1.png

Select Enter end device specifics manually under the Input method section and then select the settings such as Frequency plan, LoRaWAN version, etc according to your setup/requirements.

After filling in the JoinEUI( formerly APPEUI) a few other fields will be displayed. Fill their required info and then click the Register end device button:

After completing this step, your device will be already registered on TTS LNS.

3. Configure the Payload formatter

Go to Payload formatters->Uplink. Then, in the drop-down menu labeled Formatter type select Custom Javascript formatter and paste the official decoder for this device provided by Seeed Studio. After pasting the decoder, scroll down and hit the Save changes button.

4. Create the Ubidots Plugin and Decoder

Go to your Ubidots account in the Devices section and click on Plugins, then create a new The Things Stack plugin:

Fill in the required fields for creating the plugin such as the Ubidots device type and the Ubidots Token. Once created the plugin, go to the decoder section, delete all the code and replace it for the following:

const HOTSPOT_INFO = false;

function handleErrorIfExists(data){
const error = 'error' in data;
if (error) {
const errorMsg = { "error": { "value": data.errorCode, "context" : { "reason": data.error } } };
return errorMsg;
}
return false;
}

function addLat(lat, ubidotsPayload){
ubidotsPayload.position.context.lat = lat;
}

function addLng(lng, ubidotsPayload){
ubidotsPayload.position.context.lng = lng;
}

const coordinateActions = {
"Longitude": addLng,
"Latitude": addLat,
}

const assignPayloadKeys = (data, ubidotsPayload) => {
const { type, measurementValue } = data;

if (type === "Longitude" || type === "Latitude") {
if (!ubidotsPayload.position) {
ubidotsPayload.position = { "value": 1, "context": { "lat": undefined, "lng": undefined } };
}
coordinateActions[type](measurementValue, ubidotsPayload);
}
else if (data.type === "Timestamp") {
ubidotsPayload.timestamp = data.measurementValue;
}
else {
ubidotsPayload[type] = measurementValue;
}
};

function buildUbidotsPayload(data){
const ubidotsPayload = {};
data.forEach(innerData => {
innerData.forEach(innerInnerData => {
assignPayloadKeys(innerInnerData, ubidotsPayload);
});
});
return ubidotsPayload;
}

async function formatPayload(args){

const data = args.uplink_message.decoded_payload.messages;
let ubidotsPayload = {};

const error = handleErrorIfExists(data[0][0]);
if (error) return error;

if (HOTSPOT_INFO) {
const { hotspots, port, fcnt } = args;
const { snr, rssi } = hotspots[0];
Object.assign(ubidotsPayload, { SNR: snr, RSSI: rssi, port, 'Frame Counter': fcnt });
}
ubidotsPayload = buildUbidotsPayload(data);
console.log(ubidotsPayload);
return ubidotsPayload;
};

module.exports = { formatPayload };

5. Connect the integration to Ubidots

Go to the application created on TTN, and click Integrations at the left side of the screen. Then, click on Webhooks and then +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

After completing this step, data should be arriving into the Ubidots plugin as well as the device.

Did this answer your question?