Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
基于RT-Thread UIoT 快速入门ucloud-1(基于RT-Thread Studio)
发布于 2020-03-26 17:33:53 浏览:2883
订阅该版
**[连载二:基于RT-Thread UIoT 快速入门ucloud-2(点击即可跳转)](https://www.rt-thread.org/qa/forum.php?mod=viewthread&tid=424122&page=1&extra=#pid476724)** 本文详细介绍如何在RT-Thread的基础上使用UCloud IoT软件包实现数据上云,以及设备远程控制。 本教程分为两部分:**第1部分** RT-Thread UIoT快速入门-采集温湿度数据上云 **第2部分 **RT-Thread UIoT快速入门-业务服务下发控制 教程视频入口:[https://www.bilibili.com/video/BV1S7411y7wL](https://www.bilibili.com/video/BV1S7411y7wL) **UCloud云服务与RT-Thread平台不做强绑定,大家可根据自身需求选择是否使用!通过此链接:[https://passport.ucloud.cn/?invitation_code=C1xF974651066CB](https://passport.ucloud.cn/?invitation_code=C1xF974651066CB) 注册并认证成为UCloud用户,客服将赠予150元云服务体验金所有云服务均享85折(仅限通过本链接注册的用户)!** **准备工作:** 1) 硬件:开发板STM32F767ZI-Nucleo,通信模块 EC20,温湿度传感器DHT112) 软件:RT-Thread Studio,UIoT物联网软件包3) 云资源:注册UCloud账号([RT-Thread注册链接](https://passport.ucloud.cn/?invitation_code=C1xF974651066CB)),开通UIoT物联网通信云平台,云主机1台** ** **环境搭建:** - **系统框架**   **- 搭建实拍**   **温湿度采集(上行)详细教程:**1. 下载RT-Thread Studio ([https://www.rt-thread.org/page/studio.html](https://www.rt-thread.org/page/studio.html))2. 安装软件并打开RT-Thread,登录RT-Thread Studio3. 创建RT-Thread项目   4. 选择UCloud UIoT软件包   5. 参考文档【创建产品、创建设备([https://docs.ucloud.cn/iot/uiot-core/console_guide/product_device/create_products](https://docs.ucloud.cn/iot/uiot-core/console_guide/product_device/create_products))】获取产品序列号ProductSN、设备序列号DeviceSN、设备密钥DeviceSecret,用于接入物联网平台   注:UCloud物联网通信云平台基于标准的MQTT协议具体参数的生成可以参考([https://docs.ucloud.cn/iot/uiot-core/device_develop_guide/deviceconnect/mqttconnect](https://docs.ucloud.cn/iot/uiot-core/device_develop_guide/deviceconnect/mqttconnect))。 6. 配置UIoT软件包   7. 配置AT软件包,配置AT模组EC20,(串口设备名称、电源引脚、接收缓存)   8. 配置DHT11软件包   **9. 其他配置**1)配置libc支持   2)配置AT模组需要的   10. 保存上述配置   11.修改dht11_sample.c,修改头文件‘drv_gpio.h’为’board.h’, 删除static void read_temp_entry(void *parameter)和static int dht11_read_temp_sample(void)函数,将读取温湿度的流程放到mqtt_sample.c中   12. 修改mqtt_sample.c,添加DHT11读取温湿度,并通过Topic:/${ProductSN}/${DeviceSN}/upload/event publish消息到Ucloud物联网云平台- 添加头文件   - 修改static int _publish_msg(void*client, msg_payload payload) 函数上报温湿度   - 在static void mqtt_test_thread(void)函数中添加DHT11温湿度读取代码     - 修改void mqtt_test_example (void),并创建一个头文件声明该函数     **注:**mqtt_sample.c完成的工作包括:①监听MQTT Topic:/${ProductSN}/${DeviceSN}/upload/event ;②发送消息到MQTT Topic:/${ProductSN}/${DeviceSN}/upload/event。mqtt_sample.c中为了方便观察测试结果,使用的Topic同时具有发布&订阅权限,实际使用中建议参考【Topic管理】([https://docs.ucloud.cn/iot/uiot-core/console_guide/product_device/topic](https://docs.ucloud.cn/iot/uiot-core/console_guide/product_device/topic))分别定义发布、订阅权限的Topic用于上下行通信。 -在main函数中调用void mqtt_test_example (void)   13.编译并下载到目标开发板   14.打开UIoT物联网日志功能,可以查看上行消息 规则引擎转发到http server- 准备httpserver,本例使用golang写一个监听8900,path为receive的http server,并将收到的数据打印```- package main import ( "encoding/hex" "fmt" "io/ioutil" "net/http" ) func IndexHandler(w http.ResponseWriter, r *http.Request) { s,_ := ioutil.ReadAll(r.Body) //fmt.Println(time.Now().Local().String()+string(s)) hexdump := hex.Dump(s) fmt.Print(hexdump) } func main() { http.HandleFunc("/receive", IndexHandler) http.ListenAndServe(":8900", nil) } ``` - 配置规则引擎   - 后端业务服务器收到上行数据,与日志记录的相同    
查看更多
8
个回答
默认排序
按发布时间排序
iwillbeback008
2020-03-27
这家伙很懒,什么也没写!
厉害了,我的楼主 :lol
XQQ
2020-03-27
这家伙很懒,什么也没写!
>厉害了,我的楼主 --- 厉害的不是我 是ucloud~
iwillbeback008
2020-03-27
这家伙很懒,什么也没写!
>厉害的不是我 是ucloud~ --- 都厉害
StackYuan
认证专家
2020-03-28
这家伙很懒,什么也没写!
很有意思,值得尝试:lol
杰瑞鼠
2020-04-01
2025再接再励
ucloud和阿里有啥区别?选择ucloud的好处在哪?
jeasey
2020-04-06
这家伙很懒,什么也没写!
好东西,谢谢分享!!
rabbit0206
2020-04-16
这家伙很懒,什么也没写!
>ucloud和阿里有啥区别?选择ucloud的好处在哪? --- 灵活些,最主要的是和RTT做了一些深度优化,ROM RAM占用更少。
wangyuan
2020-05-18
这家伙很懒,什么也没写!
楼主 这个适用AT组件的时候老是连接失败呢?这个串口配置我没配置 是使用默认的串口参数吗?只配置了引脚,波特率,停止位都没配置,目前连接链不上,,
撰写答案
登录
注册新账号
关注者
0
被浏览
2.9k
关于作者
XQQ
这家伙很懒,什么也没写!
提问
38
回答
123
被采纳
0
关注TA
发私信
相关问题
推荐文章
1
RT-Thread应用项目汇总
2
玩转RT-Thread系列教程
3
国产MCU移植系列教程汇总,欢迎查看!
4
机器人操作系统 (ROS2) 和 RT-Thread 通信
5
五分钟玩转RT-Thread新社区
6
【技术三千问】之《玩转ART-Pi》,看这篇就够了!干货汇总
7
关于STM32H7开发板上使用SDIO接口驱动SD卡挂载文件系统的问题总结
8
STM32的“GPU”——DMA2D实例详解
9
RT-Thread隐藏的宝藏之completion
10
【ART-PI】RT-Thread 开启RTC 与 Alarm组件
最新文章
1
ART-Pi2移植CMSIS-DAP(基于CherryUSB协议栈)
2
RT-thred的stm32h723对应bsp包CubeMX添加其他外设报错
3
RT-Thread中的time溢出问题,时间戳溢出,解决方法
4
ART-PI使用env驱动ETH网卡,pc和板子可以ping通
5
SystemView线程名字不显示
热门标签
RT-Thread Studio
串口
Env
LWIP
SPI
AT
Bootloader
Hardfault
CAN总线
FinSH
ART-Pi
DMA
USB
文件系统
RT-Thread
SCons
RT-Thread Nano
线程
MQTT
STM32
RTC
rt-smart
FAL
I2C_IIC
UART
ESP8266
cubemx
WIZnet_W5500
ota在线升级
PWM
BSP
flash
freemodbus
packages_软件包
潘多拉开发板_Pandora
定时器
ADC
GD32
flashDB
socket
编译报错
中断
Debug
rt_mq_消息队列_msg_queue
keil_MDK
ulog
SFUD
msh
C++_cpp
MicroPython
本月问答贡献
RTT_逍遥
9
个答案
2
次被采纳
xiaorui
3
个答案
2
次被采纳
winfeng
2
个答案
2
次被采纳
三世执戟
8
个答案
1
次被采纳
KunYi
8
个答案
1
次被采纳
本月文章贡献
catcatbing
2
篇文章
5
次点赞
swet123
1
篇文章
4
次点赞
Days
1
篇文章
4
次点赞
YZRD
1
篇文章
2
次点赞
lizimu
1
篇文章
2
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部