基于蓝牙连接的设备控制系统实现

 2022-03-06 08:03

论文总字数:27650字

摘 要

学号: 04012443 姓名: 张雯豪 指导老师: 张圣清

随着计算机与通讯技术的进步,物联网逐渐走进了我们的生活。而随着家用设备的小型化,设备外观也变得越来越简洁,按钮及显示界面越来越少,显示和控制的功能更多得向手机端转移。本课题以家用无线通信放大器为目标对象,设计了一款基于安卓平台的APP,通过蓝牙技术,与下位机实现通讯,可实现获取设备运行参数,设置设备参数等功能。设计中采用stm8f105作为下位机主控平台,单片机通过连接HC06蓝牙模块,实现UART转蓝牙的通讯功能。APP端则基于安卓4.0平台,使用了谷歌的bluetooth开发框架,通过手机蓝牙硬件实现类socket通讯。APP端通过蓝牙发送特定格式指令到下位机,下位机解析数据包获取任务,采集对应数据并返回上位机或者修改对应参数并应答。通讯数据包格式参考相应标准,包含起始码、地址码、控制码、数据长度码、数据码、校验码、结束码等等。本设计成本低,适用于家庭、公司等等地方,实际使用中不需局限于家用无线通信放大器,也可应用于其他的智能设备,具有很好的应用前景。

关键词:物联网,蓝牙, 安卓APP,家用无线通信放大器

An equipment control system based

on Bluetooth connection

student number:04012443 name: Wenhao Zhang mentor: Shengqing Zhang

With the progress of computer and communication technology, IoT (Internet of things) gradually entered our life. As the miniaturization of household equipment, equipments’appearance is becoming more and more concis, button and display interface are less and less, the function of the display and control shifts to mobile terminal gradually. This thesis aims at household wireless amplifier, designing an application based on Android platform. This application can communicate with the slave computer through bluetooth.It can get the running parameters or set the parameters and do other tasks.This design uses STM8S105 as the slave computer, MCU realizes UART-to-bluetooth function with linking the bluetooth module named HC06. This application is based on Android 4.0 platform,using Google’s bluetooth development framework,realizing socket communication by bluetooth hardware.This application sends instructions in specific format to slave computer by bluetooth,and then the slave computer analyzes the data packet to get its’ task,collecting specified data and return to master computer or setting specified parameters and response to master computer.The format of communication packets refers to the corresponding standards,including initial code,address code,control code,data length,data code,check code, epilog code and so on.This design’s cost is very low,and it is suitable for family,company,etc.In actual use,we don’t need limit the use of this design in home wireless amplifier only,and it can be applied in other intelligent devices. This design has a very good application prospect.

keyword:Internet of things, bluetooth, Android application, household wireless amplifier

目录

基于蓝牙连接的设备控制系统实现 I

摘 要 I

第1章 绪论 1

1.1 引言 1

1.2 蓝牙技术与物联网 1

1.3 物联网无线技术比较 2

1.3.1 ZigBee技术 2

1.3.2 蓝牙技术 3

1.3.3 WiFi 3

1.3.4 Bluetooth,WiFi,ZigBee对比 4

1.3.5 结论 4

1.4 本文的主要研究内容及结构 4

第2章 系统相关技术介绍 5

2.1 设备模型介绍——多模分布式室分系统 5

2.1.1 系统定义 5

2.1.2 主单元 5

2.1.3 扩展单元 6

2.1.4 远端单元 6

2.1.5 通讯单元 6

2.2 stm8s105主控芯片介绍 6

2.3 蓝牙技术 7

2.3.1 简介 7

2.3.2 蓝牙协议栈 7

2.3.3 蓝牙核心协议介绍 8

2.4 安卓蓝牙开发介绍 9

2.4.1 蓝牙权限 9

2.4.2 蓝牙适配器 9

2.4.3 蓝牙设备 12

2.4.4 蓝牙套接字 14

2.4.5 安卓多线程 15

第3章 系统设计 17

3.1 系统设计 17

系统主要包含两部分,上位机端的安卓APP以及下位机端单片机,APP端在用户的操作下,发送特定指令到下位机端,下位机端对数据进行解析并执行相应任务。系统框图如下: 17

3.2 硬件设计 17

3.2.1 主控模块 17

3.2.2 蓝牙模块 19

3.3 通讯接口协议设计 20

3.3.1 帧格式 20

3.3.2 数据格式举例 22

3.4 单片机程序设计 25

3.5 安卓程序设计 25

3.5.1 安卓程序设计框架 25

3.5.2 安卓程序底层驱动 25

3.5.3 安卓handler消息机制设计 26

3.5.4 安卓端业务逻辑设计 26

第4章 软硬件调试 28

4.1 硬件调试过程 28

4.2 安卓调试过程 28

4.3 系统调试过程 29

第5章 总结与展望 31

5.1 全文总结 31

5.2 课题展望 31

结论 32

致谢 33

参考文献 34

绪论

引言

近年来,伴随着计算机技术和通信技术的发展,物联网、智能硬件发展势头强劲。智能家居等名词也逐渐地走进了我们的生活。人们对于生活品质越来越渴望,设备的智能化、便携性等要求也给了产品设计者更大的考验[1]

物联网也是个新名词,顾名思义,就是指通过运用传感与通信等技术,将设备与互联网连接起来,我们可以通过网络对其进行控制、信息获取,获得更好的使用体验[2]。显而易见,物联网可以更好地服务我们的生活,为我们省时省力。

剩余内容已隐藏,请支付后下载全文,论文总字数:27650字

您需要先支付 80元 才能查看全部内容!立即支付

该课题毕业论文、开题报告、外文翻译、程序设计、图纸设计等资料可联系客服协助查找;