利用AVR单片机对直流电机的精确控制(上)

  • 格式:pdf
  • 大小:385.35 KB
  • 文档页数:19

摘 要本文介绍了用PWM实现直流电机调速的基本方法。

本文在给出直流电机调速和PWM实现方法的基础上,提供一种用单片机软件实现PWM调速的方法,以及直流电机调速的相关知识和PWM调速的基本原理和实现方法。

介绍了基于AVR单片机用软件产生PWM信号的途径,在给出直流电机调速的实现方法的基础上,提供一种用单片机软件实现调速的方法。

同时它也是管道机器人和国家863课题研究的一个分支,具有极强的实用性。

系统以AVR单片机为核心,以小直流电机为控制对象,实现速度单闭环、PID 控制.方便的人机对话接口,用键盘输入有关控制信号及参数,可以实现电机的启制动、正反转、速度调节.并在LED上实时显示输入参数及动态转速.为实现系统的微机数字化控制,在设计中,采用了AVR单片机作为整个控制系统的控制电路的核心部分,配以各种显示、驱动、测量对模块,实现对电动机转速参数的显示和测量;主电路由整流电路、滤波电路、即功率变换模块组成,控制电路以单片微机为核心,组成包括电流检测模块、转速检测模块、保护模块。

在设计中,采用PWM调速方式,通过改变PWM的占空比从而改变电动机的电枢电压,进而实现对电动机的调速。

为了提高控制系统的性能和可靠性,设计中,对电流环和转速环采用PID调节器。

在软件实现中,采用位置式PID控制算法来实现对系统PID参数的整定,得到PID调节器的比例、积分、饱和积分修正系数、积分时间等参数,由于篇幅原因计算过程未列如本论文内容中,只是在最后程序中直接赋予各值。

设计的整个控制系统,在硬件结构上采用了大量的集成电路模块,大大简化了硬件电路,提高了系统的稳定性和可靠性,使整个系统的性能得到提高。

关键词:AVR单片机; PWM; 直流调速系统ABSTRACTThe paper introduces a basic kind of method of DC-motor speed modification based on PWM theory. Showing some relative knowledge upon DC motor speed modification, the PWM theory and the way to implement. It emphasizes on the way for carrying out PWM signals based on A VR.Taking A VR Single Chip as core and the little direct current motor as control object, the single closed loop speed control and PID control were realized. In the convenient man-machine interaction interface, the control signal and parameter were inputted with keyboard so that the start and brake of motor and speed regulation were also realized. To achieve the computer digital control, in terms of design, used A VR as a whole control system of the control circuit core, and with all that driving, Measurement of modules to achieve the parameters of the motor speed display and measurement; rectifier circuit by circuit, the filter circuit, that the power conversion module components, the control circuit for a microcomputer core consists of current detection module, speed detection module, protection module. In the design, using PWM speed control mode by changing the duty cycle of the PWM thus changing the motor armature voltage, thereby realizing the right motor speed control. In order to improve the control system performance and reliability, and design, the current loop and speed loop PID regulator. In software, I used location PID control algorithm to achieve the right system PID tuning parameters, PID controller is the ratio of integrals, integral saturation correction factor, the parameters such as integration time, Due to reasons of space calculation manifested as if this thesis, it is in the final process directly give the value. Design of the entire control system, the hardware structure using a large number of IC module greatly simplifies the hardware circuit, improve the system's stability and reliability of the whole system performance is improved.Keywords :A VR; PWM; DC converter system目录引言 (1)第一章 概论 (2)1.1设计项目的发展情况简介 (2)1.2 单片机控制PWM直流调速系统发展趋势 (3)1.3单片机控制PWM直流调速系统基本原理 (3)1.3.1 直流电机调速原理 (3)1.3.2 PWM 基本原理及其实现方法 (4)第二章 PWM 调速系统的组成及选择 (7)2.1 ATmega8单片机简介 (7)2.2 电机驱动芯片LMD18200 (8)2.3 LCD显示器 (12)2.4 电动机选择 (13)2.5 电机转速测量器 (14)第三章 控制系统硬件设计 (16)3.1 系统工作原理 (16)3.2 ATmega8实现PWM控制 (16)3.3 驱动电路设计 (17)3.3.1 驱动电路原理 (17)3.3.2 驱动接口设计 (19)3.4 编码器设计 (20)3.5 电机转速测量设计 (21)3.6 显示电路设计 (23)3.6.1 LCD液晶显示器引脚说明 (23)3.6.2 LCD1602的指令 (24)3.6.3 显示模块与单片机电路连接 (27)3.7 按键电路设计 (27)3.7.1键盘原理 (27)3.7.2 键盘与单片机的接口电路 (28)3.8 电路板的制作 (28)3.8.1电路板的设计步骤 (28)3.8.2电路板布线技巧 (30)3.8.3设置中的问题及解决方法 (30)第四章 系统软件设计 (33)4.1主程序设计 (33)4.2 数字PI控制 (34)4.3 中断服务程序设计 (35)4.4 控制程序 (36)4.5 调试程序 (38)结束语 (40)致谢 (41)参考文献 (42)附录 (43)引言直流电机是工矿、交通、建筑等行业中的常见动力机械,是机电行业人员的重要工作对象之一。

