最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 正文

自动寻迹小车设计原理

来源:动视网 责编:小OO 时间:2025-09-27 08:13:12
文档

自动寻迹小车设计原理

自动寻迹小车设计原理*  PostBy:2008-11-518:34:00摘要:本寻迹小车是以有机玻璃为车架,ATmage32L单片机为控制核心,加以直流电机、光电传感器和电源电路以及其他电路构成。系统由mage32通过IO口控制小车的前进后退以及转向。寻迹由RPR220型光电对管完成。关键词:ATmage32L直流电机光电传感器自动寻迹电动车Abstract:Thesmartcarisaluminumalloyforthechassis,ATmaga32LMCUasitscore,inclu
推荐度:
导读自动寻迹小车设计原理*  PostBy:2008-11-518:34:00摘要:本寻迹小车是以有机玻璃为车架,ATmage32L单片机为控制核心,加以直流电机、光电传感器和电源电路以及其他电路构成。系统由mage32通过IO口控制小车的前进后退以及转向。寻迹由RPR220型光电对管完成。关键词:ATmage32L直流电机光电传感器自动寻迹电动车Abstract:Thesmartcarisaluminumalloyforthechassis,ATmaga32LMCUasitscore,inclu
自动寻迹小车设计原理 *   Post By:2008-11-5 18:34:00 

摘要:本寻迹小车是以有机玻璃为车架,ATmage32L单片机为控制核心,加以直流电机、光电传感器和电源电路以及其他电路构成。系统由mage32通过IO口控制小车的前进后退以及转向。寻迹由RPR220型光电对管完成。

关键词:ATmage32L 直流电机 光电传感器 自动寻迹电动车

Abstract: The smart car is aluminum alloy for the chassis, ATmaga32L MCU as its core, including motor and servo, plus photoelectric sensors, as well as other flame sensor and power circuit. MCU controls the car turning back forward or running on the white line. RPR220 reflective photo sensor seeks the trace. Far infrared flame sensor tracks the flame. In addition, the SCM system with Sunplus for voice broadcast can remind current status. The system transmits information through DF module. The car’s status will be transmitted to the Remote Console. OCMJ4X8C LCD display and 2 keys for start control.

Keywords: ATmaga32L Motor Servo Photo sensor Electrical fire engines 

一、系统设计

1、设计要求

(1)自动寻迹小车从安全区域启动。

(2)小车按指定路线运行,自动区分直线轨道和弯路轨道,在指定弯路处拐弯,实现灵活前进、转弯、倒退等功能,在轨道上划出设定的地图。

(3)小车完成指定运行任务后,自动返回出发起点,自动倒车,入库。

寻迹路线如图1所示:

2008-5-19 18:32

2、小车循迹的原理

这里的循迹是指小车在黑色地板上循白线行走,通常采取的方法是红外探测法。

红外探测法,即利用红外线在不同颜色的物体表面具有不同的反射性质的特点,在小车行驶过程中不断地向地面发射红外光,当红外光遇到白色纸质地板时发生漫反射,反射光被装在小车上的接收管接收;如果遇到黑线则红外光被吸收,小车上的接收管接收不到红外光。单片机就是否收到反射回来的红外光为依据来确定黑线的位置和小车的行走路线。红外探测器探测距离有限,一般最大不应超过3cm。

3、模块方案比较与论证

根据设计要求,本系统主要由控制器模块、电源模块、寻迹传感器模块、直流电机及其驱动模块、电压比较模块等模块构成。

为较好的实现各模块的功能,我们分别设计了几种方案并分别进行了论证。

3.1车体设计

方案1:购买玩具电动车。购买的玩具电动车具有组装完整的车架车轮、电机及其驱动电路。但是一般的说来,玩具电动车具有如下缺点:首先,这种玩具电动车由于装配紧凑,使得各种所需传感器的安装十分不方便。其次,这种电动车一般都是前轮转向后轮驱动,不能适应该题目的方格地图,不能方便迅速的实现原地保持坐标转90度甚至180度的弯角。再次,玩具电动车的电机多为玩具直流电机,力矩小,空载转速快,负载性能差,不易调速。而且这种电动车一般都价格不菲。因此我们放弃了此方案。

