基于STM32的倾斜仪研发及应用

 2022-05-04 08:05

论文总字数:29173字

摘 要

本文介绍了基于STM32单片机的倾斜仪设计及应用。将加速度传感器、调理电路、CPU、通信电路和显示电路有机结合起来,实现了对被测平面倾斜角的测量并对完成对测量结果的显示以及传输。并应用于吊篮控制系统,与主控板一起联合控制吊篮的姿态。

本设计采用了三轴加速度传感器,并对三个轴的加速度进行综合处理进行倾斜角度的计算,提高了测量结果的准确性和灵敏度。经过试验测试,倾斜仪的测量结果与真实值之间的误差小于0.47°,且可以实现0º到90°的宽范围测量。本设计还加入了角度阈值机制,当被测平面的倾斜角超过阈值时,倾斜仪进行报警操作。且此阈值可以随时进行更改以适应不同的工作环境。

此外,本设计加入了485通信电路,可以实现倾斜仪与上位机的通信。包括接收上位机的请求返回角度数据以及接收上位机的阈值更改命令对系统的阈值进行更改。在通信程序的设计上,参照现有倾斜仪进行了通信协议的规定,规范了倾斜仪与上位机的通信。在此基础上加入了出错处理机制,提升了系统的稳定性。

在倾斜仪的应用方面,将产品接入吊篮的控制系统,接收主控板的数据请求并向主控板提供吊篮的倾斜角度数据。

关键词:倾斜仪,单片机,485通信,吊篮应用

Abstract

ZHAI Shi-xiong introduces the design and application of inclinometer based on STM32 single chip microcomputer. A combination of acceleration sensor, conditioning circuit, CPU, communication circuit and display circuit realizes the measurement of the inclination angle of the measured plane and completes the display and transmission of the measurement results.

This design adopts the three-axis acceleration sensor, and carries on the synthesis processing to the three-axis acceleration to carry on the inclined angle calculation, enhanced the accuracy and the sensitivity of the measurement result. After test, the error between the measurement results and the real value of the inclinometer is less than 0.47 °, and can achieve wide range of 0° to 90 ° measuring. This design also adds the Angle threshold mechanism, when the inclination Angle of the measured plane exceeds the threshold, the inclinometer will give an alarm. And this threshold can be changed at any time to adapt to different working environments.

In addition, 485 communication circuit is added in this design, which can realize the communication between inclinometer and upper computer. Including receiving the upper computer request to return Angle data and receiving the upper computer threshold change command to change the threshold of the system. In the design of the communication program, the communication protocol is made according to the existing inclinometer, and the communication between the inclinometer and the host computer is standardized. On this basis, the error handling mechanism is added to improve the stability of the system.

In the application of the inclinometer, the product is connected to the control system of the hanging basket, the data request of the main control board is received, and the inclined Angle data of the hanging basket is provided to the main control board.

KEY WORDS: inclinometer, single chip microcomputer, 485 communication

目 录

摘 要 I

Abstract II

第一章 绪论 1

1.1 倾斜仪介绍 1

1.2 研究现状 1

1.3 研究目标 5

第二章 倾斜仪总体设计 6

2.1 需求分析 6

2.1.1 功能需求 6

2.1.2 性能需求 6

2.2 设计框架 7

2.3 芯片选型 8

2.3.1 倾角传感器 8

2.3.2 控制核心 9

2.3.3 通信芯片 9

第三章 倾斜仪硬件电路设计与实现 11

3.1 倾角传感器电路 11

3.2 调理电路 11

3.3 控制电路 14

3.3.1 晶振电路 14

3.3.2 复位电路 15

3.3.3 下载电路 16

3.3.4 BOOT模式设置 17

3.4 OLED显示电路 18

3.5 485通信电路 19

3.5.1 485通信协议 19

3.5.2 485通信电路设计 20

3.6 电源电路 21

3.7 本章小结 22

第四章 倾斜仪软件程序设计与实现 24

4.1 加速度读取 24

4.2 倾角计算 25

4.2.1 单轴倾斜角的计算 25

4.2.2 三轴倾斜角的计算 25

4.3 通信程序设计 27

4.3.1 通信协议 27

4.3.2 通信流程 29

第五章 倾斜仪功能测试及联调 31

5.1 倾角测量设计成果 31

5.1.1 设计成果 31

5.1.2 精度实验 33

5.2 通信测试 34

5.2.1 角度信息上传 34

5.2.2 阈值更改 36

5.3 联合调试 37

5.3 方案改进 39

第六章 工作总结及展望 42

6.1 工作总结 42

6.2 展望 42

参考文献 43

致 谢 45

第一章 绪论

1.1 倾斜仪介绍

倾斜仪是一种用来测量被测平面与水平面之间夹角的仪器。按照测量原理的不同,可将传统的倾斜仪分为机械式、光学式和电子式。其中,机械式倾斜仪中比较典型的有:水管倾斜仪,水平摆倾斜仪和垂直摆倾斜仪;光学式倾斜仪的主要代表是光学象限仪;电子式倾斜仪的工作是将倾斜角信号转化为电压信号输出,从而实现读取角度的目的。

近年来倾斜仪的研究方向主要是电子智能倾斜仪,在电路板上集成了单片机,加速度计,AD转换,通讯电路,可以将被测平面的倾斜角直接输出。其主要工作原理如下:利用倾角传感器,将当前的倾斜角转换为电压信号输出,通过CPU对输出的电信号进行处理,然后将电信号再转换为倾斜角发送出来供上位机使用,实现他的功能。

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

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

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