作为一名电气控制技术人员必须熟悉直流电机的结构、工作原理和性能特点,掌握主要参数的分析计算,并能正确熟练地操作使用直流电机。

直流电动机具有优良的调速性能和启动性能。

直流电动机具有宽广的调速范围,平滑的无级调速特性,可实现频繁的无级快速启动、制动和反转;过载能力大,能承受频繁的冲击负载;能满足自动化生产系统中各种特殊运行的要求。

而直流发电机则能提供无脉动的大功率直流电源,且输出电压可以精确地调节和控制。

由于直流电动机具有良好的启动和调速性能,常应用于对启动和调速有较高要求的场合,如大型可逆式轧钢机、矿井卷扬机、宾馆高速电梯、龙门刨床、电力机车、内燃机车、城市电车、地铁列车、电动自行车、造纸和印刷机械、船舶机械、大型精密机床和大型起重机等生产机械中。

在各类机电系统中,由于直流电机具有良好的起动、制动和调速性能,直流调速技术已广泛运用于工业、航天领域的各个方面。

最常用的直流调速技术是脉宽调制(PWM) 直流调速技术,它具有调速精度高、响应速度快、调速范围宽和耗损低等特点。

正因直流电机的精确控制其应用领域广泛,所以它是管道机器人和国家863课题研究的一个分支,具有极强的实用性。

本系统是以A VR单片机为基础开发的精确控制直流电机系统。

利用AVR单片机控制直流电机使其实现精确的正转、反转、调速等功能。

本调速系统利用ATmega8单片机产生的PWM 信号,加入数字PID算法实现对电机速度的控制,提高了系统的控制精度,保证了电机转速的稳定性;电机的启动、停止、左右转和速度都由程序定义,调试时只需修改PWM信号占空比即可实现速度控制,改变输出口电平即可实现电机正反转,无须改变系统硬件电路,即可实现各种控制,能有效缩短开发周期,提高效率;结合了受限倍频单极性可逆PWM电机驱动电路,增强了系统的驱动能力,提高了系统的可靠性和性价比。

电路设计简单,电机控制方便,有利于广泛推广。

本系统调速精度高、响应速度快、调速范围宽和耗损低。

可广泛运用于工业、航天领域,特别是国家科研项目管道机器人等领域中。

第一章 概论随着计算机进入控制领域,以及新型电力电子功率元器件的不断出现,使采用全控型的开关功率元件进行脉宽调制(pulse width modulation,简称PWM)控制方式已成为绝对主流,这种控制方式很容易在单片机领域中实现从而为直流电机控制数字化提供了契机。