方案2:自己制作电动车。经过反复考虑论证,我们制定了左右两轮分别驱动,后万向轮转向的方案。即左右轮分别用两个转速和力矩基本完全相同的直流电机进行驱动,车体尾部装一个万向轮。这样,当两个直流电机转向相反同时转速相同时就可以实现电动车的原地旋转,由此可以轻松的实现小车坐标不变的90度和180度的转弯。

在安装时我们保证两个驱动电机同轴。当小车前进时,左右两驱动轮与后万向轮形成了三点结构。这种结构使得小车在前进时比较平稳,可以避免出现后轮过低而使左右两驱动轮驱动力不够的情况。为了防止小车重心的偏移,后万向轮起支撑作用。

对于车架材料的选择,我们经过比较选择了有机玻璃。用有机玻璃做的车架比塑料车架更加牢固,比铁制小车更轻便,美观。

综上考虑,我们选择了方案2。小车底盘如图2所示:

2008-5-19 18:32

支持(0) 中立(0) 反对(0)  

jiji134小大  2楼 个性首页 | 博客 | 信息 | 搜索 | 邮箱 | UC 

加好友 发短信 

等级:黑侠 帖子:727 积分:6086 威望:0 精华:0 注册:2008-5-5 9:47:00 

   Post By:2008-11-5 18:35:00 

3.2控制器模块

方案1:采用可编程逻辑期间CPLD 作为控制器。CPLD可以实现各种复杂的逻辑功能、规模大、密度高、体积小、稳定性高、IO资源丰富、易于进行功能扩展。采用并行的输入输出方式,提高了系统的处理速度,适合作为大规模控制系统的控制核心。但本系统不需要复杂的逻辑功能,对数据的处理速度的要求也不是非常高。且从使用及经济的角度考虑我们放弃了此方案。

方案2:采用凌阳公司的16位单片机,它是16位控制器,具有体积小、驱动能力高、集成度高、易扩展、可靠性高、功耗低、结构简单、中断处理能力强等特点。处理速度高,尤其适用于语音处理和识别等领域。但是当凌阳单片机应用语音处理和辨识时,由于其占用的CPU资源较多而使得凌阳单片机同时处理其它任务的速度和能力降低。

本系统主要是进行寻迹运行的检测以及电机的控制。如果单纯的使用凌阳单片机,在语音播报的同时小车的控制容易出现不稳定的情况。从系统的稳定性和编程的简洁性考虑,我们放弃了单纯使用凌阳单片机而考虑其它的方案。

方案3:采用Atmel公司的ATmaga32L单片机作为主控制器。ATmaga32L是一个低功耗,高性能的8位单片机,片内含32k空间的可反复擦些100,000次的Flash只读存储器,具有2Kbytes的随机存取数据存储器(RAM),32个IO口,2个8位可编程定时计数器,1个16位可编程定时计数器,四通道PWM,内置8路10 位ADC。且maga系列的单片机可以在线编程、调试,方便地实现程序的下载与整机的调试。

从方便使用的角度考虑,我们选择了方案3。

3.3电源模块

由于本系统需要电池供电,我们考虑了如下集中方案为系统供电。

方案1: 采用10节1.5V干电池供电,电压达到15V,经7812稳压后给支流电机供电,然后将12V电压再次降压、稳压后给单片机系统和其他芯片供电。但干电池电量有限,使用大量的干电池给系统调试带来很大的不便,因此,我们放弃了这种方案。

方案2:采用3节4.2V可充电式锂电池串联共12.6V给直流电机供电,经过7812的电压变换后给支流电机供电,然后将12V电压再次降压、稳压后给单片机系统和其他芯片供电。锂电池的电量比较足,并且可以充电,重复利用,因此,这种方案比较可行。但锂电池的价格过于昂贵,使用锂电池会大大超出我们的预算,因此,我们放弃了这种方案。

方案3:采用12V蓄电池为直流电机供电,将12V电压降压、稳压后给单片机系统和其他芯片供电。蓄电池具有较强的电流驱动能力以及稳定的电压输出性能。虽然蓄电池的体积过于庞大,在小型电动车上使用极为不方便,但由于我们的车体设计时留出了足够的空间,并且蓄电池的价格比较低。因此我们选择了此方案。

综上考虑,我们选择了方案3。

3.4稳压模块

