1. 实现功能

  • 利用成熟稳定的采集分机, 定制数据输出和参数设置
  • 利用成熟稳定的4G模块, 将采集分机的数据上报到相关平台
  • 利用成熟稳定的平台修改相关接口和前后端, 完成分机数据的相关显示
  • 灵活扩展, 适配多种数据协议
  • 适配不同项目需求, 灵活修改分机或者平台

2. 采集分机, 工业级产品, 国内外数百家用户的十多年的现场稳定应用

2.1 供电

  • 金升阳电源隔离
  • 直流18~30V, <200mA
  • 带电源极性保护、过压过流保护

2.2 通信

  • 485电源隔离
  • 485通讯光耦隔离
  • 过压过流保护
  • 通讯参数: 波特率9600~115200bps, 8位数据, 1停止位, 无校验
  • 通信地址: 1~127, 直接通过跳线设置, 无需再用手机或电脑单独设置

2.3 四个传感器端口: 总共可连接最多1000个传感器

  • 原装温度探头: 支持原装DS18B20
  • 国产温度探头: QT18B20, GX18B20, CT1820, MY18B20, RT18B20, 继续支持中…
  • 强驱动兼容: 强上下拉, 自适应不同数量的温度探头, 自适应不同电缆
  • 电缆长度: 1200米, 与电缆特性有关
  • 温度电缆: 支持两线制和三线制
  • 湿度电缆: 三线制
  • 低功耗测量速度: 原装DS18B20: 传感器数量×0.8秒, 国产温度探头: 参考具体厂家
  • 快速测量速度: 集中转换, 各传感器同时测量: 1秒
  • 温度测量精度:±0.5℃, 温度测量范围:-40~+125℃
  • 湿度测量精度:±3% RH, 湿度测量范围:1~99% RH

2.4 外观参数

  • PCB尺寸: 90mm×90mm
  • PCB厚度: 1.6mm
  • 固定孔尺寸: 80mm×80mm, 4×φ4mm

2.5 工作环境

  • 温度: -40~+70℃
  • 湿度: 20~80% RH(不结露)

2.6 多种指示灯, 设备工作状态判断直观准确

  • LED电源指示灯: 常亮
  • 485通信指示灯: 闪烁
  • 传感器通信指示灯: 闪烁

2.7 内置IAP升级功能, 可利用485实现快速升级

  • 专用升级工具
  • 配套云盒, 可远程通过云盒升级分机

2.8 外形如下

  • 接线图
  • Java 海康测温 告警获取 NET_DVR_StartRemoteConfig_c语言

  • 历史版本
  • Java 海康测温 告警获取 NET_DVR_StartRemoteConfig_物联网_02

2.9 修改分机代码

  • 原先想用CJSON库解析JSON, 受限于RAM太小, 还需要完成更多的功能, 所以直接解析字符串
for (i=14; i<SsioRxdNumber; i++) {
	if ( (SsioRxdBuf[i] >= '0') && (SsioRxdBuf[i] <= '9') ) {
		if (m == 0) m = i;
		l ++;
	}
	else if (SsioRxdBuf[i] == '}')	{
		switch (l) {
			case 1: Buf[k] = SsioRxdBuf[m] & 0x0f; break;
			case 2: Buf[k] = (SsioRxdBuf[m] & 0x0f) * 10 + (SsioRxdBuf[m+1] & 0x0f); break;
			case 3: Buf[k] = (SsioRxdBuf[m] & 0x0f) * 100 + (SsioRxdBuf[m+1] & 0x0f) * 10 + (SsioRxdBuf[m+2] & 0x0f); break;
			case 4: Buf[k] = (SsioRxdBuf[m] & 0x0f) * 1000 + (SsioRxdBuf[m+1] & 0x0f) * 100
						   + (SsioRxdBuf[m+2] & 0x0f) * 10 + (SsioRxdBuf[m+3] & 0x0f); break;
			case 5: Buf[k] = (SsioRxdBuf[m] & 0x0f) * 10000 + (SsioRxdBuf[m+1] & 0x0f) * 1000 + (SsioRxdBuf[m+2] & 0x0f) * 100
						   + (SsioRxdBuf[m+3] & 0x0f) * 10 + (SsioRxdBuf[m+4] & 0x0f); break;
			case 6: Buf[k] = (SsioRxdBuf[m] & 0x0f) * 100000 + (SsioRxdBuf[m+1] & 0x0f) * 10000 + (SsioRxdBuf[m+2] & 0x0f) * 1000
						   + (SsioRxdBuf[m+3] & 0x0f) * 100 + (SsioRxdBuf[m+4] & 0x0f) * 10 + (SsioRxdBuf[m+5] & 0x0f); break;
		}

		fgstopenable = true;
		++k;
		break;
	}
	if (k >= 1) break;
}
// --- 无嵌套的JSON组包, 最大字节长度3K
#define SSIOTXMAXNUMBER 3072
__align(4) uint8_t  SsioTxdBuf[SSIOTXMAXNUMBER];

