Skip to content

Device Model: BGT-SMPS

Model catalog

Search for these models in ThinkLink by name or ID.

Model typeNameid_namePlatform model ID
RPC[BGT-SMPS GET] parabgt_smps_get_25101102256370513874949
RPC[BGT-SMPS SET] parabgt_smps_set_25101102256081450831877
TemplateBGT-SMPS-25101102256727507865605
Thing Model[BGT-SMPS]bgt_smps_25101102254589725642757
Thing Model[BGT-25101-BGT-SMPS资产] 区域聚合bgt_smps_asset_25101119677174411063296
Parameter Thing Model[BGT-SMPS-PARA]bgt_smps_para_25101102255300635004933

Template Name: BGT-SMPS-25101
Business Code: 25101

1. Sensor Introduction

BGT-SMPS is a multi-in-one soil parameter sensor developed by GXHY / Beijing Guoxinhuayuan Technology Co., Ltd. It supports the collection of soil temperature, soil moisture, soil EC, soil salinity, soil nitrogen, soil phosphorus, soil potassium, soil pH, and other parameters.

The sensor uses an RS-485 interface and communicates through the standard Modbus-RTU protocol. The default address is 01, and the default communication parameters are 9600, 8N1. The sensor can be directly inserted into or buried in soil, making it suitable for agriculture, environmental monitoring, greenhouses, soil testing, and other scenarios.

In this integration solution, BGT-SMPS is connected to the platform through KC21 + EdgeBus + LoRaWAN + ThinkLink. KC21 reads the Modbus data from the sensor through RS-485 and then reports the data to the ThinkLink platform via LoRaWAN.

2. Product Features

FeatureDescription
Multi-parameter integrationSupports soil temperature, moisture, EC, salinity, nitrogen, phosphorus, potassium, pH, and other parameters
Modbus-RTU communicationStandard RS-485 / Modbus-RTU protocol, easy to connect to data collectors
High measurement accuracyHigh measurement accuracy for temperature, moisture, EC, pH, and other parameters
Fast responseShort stabilization time after power-on, enabling fast data collection
Good protection performanceEpoxy resin sealing, waterproof rating IP68
Corrosion-resistant probeProbe material: 316L stainless steel
Suitable for buried installationThe probe can be fully inserted into soil, or the entire device can be buried in soil

3. Application Scope

BGT-SMPS is suitable for the following scenarios:

Application ScenarioDescription
Water-saving agricultural irrigationMonitors soil temperature, moisture, and fertility parameters for irrigation strategy optimization
Meteorological monitoringWorks with agricultural weather stations for soil environment monitoring
Environmental monitoringUsed for soil environment data collection
GreenhousesMonitors crop root-zone environmental parameters
Flower and vegetable cultivationUsed for refined planting management
Grassland and pastureMonitors soil moisture and nutrient status
Rapid soil testingQuickly obtains multi-parameter soil data on site
Scientific experimentsUsed for data collection in agriculture, ecology, soil, and related experiments

4. Collector Information

4.1 Hardware Information

ItemContent
Collector modelKC21
Communication methodLoRaWAN
Sensor interfaceRS-485
Collection protocolModbus-RTU
Power supplyBattery powered
Peripheral power supplyKC21 provides approximately 15.1 V to the sensor
Business code25101
Template nameBGT-SMPS-25101
Number of collected devicesSupports 3 soil sensors by default
Sensor address configurationAddresses are stored in APP parameter areas 150, 151, and 152
Period configurationPeriod parameters are 70, 74, and 78 respectively

4.2 Wiring Information

Power and Communication Interface

The BGT-SMPS sensor uses a 4-core cable. The wiring definition is as follows:

Wire ColorDefinitionDescription
RedPower+DC 9–24 V / the newer manual specifies DC 5–24 V
BlackGNDPower negative
YellowRS485_ARS-485 A
GreenRS485_BRS-485 B

In this solution:

KC21 SideBGT-SMPS Side
Peripheral power output +Red wire Power+
GNDBlack wire GND
RS485 AYellow wire RS485_A
RS485 BGreen wire RS485_B

Sensor Interface

ItemContent
Interface typeRS-485
Communication protocolModbus-RTU
Default address0x01
Baud rate9600
Data bits8
Stop bits1
ParityNone

5. Data Collection

In this solution, the following registers are read through Modbus:

