How to use a Tektelic Industrial Sensor Node (Guide)

Greetings,

I wanted to share with the community my take on implementing the Tektelic Industrial Sensor Node

Important
Make sure when you receive your devices from Tektelic you also receive your keys that are associated with the device from the factory.

You will need to create a device profile for the devices. Here’s what worked for me:

  • LoRaWAN Mac Version: 1.0.3
  • LoRaWAN Revision: B
  • Max EIRP: 30

Decoder:

function Decode(fPort, bytes){

    var params = {
        "battery_voltage": null,
        "output_1": null,
        "output_2" : null,
        "temperature": null,
        "input_1_state": null,
        "input_2": null,
        "input_3": null,
        "input_1_count": null
    }

    for(var i = 0; i < bytes.length; i++){

        // Read Battery Voltage
        if(0x00 === bytes[i] && 0xFF === bytes[i+1]){
            params.battery_voltage = 0.01 * ((bytes[i+2] << 8) | bytes[i+3]);
            i = i+3;
        }

        // Read Output 1
        if(0x01 === bytes[i] && 0x01 === bytes[i+1]){
            if(0x00 === bytes[i+2]) {
                params.output_1 = "open";
            } else if(0xFF === bytes[i+2]) {
                params.output_1 = "closed";
            }
            i = i+2;
        }

        // Read Output 2
        if(0x02 === bytes[i] && 0x01 === bytes[i+1]){
            if(0x00 === bytes[i+2]) {
                params.output_2 = "open";
            } else if(0xFF === bytes[i+2]) {
                params.output_2 = "closed";
            }
            i = i+2;
        }

        // Read Temperature
        if(0x03 === bytes[i] && 0x67 === bytes[i+1]){
            params.temperature = (bytes[i+2]<<24>>16 | bytes[i+3]) / 10;
            i = i+3;
        }

        // Read Input 1 State
        if(0x05 === bytes[i] && 0x00 === bytes[i+1]){
            if(0x00 === bytes[i+2]) {
                params.input_1_state = false;
            } else if(0xFF === bytes[i+2]) {
                params.input_1_state = true;
            }
            i = i+2;
        }

        // Read Input 2
        if(0x06 === bytes[i] && 0x02 === bytes[i+1]){
            // 2 Bytes of data to consume
        }

        // Read Input 3
        if(0x07 === bytes[i] && 0x02 === bytes[i+1]){
            // 2 Bytes of data to consume
        }

        // Read Input 1 Count
        if(0x08 === bytes[i] && 0x04 === bytes[i+1]){
            // 2 Bytes of data to consume
        }

    }

    return params
   }

I will be updating the decoder as I progress.

Encoder (TBA)

Cheers,

Coach

2 Likes