WifiLen = sprintf((char*)SsioTxdBuf,"{\"rtu_no\":%d,\"result\":1,\"cmd_id\":1,\"index\":%d,\"num_t\":%d,\"num_th\":%d,\"interval\":%d,", RTUNumber, No, UserTempData.XramTempNumber, UserTempData.XramHumidfyNumber, g_space);
if (UserTempData.XramTempNumber != 0) {
	WifiLen += sprintf((char*)(SsioTxdBuf+WifiLen), "\"data_t\":[");
	WifiCom.step = 1;
	WifiCom.sp = 0;
	for (i=0; i<UserTempData.XramTempNumber; i++) {
		WifiLen += sprintf((char*)(SsioTxdBuf+WifiLen),"[%d,%d,%3.1f],",
			UserTempData.T_Sensor_Data[i].No[0], UserTempData.T_Sensor_Data[i].No[1],
			((float)UserTempData.T_Sensor_Data[i].Sensor_Temp)/10);
		// --- multi package
		if (WifiLen < SSIOTXMAXNUMBER-20) continue;
		if (i == UserTempData.XramTempNumber-1)
			--WifiLen;
		SsioTxdSp = 0;
		SsioTxdNumber = WifiLen;
		WifiLen = 0;
		USART_ITConfig(USART_PC, USART_IT_TXE, ENABLE);
		Watchdog();
		while (SsioTxdNumber != 0);
	}

	if (WifiLen>0) --WifiLen;
	SsioTxdBuf[WifiLen] = ']';
	++WifiLen;
	if (UserTempData.XramHumidfyNumber != 0) {
		SsioTxdBuf[WifiLen] = ',';
		++WifiLen;
	}
	if (WifiLen >= SSIOTXMAXNUMBER-20) {
		SsioTxdSp = 0;
		SsioTxdNumber = WifiLen;
		WifiLen = 0;
		USART_ITConfig(USART_PC, USART_IT_TXE, ENABLE);
		Watchdog();
		while (SsioTxdNumber != 0);
	}
}

2.10 设置参数采用JSON格式

内容

主机到分机

分机应答主机

1

写采集参数

{"set_wire":[2,2,2,2,16,16,16,16]}

{"UpTime":[2,2,2,2], "DownTime":[16,16,16,16]}

2

读采集参数

{"read_wire"}