ParameterModbus Register AddressPLC AddressData TypeDescription
Soil temperature0x000040001int161 decimal place; negative values use two’s complement
Soil moisture0x000140002uint161 decimal place, 0–100%
Soil EC0x000240003uint16No decimal places, unit: μS/cm
Soil salinity0x000340004uint16No decimal places, unit: mg/L
Soil nitrogen0x000440005uint16No decimal places, unit: mg/kg
Soil phosphorus0x000540006uint16No decimal places, unit: mg/kg
Soil potassium0x000640007uint16No decimal places, unit: mg/kg
Soil pH0x000740008uint162 decimal places

Example sensor read command:

latex
01 03 00 00 00 08 44 0C

Meaning:

ByteContentDescription
01Slave addressDefault address 1
03Function codeRead holding registers
00 00Start registerStarts from 0x0000
00 08Number of registersReads 8 consecutive registers
44 0CCRC16Modbus CRC check

5.1 Register Definition

No.Parameter NameField NameUnitIndexTypeCoefficientDecimal Places
1Soil temperaturesoil_temperature6int16be0.11
2Soil moisturesoil_moisture%8uint16be0.11
3Soil ECsoil_ecμS/cm10uint16be10
4Soil salinitysoil_salinitymg/L12uint16be10
5Soil nitrogensoil_nitrogenmg/kg10uint16be0.0883
6Soil phosphorussoil_phosphorusmg/kg10uint16be0.0443
7Soil potassiumsoil_potassiummg/kg10uint16be0.0663
8Soil pHsoil_phpH20uint16be0.012

Note: In this project’s thing model, the soil nitrogen, phosphorus, and potassium fields use the EC data position index: 10 and are calculated through coefficients: 0.55 × 0.16, 0.55 × 0.08, and 0.55 × 0.12, respectively.

5.2 Status Bit Definition

No separate sensor status bit is defined in this solution.

The thing model script handles collection timeout status as follows:

javascript
if((tdata?.status&0x02)===0x02) {
    const status=tdata.status
    tdata={ ...(device.telemetry_data?.[thingModelId] ?? {})}
    tdata.status=status
}

Logic description:

Status BitMeaningProcessing Method
status & 0x02Collection timeout / time outKeep the original telemetry data and only update the status value

6. EdgeBus Model

This device itself is not a LoRaWAN sensor. It is an RS-485 / Modbus-RTU sensor, so the built-in EdgeBus of KC21 is required to execute Modbus collection logic.

In this solution, EdgeBus is configured with 3 sensor channels by default:

ChannelPeriod Parameter IndexAddress Parameter Index
Channel 170150
Channel 274151
Channel 378152

6.1 EB Configuration Parameters

ParameterValue
SwVersion31
BaudRate9600
StopBits1
DataBits8
CheckbitNONE
Batterytrue
ConfirmDuty60
BzType25101
BzVersion11
LoRaWAN Port22
version0x88
dataType0x01
ProtocolModbus
Modbus function code0x03
Default sensor addressRead from APP parameter area
APP address parameters150, 151, 152
Query period parameters70, 74, 78

6.2 EB Code

typescript
import {Buffer} from "buffer";
import {buildOtaFile} from "@EBSDK/run";
import {LoraUpEvent} from "@EBSDK/EBCompiler/all_variable";
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, HwTypeEnum} from "@EBSDK/otaConfig";
////////////////////////////////////////////////////////////////////////////////////////
let eventInfo: UserConfUPItem[] = [];
let otaConfig = getOtaConfig({
    SwVersion:31,
    BaudRate: 9600,
    StopBits: 1,
    DataBits: 8,
    Checkbit: CheckbitEnum.NONE,
    Battery: true,
    ConfirmDuty: 60,
    BzType: 25101,
    BzVersion: 11
})
for(let i=0;i<3;i++) {
    let userConf:UserConfUPItem={
        name: "BGT_SMPS_6CH", version: "0x88",dataType: "0x01", port: 22,  upPeriod: "10y",
        quInfo: [
            {
                protocol: "modbus", addr: "0x01", code: "0x03", periodIndex: 70,
                indexAPP: 150, indexCMD: 0, copySize: 1,
                isLast:true,
                listVal: [
                    { start: "0", end: "7" }
                ]
            }
        ]
    }
    userConf.name="BGT_SMPS_6CH_"+i.toString();
    userConf.quInfo[0].periodIndex=70+i*4
    userConf.quInfo[0].indexAPP = 150+i;
    eventInfo.push(userConf)
}
const MODBUS_TT = (ebModel: EBModel) => {
    for (let i=0; i<eventInfo.length; i++){
        let event=new EventInfoItem(eventInfo[i]);
        event.upEventSetup()
        event.eventInstall()
    }
    return JSON.stringify(ebModel, null, 2)
}
buildOtaFile(import.meta.url, otaConfig, MODBUS_TT)

