1、. 智能巡线小车的设计(A) 摘要 本次毕业设计分为四个模块: 电源模块、 路面检测模块、 单片机最小系统 、 电机驱动模块。电源模块是采用 12V 电源双路供电,一路直接供给电机,一路经过稳压 电路输出 5V 电源给 LM324、单片机和 L298N。循迹模块是采用三个单反射式红外传感器 TCRT5000 并排安装,来检测路面情况,输出给单片机 TTL 电平信号。单片机最小系统是 满足单片机工作的系统。电机驱动选择的是驱动芯片 L298 直接驱动两个直流减速电机, 并采用 PWM 调节速度,达到两个电极不同速度,从而控制小车的行驶速度。 关键词 单片机 电源 路面检测 电机驱动 PWM Sm
2、art Patrol Line Vehicle Abstract:The graduation project is divided into four modules: power supply module, the road detection module, the smallest single chip system, the motor drive module. 12V power supply module is the use of dual power supply, direct supply of the motor all the way, all the way
3、through the 5V output voltage regulator to power the LM324, MCU and L298N. Tracking module is the use of three single-reflection infrared sensor TCRT5000 side by side, to detect the road conditions, the output TTL level signal to the microcontroller. Minimum system MCU is to meet the minimum system
4、work system. Motor driver chips L298 is selected to drive two DC gear motor directly, and use PWM to adjust the speed to achieve two electrodes at different speeds to control car speed. Key words:MCU power supply the road detection Motor driver PWM I 目 录 1 引言 . 1 1.1 智能小车的意义和作用 1 1.2 智能小车的现状 . 2 1.3
5、 论文各部分的主要内容 . 2 2 方案论证与选择 3 2.1 任务 3 2.2 电源模块的设计 . 3 2.3 路面检测模块的设计 . 4 2.3.1 传感器类型选择 4 2.3.2 红外传感器方案 4 2.3.3 电压比较器选择 5 2.4 控制电机方案比较 . 5 2.5 电机驱动方案的比较 . 5 2.6 主控制芯片选择 . 6 2.7 本章小结 6 3 硬件电路的设计 7 II 3.1 总体设计 7 3.2 单片机最小系统 . 7 3.2.1 时钟电路 8 3.2.2 复位及复位电路 9 3.3 路面检测模块 12 3.3.1 传感器 TCRT5000 介绍 12 3.3.2 比较器
6、 LM324 . 13 3.3.3 具体电路. 14 3.3.5 TTL 电平 . 16 3.4 电源模块 . 17 3.5 电机驱动模块 18 3.5.1 电机驱动芯片 L298N 18 4 软件设计 . 20 4.1 PWM . 20 4.2 主函数程序设计 22 4.3 寻迹子函数程序设计 23 4.4 调速子程序 . 25 5 整体调试 . 28 5.1 测试方法及仪器: 28 III 致谢 . 30 参考文献 . 31 外文翻译 . 32 附录 A 硬件连接图 . 44 附录 B 硬件清单 . 45 附录 C 程序清单 . 46 第 1 页 共 48 页 1 引言 1.1 智能小车的意义和作用 自第一台工业机器人诞生以来,机器人的发展已经遍及机械、电子、冶金、交通、 宇航、国防等领域。近年来机器人的智能水平不断提高,并且迅速地改变着人们的生活 方式。人们在不断探讨、改造、认识自然的过程中,制造能替代人劳动的机器一直是人 类的梦想。 随着科学技术的发展,机器人的感觉传感器种类越来越多,其中视觉传感器成为自 动行走和驾驶的重要部件。视觉的典型应用领域为自主式智能导