方案1: 采用两片7812将电压稳压至12V后给直流电机供电,然后采用一片7809将电压稳定至9V,最后经7805将电压稳至5V,给单片机系统和其他芯片供电,但7809和7805压降过大,使7809和7805消耗的功率过大,导致7809和7805发热量过大,因此,我们放弃了这种方案。

方案2:采用两片7812将电压稳压至12V后给直流电机供电,然后采用2576将电压稳至5V。2576的输出电流最大可至3A,完全满足系统要求。

综上考虑,我们选择了方案2。

3.5寻迹传感器模块

方案1:用光敏电阻组成光敏探测器。光敏电阻的阻值可以跟随周围环境光线的变化而变化。当光线照射到白线上面时,光线发射强烈,光线照射到黑线上面时,光线发射较弱。因此光敏电阻在白线和黑线上方时,阻值会发生明显的变化。将阻值的变化值经过比较器就可以输出高低电平。

但是这种方案受光照影响很大,不能够稳定的工作。因此我们考虑其他更加稳定的方案。

方案2:用红外发射管和接收管自己制作光电对管寻迹传感器。红外发射管发出红外线,当发出的红外线照射到白色的平面后反射,若红外接收管能接收到反射回的光线则检测出白线继而输出低电平,若接收不到发射管发出的光线则检测出黑线继而输出高电平。这样自己制作组装的寻迹传感器基本能够满足要求,但是工作不够稳定,且容易受外界光线的影响,因此我们放弃了这个方案。

方案3:用RPR220型光电对管。RPR220是一种一体化反射型光电探测器,其发射器是一个砷化镓红外发光二极管,而接收器是一个高灵敏度,硅平面光电三极管。

RPR220采用DIP4封装,其具有如下特点:

塑料透镜可以提高灵敏度。

内置可见光过滤器能减小离散光的影响。

体积小,结构紧凑。

当发光二极管发出的光反射回来时,三极管导通输出低电平。此光电对管调理电路简单,工作性能稳定。

因此我们选择了方案3。

3.6电机模块

本系统为智能电动车,对于电动车来说,其驱动轮的驱动电机的选择就显得十分重要。由于本实验要实现对路径的准确定位和精确测量,我们综合考虑了一下两种方案。

方案1:采用步进电机作为该系统的驱动电机。由于其转过的角度可以精确的定位,可以实现小车前进路程和位置的精确定位。虽然采用步进电机有诸多优点,步进电机的输出力矩较低,随转速的升高而下降,且在较高转速时会急剧下降,其转速较低,不适用于小车等有一定速度要求的系统。经综合比较考虑,我们放弃了此方案。

方案2:采用直流减速电机。直流减速电机转动力矩大,体积小,重量轻,装配简单,使用方便。由于其内部由高速电动机提供原始动力,带动变速(减速)齿轮组,可以产生较大扭力。

我们所选用的直流电机减速比为1:74,减速后电机的转速为100r/min。我们的车轮直径为6cm,因此我们的小车的最大速度可以达到

V=2πr?v=2*3.14*0.03*100/60=0.314m/s

能够较好的满足系统的要求,因此我们选择了此方案。

3.7电机驱动模块

方案1:采用专用芯片L298N作为电机驱动芯片。L298N是一个具有高电压大电流的全桥驱动芯片,它相应频率高,一片L298N可以分别控制两个直流电机,而且还带有控制使能端。用该芯片作为电机驱动,操作方便,稳定性好,性能优良。

方案2:对于直流电机用分立元件构成驱动电路。由分立元件构成电机驱动电路,结构简单,价格低廉,在实际应用中应用广泛。但是这种电路工作性能不够稳定。

因此我们选用了方案1。

4、最终方案

经过反复论证,我们最终确定了如下方案:

(1)车体用有机玻璃车架手工制作。

(2)采用ATmaga32L单片机作为主控制器。

(3)用蓄电池经7812稳压后为直流电机供电,将12V电压经2576降压、稳压后为单片机系统和其他芯片供电。

(4)用RPR220型光电对管进行寻迹。

(5)L298N作为直流电机的驱动芯片。

系统的结构框图如图3所示:

2008-5-19 18:38

二、硬件实现及单元电路设计

1、微控制器模块的设计

采用Atmel公司的ATmaga32L单片机,不用烧写器而只用串口或者并口就可以往单片机中下载程序。

