2015 年全国大学生电子设计竞赛
风力摆控制系统(B 题)
2015 年 8 月 15 日
摘 要
本系统采用 STM32F103V 开发板作为控制中心,与万向节、摆杆、直流风
机(无刷电机+扇叶)、激光头、反馈装置一起构成摆杆运动状态与风机速度分
配的双闭环调速系统。单片机输出可变的 PWM 波给电机调速器,控制 4 个方向上
风机的风速,从而产生大小不同的力。利用加速度计模块 MPU6050,准确测出摆
杆移动的位置与中心点位置之间的关系,采样后反馈给单片机,使风机及时矫正,
防止脱离运动轨迹。使用指南针模块判别方向,控制系统向指定方向偏移。控制
方式采用 PID 算法,比例环节进行快速响应,积分环节实现无静差,微分环节减
小超调,加快动态响应。从而使该系统具有良好的性能,能很好地实现自由摆运
动、快速制动静止、画圆、指定方向偏移,具有很好地稳定性。
关键词:STM32F103V、直流风机、MPU6050、PID、指南针 GY-273
Abstract : This system adopts the STM32F103V development board as the control
center, and the universal joint, swinging rod, dc fan (brushless motor + blades), laser,
feedback device together form the swinging rod motion state and fan speed distribution of
the double closed loop speed regulation system. MCU output variable PWM waves to the
motor speed, control four directions wind speed of the fan, to produce different size. Using
accelerometer module MPU6050, accurately measure the position of swinging rod mobile
and center position, the relationship between the sampling after feedback to the single
chip microcomputer, the fan timely correction, prevent from the trajectory. Use the
compass module judging direction, deviation control system to a specified direction. Using
PID algorithm control method, proportion link for quick response, integral element to
realize astatic, differential link decrease overshoot, speed up the dynamic response. So
that the system has good performance, which can well realize the pendulum movement,
fast brake static, circle, specify the direction deviation, has a good stability.
Keywords: STM32F103V, dc fan, MPU6050, PID, compass GY - 273
目 录
一、系统方案..................................................................1
1.1 系统基本方案.....................................................................................................................1
1.1.1 控制方案设计..........................................................................................................1
1.1.2 机械结构方案设计..................................................................................................1
1.2 各部分方案选择与论证.....................................................................................................2
1.2.1 电机选择...................................................................................................................2
1.2.2 电机驱动的选择......................................................................................................2
1.2.3 摆杆与横杆的连接选择..........................................................................................2
1.2.4 摆杆与风机的连接选择..........................................................................................3
二、 系统理论分析与计算.......................................................3
2.1 风力摆位置的计算与分析..................................................................................................3
2.2 风力摆运动状态的分析..............................................................................................3
2.3 控制算法的分析..........................................................................................................4
三、电路与程序设计............................................................4
3.1 电路的设计..........................................................................................................................4
3.1.1 系统总体框图...........................................................................................................4
3.1.2 风力摆控制系统总电路原理图见附件 1................................................................4
3.1.3 电源...........................................................................................................................5
3.2 程序的设计..........................................................................................................................5
3.2.1 程序功能描述与设计思路.......................................................................................5
3.2.2 程序流程图...............................................................................................................6
四、测试方案与测试结果........................................................6
4.1 测试方案..............................................................................................................................6
4.2 测试条件与仪器..................................................................................................................7
4.3 测试结果及分析..................................................................................................................7
(1)测试结果..................................................................................................................7
(2)测试分析与结论......................................................................................................8
五、结论与心得................................................................8
六、参考文献..................................................................8