Seeed SenseCAP

Seeed provides a turnkey hardware solution for basic sensing such as for CO2, temperature, humidity, light, etc which can be connected easily to Qubitro

Seeed offers sensor attachments for the cap body which include temperature and humidity, soil temperature, and moisture,

To get started with the deployment, read through the LoRaWAN device connection page to set up a TTS account and project. Once your project is created, you need to query the Seeed online service for the EUI values to copy into the TTS device creation. Start by reading off the EUI and key from the sticker on the body of the sense cap device, and paste those values within the URI below-

https://sensecap.seeed.cc/makerapi/device/view_device_info?nodeEui=paste_EUI_here&deviceCode=paste_key_here

You can visit this URI in the browser or in a curl request, for example-

curl https://sensecap.seeed.cc/makerapi/device/view_device_info?nodeEui=2CF7F12014700297&deviceCode=34BF25920A4EFBF4

Either method return a body that looks like the below example-

{
"code": "0",
"data": {
"nodeEui": "2CF7F12014700297",
"deviceCode": "34BF25920A4EFBF4",
"lorawanInformation": {
"dev_eui": "2CF7F12014700297",
"app_eui": "8000000000000006",
"app_key": "6FD0EF47CBC6E00F1921A08C2E94E8E5"
}
}
}

With those values retrieved, now we can go into the device creation wizard within the Things Stack and manually create a device that uses OTAA (Over the air activation), LoRaWAN MAC version 1.0.2, and default server setting. From there the Device and Application EUIs can be pasted on the next page, with a device name and ID of the user's digression, it is recommended to make the device ID the device EUI for Qubitro, while the name can be human-readable. From the third page, you can select the frequency plan you'd like for the device, make sure to read the Seeed getting started guide to see what frequency plans for your area work best. The last page simply requires the application EUI that was retrieved from Seeed. CO2, light, and barometric pressure. These sensors connect to the main body which houses the controller, battery, and radio which can be easily connected to any standard LoRaWAN gatewa

Once the device is added, simply twist off the sensor from the body where you will find a PCB that has a serial port, LED, button, and power switch. Simply set the switch to the on position and the LED will blink, after a moment assuming you are near a valid gateway connected to the TTS service the LED will blink twice.

Inside a sensecap main section

Now you should be able to see data coming into the live data section of the TTS application, however, it will just be an array of bytes being showing in a hexadecimal format, in order to translate to a JSON document that Qubitro can understand we must set an uplink payload formatter for the project or device. You can find the formatter for the project in the sidebar, or for the device in the payload formatting section. Just paste the below javascript in the code section after selecting Javascript for an option-

function decodeUplink(input) {
var data = {};
var errors = [];
let index = 0;
while(input.bytes.length - index > 6) {
let channel = input.bytes[0+index];
if(channel > 2){
errors.push("Invalid channel "+channel.toString());
break;
}
let data_type = (input.bytes[1+index] << 8) | input.bytes[2+index];
let value = ((input.bytes[3+index] << 0) | (input.bytes[4+index] << 8) | (input.bytes[5+index] << 16) | (input.bytes[6+index] << 24));
switch (data_type) {
case 0x0700:
data.battery = value & 0xFFFF;
break;
case 0x0110:
data.temp = value/ 1000;
break;
case 0x0210:
data.humidity = value/ 1000;
break;
case 0x0310:
data.light = value/ 1000;
break;
case 0x0410:
data.co2_ppm = value/ 1000;
break;
case 0x0510:
data.baro_pressure = value / 1000;
break;
case 0x0610:
data.soil_temp = value/ 1000;
break;
case 0x0710:
data.soil_moisture = value/ 1000;
break;
default:
errors.push("0x"+data_type.toString(16) + " not a valid sensor value");
}
index += 7;
}
return {
data: data,
warnings: [],
errors: errors,
};
}

After setting the formatter, now within the live data section, you should be able to see a document appear every hour which is similar to the following, some packets will not be decoded since they are related to the system for the Seeed monitoring service and we will be discarding these.

SenseCAP data

Make sure to add the Qubitro integration as shown in the LoRaWAN parent section in order to see the data and create some nice charts. The device will automatically appear in the console with the data the sensor sends, and you can feel free to give it a human-readable name as discussed earlier.

Qubitro Device Page