Link Search Menu Expand Document

Seedstudio - SenseCap-S2102

The SenseCap S2102 is a LoRaWAN indoor/outdoor sensor to measure light intensity in lux.


Table of contents

  1. Specifications
  2. Documents/Links
  3. Ordering Info
  4. Device specific Information
    1. LED States
  5. Adding the Device to TTN
  6. Payload formatter

Specifications

  • indoor/outdoor device
  • Price ca. CHF 75.- (09.08.2023)
  • Sensors
    • Light Intensity, 0 … 16’000 [lux], ± 5 %, Resolution 1 lux
  • Power Supply: 1 Li-SOCl2, ER34615, 3.6V, 19’000 mAh
    • Expected life time: depending on usage, 5 … 10 years
  • LoRaWAN version: 1.0.3
  • LoRaWAN device class: A
  • Protection: IP66
  • Operating Temperature: 0 … +50 °C ( Effective measurement range of CO2)
  • Size: 184.2 × 63 × 63.7 mm
  • Weight: 457 g


Ordering Info


Device specific Information

LED States

2-in-1 Configuration Button and LED

ActionDescriptionGreen LED Status
First power up, press and hold for 3sPower on and activate the BluetoothLED flashes at 1s frequency, waiting for Bluetooth connection. If Bluetooth not connected within 1 minute, the device will shut downagain
Press onceReboot device and join LoRa network1. The LEDw ill be onfor 5 seconds for initialization
2. Waiting to joinLoRa network: breathing light flashing
3. Join LoRa network success: LED flashes fast for 2s
4. LoRa network joinfailure: LEDsuddenlystop.
Press and hold for 3sActivate Bluetooth again1. Waiting for Bluetooth connection: LEDflashes at 1s frequency
2. Enter configurationmode after Bluetooth connection is successful: LED flashes at 2s frequency

If Bluetooth is not connected within 1 minute, the device will reboot and join Lora network.
Press and hold for 9sPower offIn the 3rd seconds will start flashing at 1s frequency, until the light is steady on, release the button, the light will go out.

Note
After power off, you need to reconfigure the frequency band. Power off is recommended when not deployed.


Adding the Device to TTN

  • Configure the device via Bluetooth with the SenseCAP Mate App. See User Guide chapter 5.2 for details
  • Copy the JoinEUI, App EUI and the DevEUI and send it from the smartphone via E-Mail to your computer.
  • Before a device can communicate via “The Things Network” we have to add it to an application.
  1. Create a new application
  2. Under Overview click (+) Register device
  3. Under Input method select Select the end device in the LoRaWAN Device Repository
  4. Enter the following device information
    • End device brand select SenseCAP
    • Model select SenseCAP S2102...
    • Hardware Ver. select 1.0 or whatever is possible or on the sticker
    • Firmware select 1.0 or whatever is possible or on the sticker
      • Profile (Region) select EU_863_870
  5. Under Frequency plan select Europe 863-870 Mhz (SF9 for RX2 - recommended)
  6. Under JoinEUI enter the App EUI from the App
  7. Enter as well the DevEUI and the AppKey from the sticker
  8. Set an end-device name
  9. Press Register end device
  10. Switch on the device
  • After Configuration, the device restarts automatically and tries to join the network
  • Now the device should join the network and you can see the incoming telegrams in the Live data section
  • The payload formatter should already be preset. If not, you can copy/paste it from below

Payload formatter

function hexToDec(hex) {
    return parseInt(hex, 16);
}

function isObjectEmpty(objectName) {
    return Object.keys(objectName).length === 0;
}

function stringToHex(str) {
    var result = '';
    for (var i = 0; i < str.length; i++) {
        result += str.charCodeAt(i).toString(16);
    }
    return result;
}

function bytes2HexString(arrBytes) {
    var str = '';
    for (var i = 0; i < arrBytes.length; i++) {
        var tmp;
        var num = arrBytes[i];
        if (num < 0) {
            tmp = (255 + num + 1).toString(16);
        } else {
            tmp = num.toString(16);
        }
        if (tmp.length === 1) {
            tmp = '0' + tmp;
        }
        str += tmp;
    }
    return str;
}

function decodeUplink(input) {
    try {
        var bytes = input['bytes'];
        let payload_raw = bytes2HexString(bytes).toUpperCase();
        var decoded = {};
        let payload = "";

        // Brightness
        if (payload_raw.includes("010310")) {
            payload = payload_raw.split('010310')[1];
            if (payload.length > 8) {
                if (payload.includes('0700')) {
                    payload = payload.split('0700')[0];
                }
            }
            payload = payload.substring(0, Math.min(payload.length, 8));
            payload = payload.match(/[a-fA-F0-9]{2}/g).reverse().join('');
            decoded.brgt_lux = Number(hexToDec(payload)) / 1000;
        }

        // Battery
        if (payload_raw.includes("000700") && payload_raw.length > 18) {
            payload = payload_raw.split('000700')[1];
            payload = payload.substring(0, 4);
            payload = payload.match(/[a-fA-F0-9]{2}/g).reverse().join('');
            decoded.battery_perc = Number(hexToDec(payload));
        }

        return { data: decoded };
    } catch (e) {
        // Handle error appropriately if needed
        return { data: null, error: e.message };
    }
}