6.3 Description

Current EB logic description:

  1. KC21 connects to the BGT-SMPS soil multi-parameter sensor through RS-485.
  2. EdgeBus uses the Modbus-RTU protocol to read sensor data.
  3. Three collection events are generated by default, corresponding to 3 sensor channels.
  4. The 485 address of each sensor is read from the APP parameter area:
    • Channel 1: app_150
    • Channel 2: app_151
    • Channel 3: app_152
  5. The collection period of each sensor is controlled by the following parameters:
    • Channel 1: app_70
    • Channel 2: app_74
    • Channel 3: app_78
  6. Each collection uses Modbus function code 0x03 to read 8 consecutive registers.
  7. Uplink uses LoRaWAN port 22. The frame header tags are:
    • 0x88
    • 0x01
  8. The value at subDevice.index = 5 in the uplink data is used to distinguish different sub-devices / sensors.

7. Thing Model

7.1 Basic Thing Model Information

ItemContent
Thing model nameBGT-SMPS-25101
Template nameBGT-SMPS-25101
Business code25101
Device typeMulti-in-one soil sensor
Communication methodKC21 + LoRaWAN
Uplink port22
Data length22
Parse RSSIYes
Parse battery voltageYes, battery: 4
Sub-device identificationindex: 5, type: uint8
Uplink frame identifier0x88 0x01
Byte IndexContentDescription
00x88Business version / frame identifier
10x01Data type
4batteryBattery voltage field
5subDeviceSub-device number
6–7soil_temperatureSoil temperature
8–9soil_moistureSoil moisture
10–11soil_ecSoil EC
12–13soil_salinitySoil salinity
20–21soil_phSoil pH

Note: According to the provided thing model script, soil nitrogen, phosphorus, and potassium are all calculated based on the data at index: 10 using different conversion coefficients.

7.3 Thing Model Script

javascript
let port = msg?.userdata?.port || null;
if(port != 22) return null

let frameInfo = {
    port: 22,
    dataLen: 22,
    rssi: true,
    battery: 4,
    subDevice: { index: 5, type: "uint8" },
    tagList: [
        { index: 0, tag: 0x88 },
        { index: 1, tag: 0x01 }
    ]
};

let appInfo = [
    { name: "Soil Temperature", field_name: "soil_temperature", unit: "℃", index: 6, type: "int16be", coefficient: 0.1, decimal: 1 },
    { name: "Soil Moisture", field_name: "soil_moisture", unit: "%", index: 8, type: "uint16be", coefficient: 0.1, decimal: 1 },
    { name: "Soil EC", field_name: "soil_ec", unit: "μS/cm", index: 10, type: "uint16be", coefficient: 1, decimal: 0 },
    { name: "Soil Salinity", field_name: "soil_salinity", unit: "mg/L", index: 12, type: "uint16be", coefficient: 1, decimal: 0 },
    { name: "Soil Nitrogen", field_name: "soil_nitrogen", unit: "mg/kg", index: 10, type: "uint16be", coefficient: 0.088, decimal: 3 },
    { name: "Soil Phosphorus", field_name: "soil_phosphorus", unit: "mg/kg", index: 10, type: "uint16be", coefficient: 0.044, decimal: 3 },
    { name: "Soil Potassium", field_name: "soil_potassium", unit: "mg/kg", index: 10, type: "uint16be", coefficient: 0.066, decimal: 3 },
    { name: "Soil pH", field_name: "soil_ph", unit: "pH", index: 20, type: "uint16be", coefficient: 0.01, decimal: 2 }
];

let payParser = new PayloadParser({
    device: device,
    msg: msg,
    frameInfo: frameInfo,
    appInfo: appInfo,
})

let tdata = payParser.telemetry()

if((tdata?.status & 0x02) === 0x02) {
    const status = tdata.status
    tdata = { ...(device.telemetry_data?.[thingModelId] ?? {}) }
    tdata.status = status
}

return {
    sub_device: tdata == undefined ? null : tdata.addr,
    telemetry_data: tdata,
    server_attrs: null,
    shared_attrs: null
}

8. Third-Party Platform Data Subscription

8.1 MQTT Topic

latex
/v32/{Organization Account}/tkl/up/telemetry/{eui}

8.2 Example Reported Data