我们在开发过程中使用开发版,方便程序的调试和整机的测试,待系统调试完成后,将单片机从开发板上取下,安装在小车系统板的单片机座中,由于本次设计要求中,小车需要完成的任务比较简单,因此我们只在小车系统板的单片机系统中保留了晶振和复位电路,取消了JTAG编程口等冗余电路。

2、光电对管电路的设计

我们设计并论证了两种光电对管检测及调理电路,电路原理图分别如4和图5所示:

2008-5-19 18:35

图10所示电路中,R1起限流电阻的作用,当有光反射回来时,光电对管中的三极管导通,R2的上端变为高电平,此时VT1饱和导通,三极管集电极输出低电平。

当没有光反射回来时,光电对管中的三极管不导通,VT1截至,其集电极输出高电平。

VT1在该电路中起到滤波整形的作用。

经试验和示波器验证,该电路工作性能一般,输出还有杂散干扰波的成分。如果输出加施密特触发器就可以实现良好的输出波形。

但是这种电路用电量比较大,给此种传感器调理电路供电的电池压降较快。究其原因,是因为光敏三极管和三极管VT1导通时的导通电流较大。

因此我们考虑用比较器的方案。

2008-5-19 18:35

在图3中,可调电阻R3可以调节比较器的门限电压,经示波器观察,输出波形相当规则,可以直接够单片机查询使用。

而且经试验验证给此电路供电的电池的压降较小。因此我们选择此电路作为我们的传感器检测与调理电路。

支持(0) 中立(0) 反对(0)  

客人(59.173.*.*)

小大  3楼

   Post By:2008-11-5 18:35:00 

3、寻迹光电对管的安装

考虑到设计要求,本次设计仅用7对光电传感器就能完成设计要求,中间四对传感器用来校正小车的寻迹路线,保证小车运行的直线性。两侧的传感器用来检测小车过线,可以实现小车的转弯和小车走过的方格的计数。当车体中间通过白线时,小车在相应的坐标方向上加一计数。车轮处的传感器记录小车的运行速度和里程数。传感器的安装位置如图6所示。

2008-5-19 18:43

4、电机驱动电路的设计

我们采用电机驱动芯片L298N作为电机驱动,驱动电路的设计如图7所示:

2008-5-19 18:43

L298N的5、7、10、12四个引脚接到单片机上,通过对单片机的编程就可以实现两个直流电机的PWM调速以及正反转等功能。

三、软件实现

3.1主程序流程图

我们所设计的软件的主程序流程图如图8所示:

2008-5-19 18:43

3.2 传感器数据处理及寻迹程序流程

我们用一个字节来代表车底的6个光电传感器。用每一个位来代表当前传感器的检测状态。

我们把小车直线行进时分成三种状态,当中间四个传感器都检测到白线时,小车在跑道的正上方,这时控制两电机同速度全速运行。当检测到有一个传感器或者同侧的两个传感器偏出白线时,小车处于微偏状态,这时将一个电机速度调慢,另一电机速度调快,完成调整。当检测到有三个电机偏出时,小车处于较大的偏离状态,这时把一个电机的速度调至极低,另一电机全速运行,从而在较短时间内完成路线的调整。

用这种三级调速的寻迹算法同单纯的判断检测到对管的位置并作出判断的方法相比,程序思路清晰,程序执行结果较好。

该检测传感器子程序的流程图如图9所示:

2008-5-19 18:43 

支持(0) 中立(0) 反对(0)  

kyabcd小大  4楼 个性首页 | 博客 | 信息 | 搜索 | 邮箱 | UC 

加好友 发短信 

等级:黑侠 帖子:653 积分:5167 威望:0 精华:0 注册:2008-5-5 9:48:00 

   Post By:2008-11-5 18:35:00 

四、系统功能测试

4.1测试仪器及设备

表1 测试仪器设备清单

----------------------------------------------------------------------------------------

仪器名称 型号 用途 数量

----------------------------------------------------------------------------------------

PC机 联想 调试及下载程序 1

----------------------------------------------------------------------------------------

数字万用表 MASTECH my-65 测量各电路工作情况 1

----------------------------------------------------------------------------------------

秒表 记录时间 1

----------------------------------------------------------------------------------------

4.2功能测试

小车从启动区启动,走到第一列后竖直到底,然后返回场地中间的横向白线处,按照横向白线走到场地的尽头后转弯180度,返回启动区。所用时间总计28.666秒。安全返回启动区后,自动倒车,入库。小车路线示意图如图10所示:

2008-5-19 18:46

图10 小车路线示意图(测试1)

五、结论

测试表明,小车能够较好的完成实验的基本要求和发挥部分。同时作为我们的特色的远程显示台的工作正常,绘图显示清楚,寻迹误差较小。

六、结束语

我们的寻迹小车在完成设计要求的前提下,充分考虑到了外观、成本等问题,在性能和价格之间作了比较好的平衡。由于设计要求并不复杂,我们没有在电路中增加冗余的功能,但是我们保留了各种硬件接口和软件子程序接口,方便以后的扩展和进一步的开发。

另外,我们的车体底盘经过充分的论证和专业的设计,兼顾了美观、廉价、稳固、可靠等各方面的因素,具有较高的稳定性和推广意义。

鸣谢:山东大学工程训练中心

七、参考文献

1. 李正军。计算机控制系统。北京:机械工业出版社,2005

2. Ramon Pallas-Areny,John G. Webster(美)。传感器和信号调节,第2版。张伦译。北京:清华大学出版社,2003

3. 船仓一朗,土屋 尧等(日)。机器人控制电子学。宗光华,杨 洋,唐伯雁译。北京:科学出版社,2004

4. 罗亚非等。凌阳16位单片机应用基础。北京:北京航空航天大学出版社,2003

5. 童诗白,华成英。模拟电子技术基础。北京:高等教育出版社,2003

6. 阎石。数字电子技术基础。北京:高等教育出版社,1983

7. 高峰编。单片微型计算机原理与接口技术。北京:科学出版社,2003

8. 21IC中国电子网。www.21ic.com

9.万方数据资源统一服务系统。www.wanfangdata.com.cn

支持(0) 中立(0) 反对(0)  

禄林网络小大  5楼 个性首页 | 博客 | 信息 | 搜索 | 邮箱 | UC 

加好友 发短信 

等级:黑侠 帖子:601 积分:5108 威望:0 精华:0 注册:2008-5-5 9:53:00 

   Post By:2008-11-5 18:35:00 

直播?

支持(0) 中立(0) 反对(0)  

for2u小大  6楼 个性首页 | 博客 | 信息 | 搜索 | 邮箱 | UC 

加好友 发短信 

等级:黑侠 帖子:759 积分:6136 威望:0 精华:0 注册:2008-5-5 9:53:00 

   Post By:2008-11-5 18:35:00 

Use a C-52 EVB for simple robot experiments. Build a simple two wheels robot with L293D H-Bridge driver and IR sensors. Write a C program controls robot tracked with black tape. Fun with Ving-Peaw Competition 2543, course layout, day-by-day changed rule and scoring also included。

Introduction

One of my student has made a disgraceful robot that used two stepper motors and with a simple IR sensor. Yes, above picture is what I'm talking. Without battery carrying, a little bit torque of the stepper and misalignment of driving shaft, makes it crawling not walking, but first demo, showed quite impressive to me. He said he wrote a couple of program lines using C, his robot can track the black tape. I feel delighted his intention and endeavor. I thought, " he borrowed me DS5000, expensive one, a soft uController with internal bootloader, why shouldn't try with our learning board C-52 Evaluation Board instead". Another one, told me the same day "I found the L293 Push/Pull Four Channel Driver at Ban-Moah, it costs 1.5 US$ ". I've been searching this chip for a year. The www.media.mit.edu/people/fredm/papers/mb/]MiniBoard[/url], a Motorola 68HC11 Robot Controller board designed by www.media.mit.edu/people/fredm/]Fred G. Martin[/url], also uses this driver. The day after, I then decided to prepare the page describing how to use C-52 EVB as a robot controller board. I asked my student for competition, build yourselves robot that can track the black tape. Prize for the winner is 100 US$, with a bit condition that the winner must pay for a big party at Soi Jinda's Somtum (Papaya Salad) shop. And one of the competitor is me. I thought the rule should be conceived roughly by students and technically by me. The picture on that day will put here soon.

C-52 EVB resources

Beforehand, let look at available resources of C-52 EVB for robot experiments.

Actuators 

DC motor 

PWM with 

timer2 helps 

P1.4,P1.5,

P1.6,P1.7

Sensors 

digital/analog

IR detector

with comparator chip/ for analog input, see 

use of PIC16C711