{"UpTime":[2,2,2,2], "{"UpTime":[2,2,2,2],"DownTime":[16,16,16,16],"up_interval":5,"num_t":359,"num_th":0,"index":0,"sw":"v1.3"}

3

设上报间隔

{"set_upload": 10}, (1-65535, 单位:分钟)

{"set_upload": 10}

  • 方便利用第三方串口工具调试, 如macos也可方便调试

2.11. 数据输出采用JSON格式, 方便平台端解析

  • 相关key
rtu_no: number, 分机编号.
result: number, 1=OK, -1: 有探头坏; -2: 无探头, -3: 预留
cmd_id: number, 1=上报数据, 2=预留...
index:  number, 上传序号, 从1开始, 方便查询有无丢失数据
num_t:  number, 温度探头数量, 方便和 data_t 中的数据比较
num_th: number, 温湿度探头数量, 方便和 data_th 中的数据比较
data_t: array, 温度数据数组, 数组的数量为探头的数量. 数组内每个探头的数据按照固定顺序排列, 固定为3项. [[缆号,层号,温度值], [缆号,层号,温度值]]
	缆号: number, 层号: nuber, 温度值: number, 带1位小数, 如 28.6
data_th: array, 温湿度数据数组, 数组的数量为探头的数量. 数组内每个探头的数据按照固定顺序排列, 固定为4项. [[缆号,层号,温度值,湿度值], [缆号,层号,温度值,湿度值]]
	缆号: number, 层号: nuber, 温度值: number, 带1位小数, 如 28.6, 湿度值: number, 带1位小数, 如 50.1
  • 240个温度探头, 1包发送完成
{"rtu_no":1,"result":1,"cmd_id":1,"index":1,"num_t":240,"num_h":10,"data_t":[[25,6,16.6],[13,1,16.6],[24,5,16.7],[15,9,16.7],[19,2,16.7],[19,8,16.6],[7,6,16.8],[17,7,16.6],[22,6,16.6],[8,7,16.6],[18,4,16.6],[18,2,16.8],[20,1,16.7],[6,7,16.7],[9,10,16.6],[18,7,16.6],[18,1,16.7],[14,9,16.6],[25,10,16.6],[6,2,16.8],[21,8,16.6],[24,7,16.6],[8,10,16.6],[17,1,16.7],[2,8,16.7],[13,7,16.5],[1,1,16.8],[18,3,16.6],[24,3,16.6],[20,7,16.6],[20,4,16.7],[21,9,16.5],[19,9,16.6],[6,8,16.6],[18,10,16.6],[25,4,16.9],[4,1,16.7],[2,3,16.7],[14,1,16.6],[11,6,16.7],[18,4,16.7],[18,3,16.6],[10,2,16.6],[22,8,16.6],[4,6,16.7],[25,3,16.7],[20,2,16.8],[18,6,16.6],[19,3,16.5],[13,8,16.8],[22,5,16.8],[5,1,16.6],[20,3,16.7],[4,8,16.4],[24,4,16.5],[4,7,16.6],[14,6,16.6],[24,2,16.6],[23,6,16.5],[21,4,16.6],[5,8,16.8],[18,2,16.7],[19,5,16.6],[4,9,16.6],[11,2,17.2],[2,1,16.7],[19,7,17.1],[20,2,16.6],[2,7,16.7],[24,8,16.3],[20,9,16.6],[19,1,16.5],[21,6,16.5],[15,8,16.6],[17,4,16.6],[18,8,16.6],[8,9,16.6],[13,3,16.6],[15,1,16.5],[18,8,16.7],[21,10,16.6],[5,7,16.8],[23,7,16.5],[24,9,16.6],[6,9,16.6],[9,8,16.6],[2,6,16.9],[20,6,16.7],[4,10,16.6],[6,6,16.6],[23,5,16.6],[25,8,16.7],[17,5,16.7],[10,1,16.6],[5,9,16.5],[23,1,16.6],[19,10,16.9],[21,2,16.6],[9,1,17.3],[24,6,16.5],[9,4,16.6],[5,6,16.6],[14,10,16.6],[14,8,17.1],[2,4,16.6],[13,10,16.7],[20,7,16.7],[6,5,16.6],[10,8,16.6],[17,10,16.6],[17,6,16.6],[20,10,16.6],[13,9,16.7],[19,6,16.6],[25,2,16.6],[9,7,16.7],[2,9,16.7],[20,5,16.8],[18,7,16.7],[8,3,16.6],[22,10,16.6],[4,2,16.8],[25,1,16.6],[8,1,16.6],[6,1,16.6],[25,9,16.6],[11,7,16.6],[22,7,16.6],[4,3,16.5],[15,4,16.7],[10,3,16.8],[1,1,16.6],[17,3,16.9],[1,6,16.6],[22,4,16.7],[23,8,16.5],[22,2,16.6],[7,8,16.6],[1,10,16.6],[19,4,16.6],[20,9,16.6],[8,2,16.6],[21,5,16.5],[7,2,16.7],[1,8,16.6],[2,2,16.8],[13,4,16.8],[9,2,16.6],[4,5,16.6],[22,9,16.6],[2,5,16.7],[23,9,16.6],[21,3,16.6],[9,9,16.6],[6,10,16.7],[25,7,16.7],[7,9,16.6],[10,5,16.6],[8,6,16.6],[11,4,16.6],[15,5,16.6],[7,7,16.6],[1,9,16.8],[8,5,16.7],[1,7,16.6],[15,6,16.6],[10,4,16.8],[20,1,16.8],[11,5,16.7],[15,10,16.6],[5,4,16.6],[24,1,16.6],[10,6,16.6],[18,6,16.7],[22,1,16.6],[20,4,16.6],[5,5,16.6],[22,3,16.6],[6,4,16.6],[11,3,16.5],[20,3,16.7],[17,8,16.8],[11,8,16.5],[1,4,16.6],[7,5,16.6],[18,9,16.7],[8,4,16.6],[6,3,16.7],[13,2,16.6],[11,1,16.6],[20,5,16.7],[18,5,16.6],[18,10,16.5],[10,10,16.6],[21,1,16.6],[18,5,16.6],[20,8,16.8],[14,3,16.7],[11,10,16.6],[13,6,16.7],[9,3,16.6],[7,10,16.6],[23,4,16.6],[5,3,16.6],[14,4,16.7],[7,4,16.7],[17,2,16.6],[14,5,16.6],[4,4,16.7],[18,9,16.6],[5,2,16.6],[7,1,16.5],[20,8,16.7],[2,10,16.8],[14,7,16.6],[1,3,16.6],[1,5,16.7],[14,2,16.7],[23,3,16.6],[10,7,16.6],[18,1,16.8],[9,6,16.6],[15,3,16.5],[13,5,16.8],[1,1,16.6],[17,9,16.6],[20,6,16.6],[7,3,16.7],[15,7,16.6],[10,9,16.6],[24,10,16.7],[15,2,16.5],[23,2,16.5],[8,8,16.5],[23,10,16.6],[21,7,16.7],[25,5,16.7],[5,10,16.5],[11,9,16.6],[9,5,16.7]],"data_th":[[2,5,17.7,54.2],[2,2,17.6,54.3],[1,1,17.5,54.6],[2,1,17.5,53.6],[1,2,17.5,54.9],[2,4,17.6,54.2],[1,4,17.5,54.7],[2,3,17.4,54.6],[1,5,17.5,54.5],[1,3,17.6,54.7]]}
  • 359个温度探头, 2包发送完成, 主机端需要组包
// --- 第1包
{"rtu_no":1,"result":1,"cmd_id":1,"index":1,"num_t":359,"num_th":0,"interval":3,"data_t":[[12,6,10.1],[3,1,9.7],[17,5,10.0],[25,7,10.6],[10,9,9.6],[13,2,11.2],[13,8,11.1],[25,5,11.1],[23,6,10.4],[11,7,9.8],[7,6,12.5],[22,7,10.3],[6,4,11.3],[8,2,11.7],[14,1,11.5],[24,7,11.0],[18,10,11.0],[6,7,10.4],[8,1,12.1],[9,9,10.0],[5,10,11.5],[24,2,11.3],[15,8,10.0],[17,7,10.1],[22,10,10.0],[11,1,11.3],[5,8,10.3],[3,7,9.9],[2,1,11.5],[6,3,11.2],[17,3,10.6],[14,7,10.5],[1,4,11.4],[15,9,9.8],[25,2,11.1],[13,9,11.1],[25,3,10.6],[24,8,10.6],[6,10,12.5],[12,4,9.6],[19,1,10.5],[5,3,11.0],[9,1,12.0],[20,6,9.9],[8,4,10.3],[8,3,10.5],[21,2,10.7],[7,8,10.5],[19,6,10.2],[12,3,9.7],[1,2,10.8],[8,6,10.6],[13,3,10.5],[3,8,10.1],[7,5,11.1],[4,1,11.8],[14,3,11.3],[19,8,9.8],[25,8,11.3],[17,4,10.1],[19,7,10.2],[9,6,12.5],[17,2,10.6],[16,6,10.4],[15,4,10.0],[4,8,10.6],[6,2,11.2],[13,5,9.9],[19,9,9.7],[20,2,11.6],[2,10,10.6],[13,7,11.1],[14,2,10.9],[5,7,11.3],[17,8,10.3],[1,9,10.8],[13,1,10.3],[15,6,10.3],[10,8,10.3],[11,4,10.4],[6,8,10.8],[22,9,10.6],[3,3,11.3],[10,1,11.3],[8,8,11.1],[15,10,10.0],[4,7,10.5],[16,7,9.8],[17,9,11.5],[24,9,10.0],[18,8,11.1],[5,6,11.9],[1,6,11.0],[19,10,10.0],[24,6,11.0],[16,5,10.1],[1,8,11.1],[11,5,10.8],[21,1,10.4],[4,9,10.7],[16,1,9.5],[13,10,11.5],[15,2,10.8],[18,1,12.1],[17,6,9.8],[18,4,10.0],[4,6,10.3],[9,10,10.3],[9,8,10.8],[5,4,10.6],[3,10,11.0],[1,7,10.8],[24,5,10.4],[21,8,10.2],[11,10,10.8],[11,6,10.3],[14,10,11.3],[3,9,10.6],[13,6,10.1],[12,2,10.3],[18,7,10.7],[25,4,11.0],[5,9,11.0],[25,9,11.5],[1,5,11.7],[8,7,11.3],[22,3,10.5],[7,10,11.3],[19,2,9.7],[12,8,10.8],[22,1,10.2],[24,1,10.2],[12,9,10.5],[20,7,10.0],[7,7,11.3],[19,3,10.2],[10,4,10.0],[21,3,10.4],[12,1,10.6],[11,3,10.4],[2,6,10.9],[7,4,10.6],[16,8,9.8],[7,2,12.0],[23,8,10.5],[12,10,10.8],[13,4,10.1],[14,9,11.2],[22,2,10.5],[15,5,9.6],[23,2,10.8],[2,8,10.3],[5,2,11.8],[3,4,11.9],[18,2,10.1],[19,5,9.6],[7,9,10.7],[5,5,11.2],[16,9,10.4],[15,3,10.6],[18,9,11.0],[24,10,10.0],[12,7,10.6],[23,9,10.8],[21,5,9.8],[22,6,10.1],[20,4,10.1],[10,5,10.8],[23,7,10.8],[2,9,10.7],[22,5,10.1],[2,7,10.8],[10,6,10.8],[21,4,9.8],[1,1,11.6],[20,5,10.0],[10,10,10.3],[4,4,9.6],[17,1,9.7],[21,6,10.0],[6,6,10.5],[7,1,12.5],[14,4,10.3],[4,5,10.3],[7,3,10.5],[24,4,10.5],[20,3,10.7],[1,3,10.8],[11,8,10.1],[20,8,10.3],[2,4,11.3],[23,5,10.6],[8,9,10.4],[25,6,10.7],[22,4,10.4],[24,3,11.1],[3,2,10.3],[25,10,11.6],[20,1,11.1],[14,5,10.4],[6,5,10.5],[8,10,10.5],[21,10,10.2],[15,1,9.6],[8,5,10.4],[14,8,10.8],[9,3,10.5],[20,10,10.8],[3,6,10.8],[18,3,9.7],[23,10,11.2],[16,4,9.6],[4,3,10.1],[9,4,10.6],[23,4,10.4],[11,2,10.0],[9,5,11.9],[19,4,10.1],[6,9,11.6],[4,2,10.6],[23,1,11.4],[1,10,10.8],[5,1,10.9],[9,7,11.7],[2,3,11.3],[2,5,11.1],[9,2,11.3],[25,1,12.8],[16,3,10.4],[21,7,10.0],[6,1,10.8],[18,6,10.2],[10,3,9.9],[3,5,11.1],[2,2,11.0],[11,9,10.5],[14,6,10.5],[23,3,10.4],[10,7,11.0],[21,9,10.4],[17,10,11.8],[10,2,10.3],[16,2,10.2],[22,8,10.5],[16,10,10.6],[15,7,10.7],[12,5,10.0],[4,10,10.7],[20,9,10.5],[18,5,10.1],[27,15,14.6],[27,45,14.4],[27,86,14.3],[27,98,14.5],[27,3,15.1],
// --- 第2包
[27,64,14.2],[27,4,14.8],[27,6,14.6],[27,41,15.0],[27,67,14.0],[27,80,14.4],[27,49,14.5],[27,73,14.5],[27,83,14.2],[27,20,14.8],[27,30,14.6],[27,75,14.3],[27,61,14.3],[27,63,14.6],[27,26,14.6],[27,2,15.5],[27,17,14.7],[27,31,14.6],[27,81,14.2],[27,21,14.4],[27,71,14.2],[27,89,14.2],[27,60,14.5],[27,13,14.4],[27,46,13.8],[27,8,14.1],[27,38,15.1],[27,11,14.6],[27,76,14.5],[27,84,14.1],[27,12,13.8],[27,69,13.5],[27,51,15.3],[27,1,17.9],[27,37,15.2],[27,59,14.4],[27,48,14.3],[27,14,15.3],[27,27,14.6],[27,34,15.1],[27,96,15.1],[27,57,14.6],[27,87,15.0],[27,85,14.3],[27,9,14.8],[27,36,14.8],[27,74,14.3],[27,52,14.1],[27,24,14.6],[27,91,14.8],[27,33,15.1],[27,5,14.8],[27,95,14.8],[27,66,14.2],[27,53,14.1],[27,18,14.3],[27,29,14.5],[27,93,14.2],[27,43,14.8],[27,47,14.5],[27,16,14.9],[27,44,13.9],[27,32,15.1],[27,82,14.8],[27,100,15.3],[27,19,14.5],[27,35,14.8],[27,79,14.3],[27,25,15.0],[27,39,15.0],[27,90,14.3],[27,7,15.3],[27,54,14.4],[27,92,14.5],[27,88,14.2],[27,28,14.9],[27,58,14.5],[27,65,14.3],[27,10,14.8],[27,40,14.7],[27,56,14.5],[27,99,14.5],[27,72,14.3],[27,77,14.5],[27,23,15.0],[27,68,14.1],[27,97,14.6],[27,55,14.0],[27,62,14.0],[27,94,14.0],[27,50,14.8],[27,22,14.5],[27,42,14.6],[27,78,14.5],[27,70,13.9],[2,6,22.3],[2,7,22.3],[2,8,22.0],[2,5,21.8],[2,2,22.4],[2,10,23.8],[2,4,21.9],[2,9,22.4],[2,3,22.7]]}

3. 4G模块部分

3.1 自测用4G模块, 现场稳定运行2年多

  • 内置eSIM卡, 每月100M流量, 含8年服务
  • 多种参数设置方式:网络、短信、串口 AT 指令、电脑端设置软件配置、微信小程序配置;
  • 支持 5~16V 宽电压供电,适配更多应用场景;
  • 体积超小,自带导轨和伸缩式挂耳,安装方便;
  • 网络透传模式拥有 4 路独立 socket,支持各路 socket 备份,支持 KEEP-ALIVE 机制,增强连接稳定性;
  • 每路连接支持 20 包数据缓存,每包数据最大 4K,支持注册包,心跳包数据;
  • 多种指示灯,设备工作状态判断直观准确。
  • 设置网络参数: TCP短连接/超时60秒/无心跳(只有数据时才上报), 平台端为TCP Server, 端口1508
  • 设置串口参数:

3.2 支持自选4G模块

  • 若4G模块需要独立设置, 适配修改分机代码