基于STM32的风力摆控制系统
2016-11-02金冬子朱军
金冬子 朱军
摘要:本系统是由STM32控制模块、姿态检测模块、风力摆模块、液晶显示模块以及风力摆机械结构组成的闭环控制系统。其实现了风力摆在直流风机为动力控制下迅速启摆、直线运动、恢复静止的功能,并能精准地绘制不同直线,且在受风力影响后能够快速恢复画圆状态,具有很好的重复性。姿态检测模块MPU6050采集风力摆姿态角,STM32处理姿态角数据后通过PID精确算法调节直流风机以控制风力摆。另外,本系统具有良好的人机交互界面,各参数及测试模式可由按键输入并通过液晶显示,稳定性高、反应速度快。
关键词: PID算法;MPU6050;STM32
中图分类号:TP391 文献标识码:A 文章编号:1009-3044(2016)23-0180-03
Abstract: This system is composed of STM32 control module, attitude detection module, the wind pendulum module, LCD module, and the machinery structure. In fact, the wind pendulum is now under the direct current fan for the dynamic control of the fast swing, linear motion, restore the stationary state, and it can accurately draw different lines, even though under the wind influence, it has a very good repeatability. Attitude detection module MPU6050 collects the attitude angle of the wind pendulum, and the STM32 processing attitude angle data is adjusted by PID to control the Wind pendulum. In addition, the system has a good man-machine interface, the parameters and test mode can be input by the key and display through the LCD, the stability is high, the reaction rate is fast.
Key words: PID Algorithm; MPU6050; STM32
风力摆系统是自动控制系统中的一个典型的研究对象。在工业和环境监测等行业有着较为广泛的应用前景。本系统通过数字式PID算法可实现风力摆的圆周运动和定向线段的运动,并且系统具有一定的稳定性和精确度。
1 系统方案
1.1总体方案
本风力摆控制系统主要包括单片机控制模块、电机驱动模块、姿态采集模块、风力摆模块、液晶显示模块、人机交互系统以及风力摆机械结构组成。风力摆由万向节连接碳纤维管再连接风机组成。位于碳杆最下方的姿态采集模块不断采集风力摆当前姿态角并反馈给主控芯片STM32。STM32控制液晶显示姿态角数据并处理数据后通过控制PWM波占空比控制风机转速实现对风力摆的控制。本系统结构框图如图1所示。
1.2方案论证
1.2.1风力摆运动控制方案的选择与论证……p>