digital input/T0,T1 for pulse input 

Brain 

C program 

available code and data space approx. 32kB 

8000H-FFFFH

Program 

Downloader

Running

without monitor

PAULMON2

with PAUL's

startup header

9600, 8n1

P3.0 (RxD) 

and P3.1 (TxD)

DC Motor Driver

Basic circuit of using L293 forms an H-Bridge Driver is shown in Figure 1. As shown for such inductive load as DC motor, external diodes for suppressing back EMF must be connected. The MiniBoard uses L293D instead, the L293D has internal diodes, however providing a bit less driving capacity, i.e., 600mA @4.5V-36V. From the truth table, we see that direction of the motor can control by pin C and D. VINH enable/disable power to the motor, thus for speed regulation, we then use this pin for PWM signaling. See details, L293.pdf data sheet.

Figure 1: Basic circuit of L293 forms H-Bridge Driver

A circuit connecting C-52 P1 to L293 driver chip is shown in Figure 2. As shown Enable pin 1 connected to P1.0 is for PWM signaling. We use additional inverter at pin7 and pin 15 to provide proper logic for easy directional control. Please note that pin 4,5,12,13 are tied to ground and if heat sinking needed, one method is to make a large area of PCB or soldering it with a metal sheet, say. 

My latest design put additional inverter for PWM signal at pin 1 and pin 9 to prevent full power delivering to DC motors when resetting the C52(i.e., all bits of P1 is logic high). Check the logic of PWM pins for another microcontrollers. 

Figure 2: Connecting C-52 EVB P1.4-P1.7 to L293. External diodes must be connected for L293(not shown in circuit diagram).

Line Tracking Sensor (I have to KUK)

Since there's no ADC for C52 chip, each competitor may build their own Line Tracking Sensor, some may use LM339 QUAD comparator with IR transmitter and receiver, some may use LDR as described in Line Follower Robot . With an external comparator, it may not necessary to have ADC, but with LDR, we need external ADC. " Having additional ADC for C52 would be better", I thought. How can we provide ADC for C52 with a cheap method? I chose PIC16C711 with 4-channel ADC, and 7-pin input port. Interfacing to C52 is done with simple PISO protocol by using RB0 for SCLK and RA4 for SDA. The code for such purpose was written in C, here is the source file, C52ADC.C and the HEX code, C52ADC.HEX. After some initialization, the 711 chip wait for trigger read signal at pin RB0, i.e., high-to-low transition, then it responses by sending 40-bit through RA4(SDA) with low-to-high transition. 40-bit data stream begins with LSB of ADC0 to MSB of PORT B. Example of program fro testing ADC is ADC.C and the hex file is ADC.HEX. 

16C711 to be a 4-channel ADC and 7-bit input port for C-52 EVB.

Figure 3: Using PIC

Use a C-52 EVB for simple robot experiments. Build a simple two wheels robot with L293D H-Bridge driver and IR sensors. Write a C program controls robot tracked with black tape. Fun with Ving-Peaw Competition 2543, course layout, day-by-day changed rule and scoring also included! 

[size=+1] 

[size=+1] Introduction One of my student has made a disgraceful robot that used two stepper motors and with a simple IR sensor. Yes, above picture is what I'm talking. Without battery carrying, a little bit torque of the stepper and misalignment of driving shaft, makes it crawling not walking, but first demo, showed quite impressive to me. He said he wrote a couple of program lines using C, his robot can track the black tape. I feel delighted his intention and endeavor. I thought, " he borrowed me DS5000, expensive one, a soft uController with internal bootloader, why shouldn't try with our learning board C-52 Evaluation Board instead". Another one, told me the same day "I found the L293 Push/Pull Four Channel Driver at Ban-Moah, it costs 1.5 US$ ". I've been searching this chip for a year. The www.media.mit.edu/people/fredm/papers/mb/]MiniBoard[/url], a Motorola 68HC11 Robot Controller board designed by www.media.mit.edu/people/fredm/]Fred G. Martin[/url], also uses this driver. The day after, I then decided to prepare the page describing how to use C-52 EVB as a robot controller board. I asked my student for competition, build yourselves robot that can track the black tape. Prize for the winner is 100 US$, with a bit condition that the winner must pay for a big party at Soi Jinda's Somtum (Papaya Salad) shop. And one of the competitor is me. I thought the rule should be conceived roughly by students and technically by me. The picture on that day will put here soon. [size=+1]C-52 EVB resources Beforehand, let look at available resources of C-52 EVB for robot experiments. Actuators DC motor PWM with timer2 helps P1.4,P1.5,P1.6,P1.7

