Skip to content

BRT38 Pull-rope Displacement Sensor Integration

Model catalog

Search for these models in ThinkLink by name or ID.

Model typeNameid_namePlatform model ID
RPC[BRT38 GET] 22114brt38_get_22114130690456718569472
RPC[BRT38 SET] 22114brt38_set_22114130690455674187776
TemplateBRT38BRT38_22114130673399658606592
Thing Model[BRT38]brt38_22114130673398912020480
Parameter Thing Model[BRT38-PARA]brt38_para_22114130690453296017408

EdgeBus code

This is the original EdgeBus code used by the device.

typescript
import { Buffer } from "buffer";
import { buildOtaFile } from "@EBSDK/run";
import { EBModel } from "@EBSDK/EBCompiler/EBModel/EBModel";
import { EventInfoItem } from "@EBSDK/EBCompiler/plugins/EBHelper";
import type { UserConfUPItem } from "@EBSDK/EBCompiler/plugins/EBHelper";
import { CheckbitEnum, getOtaConfig } from "@EBSDK/otaConfig";

// BRITER BRT38 RS485/Modbus-RTU.
// The BRT38 requires separate FC03 windows for encoder value, turn count,
// and single-turn value. In particular, 0x0000 may only be read with count 2.
// 0x0020-0x0021: signed angular-velocity raw value.
const eventInfo: UserConfUPItem[] = [
  {
    name: "briter-brt38",
    port: 22,
    version: "0x88",
    dataType: "0x02",
    upPeriodIndex: 70,
    quInfo: [
      {
        protocol: "modbus",
        addr: "0x01",
        code: "0x03",
        periodIndex: 70,
        indexAPP: 150,
        indexCMD: 0,
        copySize: 1,
        isLast: false,
        listVal: [{ start: "0x0000", end: "0x0001" }],
      },
      {
        protocol: "modbus",
        addr: "0x01",
        code: "0x03",
        periodIndex: 70,
        indexAPP: 150,
        indexCMD: 0,
        copySize: 1,
        isLast: false,
        listVal: [{ start: "0x0002", end: "0x0002" }],
      },
      {
        protocol: "modbus",
        addr: "0x01",
        code: "0x03",
        periodIndex: 70,
        indexAPP: 150,
        indexCMD: 0,
        copySize: 1,
        isLast: false,
        listVal: [{ start: "0x0003", end: "0x0003" }],
      },
      {
        protocol: "modbus",
        addr: "0x01",
        code: "0x03",
        periodIndex: 70,
        indexAPP: 150,
        indexCMD: 0,
        copySize: 1,
        isLast: true,
        listVal: [{ start: "0x0020", end: "0x0021" }],
      },
    ],
  },
];

const otaConfig = getOtaConfig({
  BaudRate: 9600,
  StopBits: 1,
  DataBits: 8,
  Checkbit: CheckbitEnum.NONE,
  Battery: true,
  ConfirmDuty: 60,
  BzType: 22114,
  BzVersion: 2,
});

const MODBUS_TT = (ebModel: EBModel) => {
  for (const info of eventInfo) {
    const event = new EventInfoItem(info);
    event.upEventSetup();
    event.eventInstall();
  }
  return JSON.stringify(ebModel, null, 2);
};

buildOtaFile(import.meta.url, otaConfig, MODBUS_TT);

This project connects a BRITER BRT38 RS485 pull-rope displacement sensor to ThinkLink through a KC21. The default serial settings are Modbus address 1 and 9600/8N1. The KC21 runs in battery, LoRaWAN Class A mode.

Wiring

  • Red: 5–24 VDC positive; black: GND.
  • White: RS485-A; green: RS485-B.
  • Yellow: zero input; this integration does not drive it.

Telemetry

The model reports encoder value, turn count, single-turn value, signed angular-velocity raw value, KC21 battery voltage, RSSI and SNR. Millimetres and angular degrees require the exact SKU's wheel circumference, resolution and zero baseline, so they are intentionally not derived yet.

Parameter configuration

The project includes the brt38_para_22114 parameter model and the brt38_set_22114 / brt38_get_22114 RPC pair. They configure the KC21 shared collect/upload period (default 900s) and Modbus polling address (default 1). Period updates also retain a 100ms power-on delay and an 86400s heartbeat. The template includes the UART-setting RPC for the default 9600 baud, 8 data bits, one stop bit and no parity.

The Modbus address parameter only changes the slave address polled by the KC21; it does not write a BRT38 address register. Sensor-side zeroing, direction, current-value and address writes remain unavailable.

Deployment and commissioning

Publish the thing model and template to PUBLIC, and the EdgeBus source/firmware to sx. Commission with KC21 6353012b00039567: read the app parameters, set and read back period_up=900, addr_modbus=1, pwron_delay=100 and period_heart=86400. All four Set RPC fields prefill their current shared_attrs values. Then probe FC03 using four separate windows: 0x0000 (2 registers), 0x0002 (1), 0x0003 (1), and 0x0020 (2). The 0x0000 request must not be expanded to four registers. Finally verify that 22114/V2 business telemetry keeps advancing.

If the sensor does not answer, check sensor power, A/B polarity, address 1 and 9600/8N1. Do not send zeroing or address-changing commands without explicit on-site confirmation.