Skip to main content
All CollectionsConnect your Devices
Connect Seeed Studio’s SenseCap A1101 LoRaWAN AI Sensor to Ubidots[TTN LNS]
Connect Seeed Studio’s SenseCap A1101 LoRaWAN AI Sensor to Ubidots[TTN LNS]

This article explores how to connect Seeed Studio’s SenseCap A1101 Vision AI to Ubidots.

Sergio M avatar
Written by Sergio M
Updated over 3 months ago
image 2167.png

SenseCAP 1101 Vision AI sensor is a powerful edge device manufactured by our friend at Seeed Studio. One of its most advantageous features is that you can easily configure it by using SenseCAP Mate app, in which you can choose several different settings such as the Algorithm as well as the Model detection.

Requirements:

1. Configure the SenseCap A1101

  • Please follow the steps given in this guide’s first section: “Configure the SenseCap S2100”

  • Once done, you can come back to this guide and go further the next section

  • You can select the algorithm as well as the model that the sensors detects

  • For this article, the Object Detection algorithm was chosen and the AI model was set to Human Body Detection, however, if you want to change these settings, you can do so.


Pro Tip: You can also train your own model. Refer to the following link for more information


2. Register the SenseCap A1101 on TTN LNS

  • Please follow the steps given in this guide’s second section “Register the SenseCap S2100 on TTN LNS

  • Once done, you can come back to this guide and go further the next section

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 1.png
  • 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

8.png
  • 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 =
{
4175:"AI-detection-1",
4176:"AI-detection-2",
4177:"AI-detection-3",
4178:"AI-detection-4",
4179:"AI-detection-5",
4180:"AI-detection-6",
4181:"AI-detection-7",
4182:"AI-detection-8",
4183:"AI-detection-9",
4184:"AI-detection-10"

};

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

return ubidotsPayload;
}



module.exports = { format_payload };

The following GIF will serve as a guide:

4. Connect the Ubidots Pluging to TTN

  • Please follow the steps given in this guide’s fourth section: “Connect the Ubidots Pluging to TTN”

  • Once done, you can come back to this guide and go further the next section

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
  • Delete all the code there and paste Seeed Studio's official decoder for this specific 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.

Did this answer your question?