Sensors digital/analogIR detectorwith comparator chip/ for analog input, see use of PIC16C711digital input/T0,T1 for pulse input 

Brain C program available code and data space approx. 32kB 8000H-FFFFH

Program DownloaderRunningwithout monitorPAULMON2with PAUL'sstartup header9600, 8n1P3.0 (RxD) and P3.1 (TxD)

[size=+1]DC Motor Driver Basic circuit of using L293 forms an H-Bridge Driver is shown in Figure 1. As shown for such inductive load as DC motor, external diodes for suppressing back EMF must be connected. The MiniBoard uses L293D instead, the L293D has internal diodes, however providing a bit less driving capacity, i.e., 600mA @4.5V-36V. From the truth table, we see that direction of the motor can control by pin C and D. VINH enable/disable power to the motor, thus for speed regulation, we then use this pin for PWM signaling. See details, L293.pdf data sheet. Figure 1: Basic circuit of L293 forms H-Bridge DriverA circuit connecting C-52 P1 to L293 driver chip is shown in Figure 2. As shown Enable pin 1 connected to P1.0 is for PWM signaling. We use additional inverter at pin7 and pin 15 to provide proper logic for easy directional control. Please note that pin 4,5,12,13 are tied to ground and if heat sinking needed, one method is to make a large area of PCB or soldering it with a metal sheet, say. Figure 2: Connecting C-52 EVB P1.4-P1.7 to L293. External diodes must be connected for L293(not shown in circuit diagram). My latest design put additional inverter for PWM signal at pin 1 and pin 9 to prevent full power delivering to DC motors when resetting the C52(i.e., all bits of P1 is logic high). Check the logic of PWM pins for another microcontrollers. [size=+1]Line Tracking Sensor (I have to KUK) Since there's no ADC for C52 chip, each competitor may build their own Line Tracking Sensor, some may use LM339 QUAD comparator with IR transmitter and receiver, some may use LDR as described in Line Follower Robot . With an external comparator, it may not necessary to have ADC, but with LDR, we need external ADC. " Having additional ADC for C52 would be better", I thought. How can we provide ADC for C52 with a cheap method? I chose PIC16C711 with 4-channel ADC, and 7-pin input port. Interfacing to C52 is done with simple PISO protocol by using RB0 for SCLK and RA4 for SDA. The code for such purpose was written in C, here is the source file, C52ADC.C and the HEX code, C52ADC.HEX. After some initialization, the 711 chip wait for trigger read signal at pin RB0, i.e., high-to-low transition, then it responses by sending 40-bit through RA4(SDA) with low-to-high transition. 40-bit data stream begins with LSB of ADC0 to MSB of PORT B. Example of program fro testing ADC is ADC.C and the hex file is ADC.HEX. Figure 3: Using PIC16C711 to be a 4-channel ADC and 7-bit input port for C-52 EVB.[size=+1]Simple Power Supply and Charger Circuits Figure 4 shows a simple power supply circuit. I have tested with KABO, it works fine. For those who have a big capacity rechargeable battery, the resistance value of R can be selected for approx. 10% output charging current. DC in can be higher if your battery voltage higher than 8.4V, say. To ensure the output current is within the value calculated by R, measure DC current before. The maximum supply for LM317 is ~35V. Figure 4: Circuit Diagram of battery supply +12V Alkaline and +8.4V NiMH with a constant current recharger circuit. For ~20mA, use R~60 Ohms. S1 is main switch for CPU and L293 circuits.[size=+1]Using PAUL's Startup Header file with Micro-C Before writing PWM generation for testing above circuit, let study how to use Paul's header. With a PAUL's startup header at the beginning of the application C program, after successfully downloading the hex code, just press RESET, the C52 then will run the application instead of PAULMON2 monitor program. As long as the program remain in SRAM, running the program can only be done with pressing RESET. To return to PAULMON2 prompt, turn the board power off for a while, then back the power on again. This concept of startup header allows us to use C-52 EVB as a dedicated controller beside as a learning board. Originally Paul has made with entirely in Assembly code. However, I have adapted for Micro-C Compiler. I have put the header for startup code in the startup and runtime library for small memory model. The file C52ROBOT.ASM, will compile and link to the main( ) function with S=c52robot.asm when invoking command coordinator. Example of command line is; [size=+1]c:\\mc\\cc51 %1 -ilp h=c:\\mc m=s s=c52robot.asm [size=+1]%1 is hello(.c), say Let try hello.c and compile with above command line, download the hello.hex into the C-52 board, then press RESET, see what happen? [size=+1]Manual Control Program demonstrates PWM generation with KABO One method of delivering DC power to motors is to use PWM. The PWM method supplys DC pulse with fixed frequency but with adjustable duty cycle. I used TIMER2 in AUTO reload producing 1000Hz PWM frequency. Each time executing has entering into service routine, a 16-bit PWM1 was shifted out to P1.7 and PWM2 to P1.6. Main program has a task that set the power for motor1 and motor2 by writing 16-bit PWM pattern into PWM1 and PWM2 for motor1 and mortor2 respectively. The service routine for timer2 is put in startup code. See example program, KABO1.C and C52ROBOT.ASM, for PWM demonstration with manual control. I have designed and built my own robot for the competition also. It names KABO having differential drive method. As shown in right-hand side, is the rare part powered by C52-EVB. The motor driver chip L293D and a 74LS04 are put at the soldering pad. [size=+1]Ving-Peaw Competition I suppose there should have ten robots to be competed. Details Rule and Scoring will be launched soon, day by day changed. But first of all, competitors must know how difficult of the circuit and programming are. Hear is the actual course layout. Figure 4: Actual Course Layout for Ving-Peaw Robot CompetitionThe original idea of what kind of the competition would be, came from Zongwit. Each round has two robots. Each robot must run along black tape and try to touch the the other's target. Who touch first will be the winner. The slower is allowed to detect the faster, shifted out of the line for 20 seconds, then back again. No limit for the robot size and uControllers, you may use ranging from a PIC16F84, 16F873/877, C2051/4051, C51/52/55, or 68HC11, say.

