陈昱 沈林涛 王凯



摘要:为了响应节能环保、绿色出行倡议,缓解城市交通拥挤状况,提出一种基于STM32F103C8T6芯片控制的两轮平衡小车设计方案。以MPU-6050作为小车姿态传感器获取小车车体倾角和角速度,基于卡尔曼滤波算法对姿态传感器采集到的的数据进行滤波融合,利用霍尔编码器测量小车车轮转向和转速,运用PID算法对控制要求和采集的数据信息进行计算分析并输出控制PWM,经由TB6612电机驱动模块驱动电机,实现小车自主平衡并具备一定的抗干扰能力。另外小车通过蓝牙模块与手机APP通信,可通过手机端控制小车前进、后退、转弯等动作。
关键词:STM32;PID;MPU-6050;卡尔曼滤波;自平衡
DOI:10. 11907/rjdk. 201087 开放科学(资源服务)标识码(OSID):
中图分类号:TP319文献标识码:A 文章编号:1672-7800(2020)008-0117-05
Abstract:In order to response to the initiatives of energy conservation and environmental protection, green travel, and alleviate the urban traffic congestion, this paper introduces the design of self-balancing two-wheeled vehicle based on STM32F103C8T6 chip control.Sensors with MPU - 6050 is used to obtain car attitude angle and velocity of the vehicle body. The Kalman filter algorithm is used to filter and fuse the data collected by the attitude sensor. The Hall encoder is used to measure the steering and rotation speed of the trolley, and the PID algorithm is used to calculate and analyze the control requirements and collected data information and output the control PWM. The motor is driven by the TB6612 motor drive module to realize the autonomous balance of the trolley which has certain anti-interference ability. In addition, the car communicates with the mobile APP via bluetooth module, and the cars forward and backward movements, turn and other actions can be controlled through the mobile end.
Key Words: STM32; PID; MPU-6050; Kalman filter; self-balance
0 引言
隨着社会发展,环境污染日益加剧,与此同时公众环保意识逐步增强,绿色出行成为城市交通规划和公众出行首选。新能源汽车、折叠式电动车、便携式平衡车等逐渐成为日常代步工具。其中平衡车因为轻巧便携、转弯半径小,特别适用于在场地空间有限的地方运行,如大型购物中心、办公大楼、生活住宅小区、国际性会议或展览场所、生态旅游风景区等[1]。平衡车如何高效稳定地获取实时姿态信息、有效控制车体状态,在复杂环境下成功执行目标任务等成为研究热点。两轮平衡小车概念顺应当前研究浪潮,可有效解决复杂环境下小车运动问题,同时随着远程控制技术的发展,远程监控平衡车在军用、民用领域有广阔的发展空间[2]。……