Rapid Deployment of Industrial Outdoor Sensors with Seeed SenseCAP and Qubitro

Aug 6, 2021 4 min read
Rapid Deployment of Industrial Outdoor Sensors with Seeed SenseCAP and Qubitro

Rapid Deployment of Industrial Outdoor Sensors with Seeed SenseCAP and Qubitro

Seeed has unveiled a series of low-cost industrial grade outdoor LoRaWAN sensors called SenseCAPs. You can twist the cap off the body to have two parts, the sensor, then the body which exposes a reset button, status LED, UART, and power switch. Within the body are a big battery, antenna, and controller, which interfaces to the "cap" sensor with pogo pins. The sensor can be used for Temperature/Humidity, Barometric Pressure, light, CO2, and a long list of soil measurements.

Inside a Sensecap main section

Connect to The Things Stack

Deploying on Qubitro by using The Things Stack as a network service provider is super easy. Also, it could be easily automated if delivering a large deployment using the QR code on the side of the SenseCAP and the TTS API.

If you are already connected the device to TTS, you may skip to the next step.

Making an HTTP request to the following URI using the EUI device identifier and the key printed on the SenseCAP returns the connection details. This can be done in a browser, script, or terminal.

https://sensecap.seeed.cc/makerapi/device/view_device_info?nodeEui=DEVICE_EUI&deviceCode=DEVICE_KEY

Returns

{
  "code": "0",
  "data": {
    "nodeEui": "DEVICE_EUI",
    "deviceCode": "DEVICE_KEY",
    "lorawanInformation": {
      "dev_eui": "2CF7F12014700297",
      "app_eui": "8000000000000006",
      "app_key": "6FD0EC47CBC6E00F1921A08C2E94E8E4"
    }
  }
}

1. When adding the end device in the TTS GUI, use the manual tab selecting Over the Air Activation, and LoRaWAN Version 1.0.2, leaving the remaining defaults,

2. Then, on the second page, paste in the Application EUI and Device EUI we got from the previous HTTP request.

3. After configuring frequency information on the third page, paste the Application key we also got earlier and add the end device.

TTS details from earlier

Synchronize with Qubitro

To add this device and sensors to Qubitro and The Things Stack,

  1. Simply add Qubitro as a WebHook Integration for your Things Stack application using your Qubitro account details,
  2. Then, add the device to the application using the details retrieved above.
  3. Qubitro will be a listed option in the GUI and you just need to copy the details as shown below.
  4. Click API under the Account menu on the left menu at Qubitro Portal and paste values to the corresponding fields.
The Things Stack Qubitro Integration

Formatting Data

Turning the device on after adding it to TTS via the API or GUI will have the device appear in the Qubitro project with the ID you copied into TTS automatically.

To have the data formatted in a way Qubitro accepts make sure to go to the Uplink Payload and paste the following formatter example we provide:

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("Invalud 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,
  };
}

And that's it!

Now data should be flowing into Qubitro and you should be able to create new charts and rules around your data. Whenever you add a new device to the same project on TTS, it will be synchronized with Qubitro automatically.

That is all to deploy these SenseCAP sensors using Qubitro.

Now, you can mount the sensor outdoors using the provided mount, or maybe use the thread on the top to hang it in a factory.

More details are available in the Qubitro Docs if needed.
Great! Next, complete checkout for full access to Qubitro Blog.
Welcome back! You've successfully signed in.
You've successfully subscribed to Qubitro Blog.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info has been updated.
Your billing was not updated.