参考网站 :http://chaokhun.kmitl.ac.th/~kswichit/c52robot/c52robot.htm

支持(0) 中立(0) 反对(0)  

Azero小大  7楼 个性首页 | 博客 | 信息 | 搜索 | 邮箱 | UC 

加好友 发短信 

等级:侠之大者 帖子:556 积分:4732 威望:0 精华:0 注册:2008-5-5 9:54:00 

   Post By:2008-11-5 18:35:00 

牛人,太强了.

支持(0) 中立(0) 反对(0)  

loveshu1216小大  8楼 个性首页 | 博客 | 信息 | 搜索 | 邮箱 | UC 

加好友 发短信 

等级:黑侠 帖子:628 积分:5195 威望:0 精华:0 注册:2008-5-5 9:51:00 

   Post By:2008-11-5 18:35:00 

比我们书上的全面多了。

强。。

支持(0) 中立(0) 反对(0)  

nyqs小大  9楼 个性首页 | 博客 | 信息 | 搜索 | 邮箱 | UC 

加好友 发短信 

等级:职业侠客 帖子:433 积分:3740 威望:0 精华:0 注册:2008-5-5 9:52:00 

   Post By:2008-11-5 18:35:00 

有这么好的资料发出来了,真实太好了,谢谢

支持(0) 中立(0) 反对(0)  

yanhuaizhi小大  10楼 个性首页 | 博客 | 信息 | 搜索 | 邮箱 | UC 

加好友 发短信 

等级:黑侠 帖子:740 积分:6205 威望:0 精华:0 注册:2008-5-5 9:53:00 

   Post By:2008-11-5 18:35:00 

正在学习,可以用上了

文档

自动寻迹小车设计原理

自动寻迹小车设计原理*  PostBy:2008-11-518:34:00摘要:本寻迹小车是以有机玻璃为车架,ATmage32L单片机为控制核心,加以直流电机、光电传感器和电源电路以及其他电路构成。系统由mage32通过IO口控制小车的前进后退以及转向。寻迹由RPR220型光电对管完成。关键词:ATmage32L直流电机光电传感器自动寻迹电动车Abstract:Thesmartcarisaluminumalloyforthechassis,ATmaga32LMCUasitscore,inclu
推荐度:
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top