一、项目背景
- 能实时检测当前环境中的温湿度参数
- 能够方便地在数据平台实时显示温湿度值
二、实训目标
- 注册OneNET平台账号并完成学生认证
- 在OneNET平台上添加自己的产品与设备
- 设备在线数据正常上报
- OneNET平台查看温湿度数据
三、实训步骤
1、OneNET平台的注册
2、在OneNET上添加自己的产品与设备
-
添加产品
-
添加设备
3、设备在线数据正常上报
- 关键代码展示
更改自己的IMEI、IMSI
const char endpoint_name[] = "666828270812034;1"; // IMEI;IMSI
温度资源
temp.type = NBIOT_FLOAT;
temp.flag = NBIOT_READABLE;
ret = nbiot_resource_add(dev,
3303, /* objId */
0, /* instId */
5700, /* resId */
&temp);
湿度资源
humi.type = NBIOT_FLOAT;
humi.flag = NBIOT_READABLE;
ret = nbiot_resource_add(dev,
3304,
0,
5700,
&humi);
4、OneNET平台查看温湿度数据
-
查看湿度数据
-
查看温度数据
串口发送资源数据
[2021-03-23_14:29:02:580]send data:AT+MIPLNOTIFY=0,3303,0,5700,4,"21.490000",1
[2021-03-23_14:29:02:584]Data:AT+MIPLNOTIFY=0,3303,0,5700,4,"21.490000",1
[2021-03-23_14:29:02:768]send data:AT+MIPLNOTIFY=0,3304,0,5700,4,"49.938763",1
[2021-03-23_14:29:02:780]Data:AT+MIPLNOTIFY=0,3304,0,5700,4,"49.938763",1
[2021-03-23_14:29:36:758]send data:AT+MIPLNOTIFY=0,3303,0,5700,4,"21.660000",1
[2021-03-23_14:29:36:770]Data:AT+MIPLNOTIFY=0,3303,0,5700,4,"21.660000",1
[2021-03-23_14:29:36:946]send data:AT+MIPLNOTIFY=0,3304,0,5700,4,"50.587261",1
[2021-03-23_14:29:36:954]Data:AT+MIPLNOTIFY=0,3304,0,5700,4,"50.587261",1
[2021-03-23_14:30:10:925]send data:AT+MIPLNOTIFY=0,3303,0,5700,4,"21.820000",1
[2021-03-23_14:30:10:925]Data:AT+MIPLNOTIFY=0,3303,0,5700,4,"21.820000",1
[2021-03-23_14:30:11:112]send data:AT+MIPLNOTIFY=0,3304,0,5700,4,"49.297890",1
[2021-03-23_14:30:11:124]Data:AT+MIPLNOTIFY=0,3304,0,5700,4,"49.297890",1
[2021-03-23_14:30:45:103]send data:AT+MIPLNOTIFY=0,3303,0,5700,4,"21.980000",1
[2021-03-23_14:30:45:111]Data:AT+MIPLNOTIFY=0,3303,0,5700,4,"21.980000",1
[2021-03-23_14:30:45:291]send data:AT+MIPLNOTIFY=0,3304,0,5700,4,"49.618324",1
[2021-03-23_14:30:45:299]Data:AT+MIPLNOTIFY=0,3304,0,5700,4,"49.618324",1
[2021-03-23_14:31:19:281]send data:AT+MIPLNOTIFY=0,3303,0,5700,4,"22.080000",1
[2021-03-23_14:31:19:281]Data:AT+MIPLNOTIFY=0,3303,0,5700,4,"22.080000",1
[2021-03-23_14:31:19:465]send data:AT+MIPLNOTIFY=0,3304,0,5700,4,"48.695168",1
[2021-03-23_14:31:19:473]Data:AT+MIPLNOTIFY=0,3304,0,5700,4,"48.695168",1
[2021-03-23_14:31:53:444]send data:AT+MIPLNOTIFY=0,3303,0,5700,4,"22.190001",1
[2021-03-23_14:31:53:452]Data:AT+MIPLNOTIFY=0,3303,0,5700,4,"22.190001",1
[2021-03-23_14:31:53:635]send data:AT+MIPLNOTIFY=0,3304,0,5700,4,"48.397621",1
[2021-03-23_14:31:53:635]Data:AT+MIPLNOTIFY=0,3304,0,5700,4,"48.397621",1
[2021-03-23_14:32:27:610]send data:AT+MIPLNOTIFY=0,3303,0,5700,4,"22.230000",1
[2021-03-23_14:32:27:618]Data:AT+MIPLNOTIFY=0,3303,0,5700,4,"22.230000",1
四、实训总结
总的来说这次实训很有收获,学到了由传感器采集的数据是如何上传到云平台的,也学会了平台的使用。唯一的不足是想吐槽实训设备,有不少已经不能正常使用了,每次拿设备都像是抽盲盒。