基于飞思卡尔单片机自动循迹小车控制的设计
摘 要
随着我国的电子科技的不断发展,我们生活中的自动化设备越来越多,也为嵌入式在智能化上的研究提供了一个广阔的平台。
本系统以MK60DN512VMD100微控制器为核心控制单元,选用OV7620 CMOS模拟摄像头检测赛道信息, 高速AD转换芯片选用 TCL5510,将提取后的灰度图像进行软件二值化,进而提取赛道信息;用光电编码器实时检测小车的实时速度,采用PID控制算法调节电机的速度以及舵机转向,从而实现速度和方向的闭环控制。
关键字:MK60DN512VMD100,OV7620 CMOS,软件二值化,PID
- I -
基于飞思卡尔单片机自动循迹小车控制的设计
Abstract
With
the continuous development of electronic technology, more and more
automation equipment into the production life of the people, the rapid development of embedded intelligent study provides a broader platform.
In this paper, the design of intelligent vehicle system MK60DN512VMD100 microcontroller as the core control unit, the selection of OV7620 CMOSanalog cameras to detect the track information, to using TCL5510 high-speed AD converter chip, software binarization image, extract the white guide line for identification of the track information; optical encoder to detect the real-time speed of the model car, using the PID control algorithm to adjust the speed of the drive motor and steering the angle of the steering gear, in order to achieve closed-loop control of velocity and direction of the model car.
Keywords: MK60DN512VMD100,OV7620 CMOS,software binarization, PID - II -
基于飞思卡尔单片机自动循迹小车控制的设计
目 录
摘 要 .............................................................................................................................. I Abstract .................................................................................................................................. II 1前言 .................................................................................................................................... 1 1.1 设计的背景以及意义 .................................................................................................... 1
1.2 智能小车国内外概况 ............................................................................................. 1
1.2.1国内研究的概况 ............................................................................................ 1 1.2.2 国外研究概况 ............................................................................................... 2 1.3智能小车的发展前景 .............................................................................................. 2 2 飞思卡尔单片机自动循迹小车系统设计总方案 ........................................................... 3
2.1 系统硬件部分 ......................................................................................................... 3 2.2 系统软件部分 ......................................................................................................... 4 3 智能车硬件系统 ............................................................................................................... 5
3.1 单片机最小系统 ..................................................................................................... 5
3.1.1 PIT定时器模块 ............................................................................................. 6 3.1.2 PWM 模块 ..................................................................................................... 6 3.1.3 I/O模块 .......................................................................................................... 7 3.1.4 时钟电路 ....................................................................................................... 7 3.1.5 复位电路 ....................................................................................................... 7 3.1.6 JTAG接口电路 .............................................................................................. 8 3.2 电机驱动模块 ......................................................................................................... 8 3.3路径识别摄像头检测模块 ...................................................................................... 9
3.3.1 摄像头的选择 ............................................................................................... 9 3.3.2 摄像头简介 ................................................................................................. 10 3.4 速度检测模块 ....................................................................................................... 10 3.5 舵机模块 ............................................................................................................... 10 3.6电源管理模块 ........................................................................................................ 10
3.6.1 3.3V电源 ..................................................................................................... 11 3.6.2 5V电源 ..................................................................................................... 11
4 软件系统的设计与实现 ................................................................................................. 12
4.1赛道信息的提取 .................................................................................................... 12 4.2 PID算法介绍 ......................................................................................................... 12
- III -
基于飞思卡尔单片机自动循迹小车控制的设计
4.2.1 位置式 PID ................................................................................................. 13 4.2.2 增量式 PID ................................................................................................. 14 4.2.3 PID 参数整定 .............................................................................................. 14 4.3转向舵机的控制方法 ............................................................................................ 15
4.3.1 舵机的工作原理 ......................................................................................... 15 4.3.2 舵机的 PID 控制 ....................................................................................... 15
5 开发平台介绍 ................................................................................................................. 19
5.1 IAR Embedded Workbench IDE简介 ................................................................... 19 5.2 IAR Embedded Workbench的功能及特点 ........................................................... 19 5.3 硬件开发平台Altium Designer ........................................................................... 22 6结 论 .............................................................................................................................. 23 参 考 文 献 ....................................................................................................................... 24 致 谢 ................................................................................................. 错误!未定义书签。 附录1电路原理图 ............................................................................................................. 26 附录2 PCB图 ..................................................................................................................... 27 附录3 元件清单 ................................................................................................................ 28 附录5 部分程序源代码 .................................................................................................... 29
- IV -