1. 传感器简介
模型清单
可使用下列名称或 ID 在 ThinkLink 中搜索对应模型。
| 模型类型 | 名称 | id_name | 平台模型 ID |
|---|---|---|---|
| RPC | [RS-O2WS-N01 GET] para | rs_o2ws_n01_get_22102 | 92200172653645829 |
| RPC | [RS-O2WS-N01 SET] para | rs_o2ws_n01_set_22102 | 92199641528930309 |
| Template | RS-O2WS-N01 | 92202072736272389 | |
| Thing Model | [RS-O2WS-N01] | rs_o2ws_n01_222102 | 92198338690027525 |
| Thing Model | [RS-22102-RS-O2WS-N01资产] 区域聚合 | rs_o2ws_n01_asset_22102 | 119677174411063311 |
| Parameter Thing Model | [RS-O2WS-N01-PARA] | rs_o2ws_n01_para_22102 | 92198902907801605 |
RS-O2WS-N01 为建大仁科(RenKe)氧气温湿度传感器,属于 485 型氧气温湿度三合一变送器,支持 RS485 输出与标准 Modbus-RTU 协议通信,适用于仓库、车间、化工厂、大棚养殖场、密闭生活场所等需要实时监测氧气浓度、温度、湿度的场合。设备采用宽压 10~30V DC 供电,支持地址设置与波特率修改。
2. 产品特点
量程为 0~30%VOL,支持氧气、温度、湿度三参数监测。
氧气测量精度可达 ±2%FS 以内,重复性可达 1% 以内。
温度测量范围 -40℃~+80℃,精度 ±0.5℃。
湿度测量范围 0~100%RH,精度 ±3%RH。
支持 RS485 通信接口,采用标准 Modbus-RTU 协议,通信距离最远可达 2000 米。
支持 10~30V DC 宽压供电。
采用壁挂式防水壳体,适用于较恶劣现场环境。
部分单气体型号可选 OLED 显示屏,三合一型号不带 OLED。
3. 适用范围
适用于仓库、车间、化工厂、大棚养殖场、密闭生活场所等需要实时监测氧气浓度的场景。
同时由于该型号为氧气温湿度三合一设备,也适用于需要同时采集环境温湿度与氧气浓度的应用场景。
4. 对接信息
4.1 硬件信息
设备型号:RS-O2WS-N01
厂家:建大仁科 / RenKe
业务代码:22102
模板:RS-O2WS-N01
供电电源:10~30V DC
输出信号:RS485
通信协议:Modbus-RTU
默认地址:0x01
默认波特率:4800 bit/s(手册默认);EB 配置中设定为 9600(对接时以实际烧录配置为准)
工作温度:-20~50℃
工作湿度:5~95%RH,无冷凝
整机尺寸:110 × 85 × 42 mm
4.2 接线信息
电源与通讯接口
电源正:棕色,10~30V DC
电源负:黑色
485-A:黄色
485-B:蓝色
说明:485 接线时 A/B 不能接反;同一总线上多台设备地址不能冲突。
传感器接口
本型号为一体式氧气温湿度传感器,传感器探头为设备自带,不需要额外定义独立传感器接口。
若为外延探头选型,则探头通过出厂配套线缆与主机连接。
5. 数据采集
本方案中,通过 Modbus 读取以下寄存器:
对于 RS-O2WS-N01 三合一设备,采集寄存器如下:
0000H:湿度值
0001H:温度值
0002H:氧气浓度值
在 EB 配置中,分别对应:
- 0x0000 → 湿度
- 0x0001 → 温度
- 0x0002 → 氧气浓度
5.1 寄存器定义
| 寄存器地址 | PLC/组态地址 | 内容 | 功能码 | 说明 |
|---|---|---|---|---|
| 0000H | 40001 | 湿度值 | 0x03/0x04 | 0~1000,扩大 10 倍 |
| 0001H | 40002 | 温度值 | 0x03/0x04 | -400~800,扩大 10 倍 |
| 0002H | 40003 | 氧气浓度值 | 0x03/0x04 | 0~300,扩大 10 倍 |
| 0032H | 40051 | 温度校准值 | 0x03/0x04/0x06/0x10 | 扩大 10 倍后写入 |
| 0035H | 40054 | 湿度校准值 | 0x03/0x04/0x06/0x10 | 扩大 10 倍后写入 |
| 0038H | 40057 | 氧气校准值 | 0x03/0x04/0x06/0x10 | 扩大 10 倍后写入 |
| 07D0H | 42001 | 设备地址 | 0x03/0x04/0x06/0x10 | 1~254,默认 1 |
| 07D1H | 42002 | 设备波特率 | 0x03/0x04/0x06/0x10 | 0=2400,1=4800,2=9600,3=19200,4=38400,5=57600,6=115200,7=1200 |
数据为 16bit,高字节在前。温度低于 0℃ 时以补码形式上传。
5.2 状态位定义
该设备手册未提供独立状态位寄存器定义,本次对接中无状态位定义。
EB 配置中也未定义额外状态字或告警位。
6. EdgeBus 模型
6.1 EB 配置参数
EB 中定义的核心参数如下:
设备名称:o2ws
LoRaWAN 端口:22
协议类型:modbus
Modbus 地址:0x01
功能码:0x03
版本号:0x86
数据类型:0x02
上报周期索引:70
采集周期索引:74
采集寄存器映射:
- 0x0000~0x0000 → covAppIndex 110,Int16BE
- 0x0001~0x0001 → covAppIndex 112,Int16BE
- 0x0002~0x0002 → covAppIndex 114,Uint16BE
OTA 配置:
- BaudRate: 9600
- StopBits: 1
- DataBits: 8
- Checkbit: NONE
- Battery: true
- ConfirmDuty: 60
- BzType: 22102
- BzVersion: 11
6.2 EB 代码
import { Buffer } from "buffer";
import { buildOtaFile } from "@EBSDK/run";
import {
ActionAfertExpr, CalcData,
CrcMode,
CvtRule,
EBBuffer,
EBModel,
ExprCondition,
LoraUpEvent,
QueryEvent, SetUpCovDataType,
UserConfUPItem, EventInfoItem, QuItemModBus, TypeVal, ValItem, EventConfig, Utils, UserConfQueryItem
} from "@EBSDK/EBCompiler/all_variable";
import { CheckbitEnum, getOtaConfig, HwTypeEnum, UpgrdTypeEnum } from "@EBSDK/otaConfig";
////////////////////////////////////////////////////////////////////////////////////////
const eventInfo:UserConfUPItem[]=[
{
name:"o2ws", port:22, version:"0x86",dataType:"0x02",upPeriodIndex:70,
quInfo:[{
protocol:"modbus",addr:"0x01",code:"0x03", periodIndex:74,//addr:"0x01",
indexAPP:150, indexCMD:0, copySize:1,isLast:false,//period:"900s",payIndex:3,ackAddrIndex:0,
listVal:[
{ start: "0x0000", end: "0x0000" ,covType:"Int16BE",covAppIndex:110},
{ start: "0x0001", end: "0x0001" ,covType:"Int16BE",covAppIndex:112},
{ start: "0x0002", end: "0x0002" ,covType:"Uint16BE",covAppIndex:114},
]
}
]
}
]
let otaConfig = getOtaConfig({
BaudRate: 9600,
StopBits: 1,
DataBits: 8,
Checkbit: CheckbitEnum.NONE,
Battery: true,
ConfirmDuty: 60,
BzType: 22102,
BzVersion: 11
})
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 说明
当前 EB 逻辑说明:
当前方案通过 EdgeBus 周期性发起 Modbus 读取,采集温度、湿度、氧气浓度三个寄存器,并将采集值映射到应用层索引,再由 LoRaWAN 端口 22 上报。
其中:
upPeriodIndex:70用于控制整机上报周期;periodIndex:74用于控制 Modbus 采集周期;app_110、app_112用于温度和湿度类阈值或变化量配置;app_150用于 Modbus 地址配置。- index 6 → humidity
- index 8 → temperature
- index 10 → o2
7. 物模型
7.1 物模型基本信息
数据物模型名称:[RS-O2WS-N01]
id Name:rs_o2ws_n01_222102
参数物模型名称:[RS-O2WS-N01-PARA]
id Name:rs_o2ws_n01_para_22102
7.2 上行帧结构
当前提供的上行帧结构如下:
let frameInfo={
port:22, dataLen:-1,rssi:true,battery:true,
subDevice:{index:5,type:"uint8"},
tagList:[{index:0, tag:0x86}, {index:1, tag:0x02}]
}7.3 物模型脚本
let frameInfo = {
port: 22,
dataLen: -1,
rssi: true,
battery: true,
tagList: [
{ index: 0, tag: 0x86 },
{ index: 1, tag: 0x02 }
]
}
let appInfo = [
{ name: "humidity", field_name: "humidity", unit: "%RH", index: 6, type: "int16be", coefficient: 0.1, decimal: 1 },
{ name: "temperature", field_name: "temperature", unit: "℃", index: 8, type: "int16be", coefficient: 0.1, decimal: 1 },
{ name: "o2", field_name: "o2", unit: "%VOL", index: 10, type: "int16be", coefficient: 0.1, decimal: 1 }
]
let payParser = new PayloadParser({
device: device,
msg: msg,
frameInfo: frameInfo,
appInfo: appInfo,
})
let tdata = payParser.telemetry();
return {
telemetry_data: tdata,
server_attrs: null,
shared_attrs: null,
};8. 第三方平台数据订阅
8.1 MQTT Topic
/v32/{Organization Account}/tkl/up/telemetry/{eui}
8.2 上报示例数据
以下示例结合本设备字段进行了调整。
其中 thingModelId、eui 需替换为平台实际设备值;thingModelIdName 使用当前物模型名称:
{
"eui": "your_device_eui",
"active_time": "2026-04-02T08:00:00.000Z",
"thingModelId": "your_thing_model_id",
"thingModelIdName": "rs_o2ws_n01_22102",
"telemetry_data": {
"snr": 13.5,
"rssi": -51,
"battery": 3.37,
"humidity": 35.9,
"temperature": -7.5,
"o2": 10.0
}
}其中示例数值参考了手册中的 Modbus 响应示例:湿度 35.9%RH、温度 -7.5℃、氧气 10%VOL。
9. RPC
9.1 RPC 名称
配置参数 RPC:rs_o2ws_n01_set_22102
读取参数 RPC:<font style="color:rgba(0, 0, 0, 0.88);">rs_o2ws_n01_get_22102</font>
9.2 参数定义
当前 RPC/参数模型中定义如下:
| 参数键 | 名称 | 字段名 | 单位 | 类型 | 说明 |
|---|---|---|---|---|---|
| app_70 | period_up | period_up | s | uint32LE | 上报周期 |
| app_74 | period_read | period_read | s | uint32LE | 采集周期 |
| app_110 | cov_temperature | cov_temperature | ℃ | int16BE | 温度变化阈值 |
| app_112 | cov_humidity | cov_humidity | % | int16BE | 湿度变化阈值 |
| app_114 | cov_o2 | cov_o2% | % | int16BE | 湿度变化阈值 |
| app_150 | addr_modbus | addr_modbus | uint8 | Modbus 地址 |
9.3 RPC 代码
let classMode = (device && device.shared_attrs && device.shared_attrs.class_mode) || "ClassA";
let intervalms = classMode === "ClassA" ? 0 : 2000;
const rpcName="rs_o2ws_n01_set_22102"
let paraDef= {
app_70: {name: "period_up", field_name: "period_up", unit: "s", type: "uint32LE"},
app_74: {name: "period_read", field_name: "period_read", unit: "s", type: "uint32LE"},
app_110: {name: "cov_temperature", field_name: "cov_temperature", unit: "℃", type: "int16BE",coefficient:0.1,decimal:1},
app_112: {name: "cov_humidity", field_name: "cov_humidity", unit: "%", type: "int16BE",coefficient:0.1,decimal:1},
app_114: {name: "cov_o2", field_name: "cov_o2", unit: "%", type: "int16BE",coefficient:0.1,decimal:1},
app_150: {name: "addr_modbus", field_name: "addr_modbus", 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 msgQue10. 模板选择
在 ThinkLink 平台中搜索模板:RS-O2WS-N01
或按业务类型查找:22102