json
{
    "eui": "6353012af10a9331",
    "active_time": "2026-05-03T07:36:00.000Z",
    "thingModelId": "BGT-SMPS-25101",
    "thingModelIdName": "bgt_smps_25101",
    "telemetry_data": {
        "snr": 13.5,
        "rssi": -51,
        "battery": 3.37,
        "addr": 1,
        "soil_temperature": 23.6,
        "soil_moisture": 35.6,
        "soil_ec": 1234,
        "soil_salinity": 1356,
        "soil_nitrogen": 108.592,
        "soil_phosphorus": 54.296,
        "soil_potassium": 81.444,
        "soil_ph": 6.86,
        "status": 0
    }
}

9. RPC

9.1 RPC Name

TypeName
Parameter setting RPCbgt_smps_set_25101
Parameter validation namebgt_smps_25101_set

Note: During actual platform configuration, it is recommended to keep the RPC name and the parameter thing model validation name consistent to avoid call failures caused by naming inconsistency.

9.2 Parameter Definition

Parameter NameField NameAPP IndexTypeUnitDescription
pwron_delaypwron_delay38uint16lemsPeripheral power-on delay
period1period170uint32LEsCollection period of sensor channel 1
period2period274uint32LEsCollection period of sensor channel 2
period3period378uint32LEsCollection period of sensor channel 3
addr1addr1150uint8-485 address of sensor channel 1
addr2addr2151uint8-485 address of sensor channel 2
addr3addr3152uint8-485 address of sensor channel 3

9.3 RPC Code

9.3.1 Set Parameters

javascript
let classMode = (device && device.shared_attrs && device.shared_attrs.class_mode) || "ClassA";
let intervalms = classMode === "ClassA" ? 0 : 2000;

const rpcName = "bgt_smps_set_25101"

let paraDef = {
    app_38: { name: "pwron_delay", field_name: "pwron_delay", unit: "ms", index: 38, type: "uint16le" },
    app_70: { name: "period1", field_name: "period1", unit: "s", type: "uint32LE" },
    app_74: { name: "period2", field_name: "period2", unit: "s", type: "uint32LE" },
    app_78: { name: "period3", field_name: "period3", unit: "s", type: "uint32LE" },
    app_150: { name: "addr1", field_name: "addr1", unit: "", type: "uint8" },
    app_151: { name: "addr2", field_name: "addr2", unit: "", type: "uint8" },
    app_152: { name: "addr3", field_name: "addr3", unit: "", type: "uint8" },
}

let frames = RPCHelper.buildFrame({
    paraDef: paraDef,
    params: params
});

let redoBuffer = RPCHelper.redo()

let dnBuffer = Buffer.alloc(frames.writeBuffer.length + frames.readBuffer.length);
frames.writeBuffer.copy(dnBuffer, 0)
frames.readBuffer.copy(dnBuffer, frames.writeBuffer.length)

logger.info("set para")

let msgQue = Utils.makeParaSetMSG({
    device: device,
    classMode: classMode,
    rpcName: rpcName,
    params: params,
    paraDownBuffer: dnBuffer,
    extraAppBuffer: redoBuffer
})

if (msgQue.length == 0) return null

return msgQue

9.3.2 Read Parameters

javascript
let classMode = (device && device.shared_attrs && device.shared_attrs.class_mode) || "ClassA";
let sleepMs = classMode === "ClassA" ? 500 : 5000;

let paraDef = {
    app_38: { name: "pwron_delay", field_name: "pwron_delay", unit: "ms", index: 38, type: "uint16le" },
    app_70: { name: "period1", field_name: "period1", unit: "s", type: "uint32LE" },
    app_74: { name: "period2", field_name: "period2", unit: "s", type: "uint32LE" },
    app_78: { name: "period3", field_name: "period3", unit: "s", type: "uint32LE" },
    app_150: { name: "addr1", field_name: "addr1", unit: "", type: "uint8" },
    app_151: { name: "addr2", field_name: "addr2", unit: "", type: "uint8" },
    app_152: { name: "addr3", field_name: "addr3", unit: "", type: "uint8" },
}

let frames = RPCHelper.buildFrame({
    paraDef: paraDef,
    params: params
});

let msg = RPCHelper.makeMSG({
    msgType: Utils.msgType.paras,
    device: device,
    dnBuffer: frames.readBuffer,
    sleepTime: sleepMs,
})

return [msg]

10. Template Selection

Search for the following template in the ThinkLink platform:

latex
BGT-SMPS-25101

Or search by business type:

latex
25101

Recommended search keywords:

Search MethodKeyword
By template nameBGT-SMPS-25101
By device modelBGT-SMPS
By business code25101
By application typeSoil multi-parameter sensor
By collection methodKC21 / RS-485 / Modbus / LoRaWAN