tag 标签: servo

相关博文
  • 热度 22
    2014-11-7 15:06
    2028 次阅读|
    1 个评论
    Several days ago, when I was having problems with one of my antique analogue meters, someone suggested replacing the failed movement with a servo. Though I ended up taking a different path, this made me realize that I've never gotten around to playing with servos, so I decided to rectify this situation.   The first thing I did was to buy four micro servos from Adafruit.     I also purchased one of Adafruit's servo shields . This little beauty can control up to 16 servos, and it interfaces to the Arduino via I2C, which means it uses only the two I2C pins on the Arduino. This is no loss to me, because I always end up using these pins to talk to one or more I2C-based shields.     Now, the best way for me to learn something is to work on a project. I've always been enthralled by robots, so I decided to build myself a pair of animatronic eyes.   Once everything had arrived, the first thing I did was to characterize the servos, which can rotate through 180°. Adafruit's example sketch uses minimum and maximum pulse widths of 150 and 600 (out of 4,096), respectively, but these values didn't appear to give me a full 180° movement, so I whipped up the setup shown below.     Here we see my four servos numbered 0 through 3 from left to right attached to a strip of wood to stop them from wandering around. I used Visio to create circles marked out in 5° segments, and then I cut these out of paper and attached them to the top of the servos under the horns (the black pieces of plastic that convey the motion of the servos to other objects).   I then created a simple program that starts by setting all the servos to their middle positions. The RGB LCD Shield shown in the foreground of the above image includes five buttons: Up, Down, Left, Right, and Select. My program uses the Select button to cycle among the servos. The Up and Down buttons rotate the selected servo clockwise and counterclockwise, respectively. These buttons take the servo to approximately 10 degrees from its full-scale rotation in the selected direction. Then I use the Left and Right buttons to rotate the servo clockwise or counterclockwise a degree at a time until I determine the extent of its rotation.   In the above image, we see that, for Servo 3, the minimum pulse width is actually 114, as opposed to the default value of 150 found in Adafruit's Sketch. In fact, I determined that all four of my servos had minimum pulse widths of 114, but their maximum pulse widths varied between 580 and 588.   The next step was to create the eyes themselves. I did this using a couple of Ping Pong balls mounted on short wood dowels that I painted black. For the purpose of these preliminary experiments, the servos are mounted on a small platform made of balsa wood.     After setting the servos to their center positions, the dowels were attached to the horns on the servos using superglue. Small triangles cut out of balsa wood are used to provide extra support.   Now take a look at the test setup shown below. The animatronic robot eye platform is sitting on top of a plastic box. Below this to the left, we see the servo shield mounted on top of one of the screw-block proto-shields created by Duane Benson and yours truly. This proto-shield is mounted on top of an Arduino Uno.     Just to the right of the Arduino-Shield stack, we see my trusty RGB LCD shield. In the foreground are two 10KΩ potentiometers. I drew the black circles on the Ping Pong balls before attaching them to the dowels and attaching the dowels to the servos. What with "this and that," they ended up not looking straight ahead.   My next step was to create another simple program that uses the left and right potentiometers to control the position of the left and right eyes, respectively, and to display the corresponding pulse widths being fed to the servos on my RGB LCD. This allowed me to determine the pulse widths required for each servo to look directly ahead. Everything else is calculated as looking some number of degrees left or right of the center position.   Actually, I'm pretty pleased with the way things are coming along for this first attempt. Take a look at this video and let me know what you think.     My next move will be to add eyelids that blink. Each eye can move independently (as you can see from the "squint" in the video), and I want the eyelids to blink independently, so that the assembly can "wink" at you.   In the fullness of time, I can see (no pun intended) these eyes residing in a wooden box. Whenever there's a sound or someone walks by, the lid of the box could raise up slightly, and the eyes could peek out and track the person as he or she moves around the room. As an alternative, I was thinking of a Mad Hatter's top hat, with the top peeled back as though it had been punched out and these eyes peeking out of the top of the hat.   Can you imagine wearing this hat on Halloween -- or possibly sporting the little beauty while walking around the Embedded Systems Conference (ESC). In my mind's eye, I can visualize ambling past someone and the animatronic eyes at the top of the hat "locking stares" and tracking that person as I stroll by.   Of course, I'm just dipping my toes in the animatronic waters here. If you look on YouTube, you'll see that other people have created some really amazing and sophisticated systems. My eyes can only look left or right, for example, but some folks have their eyes looking left, right, up, and down. The great thing here is that this gives me something to aim at for the future. Watch this space (again, no pun intended).
  • 热度 29
    2014-9-9 16:29
    1452 次阅读|
    0 个评论
    摘 要:分析了各种干扰对PLC和伺服驱动器作用的机理,从硬件和软件两个方面提出了相关的抗干扰措施。这些措施对于PLC系统在运动控制中的应用有一定的实用价值。  关键词:PLC;Servo;抗干扰;数字滤波 一 概述   随着工业控制技术的发展,PLC和伺服技术的到了长足的发展。PLC是专为工业生产环境设计的计算机控制设备,且有可靠性高、硬件配套齐全、用户程序简单易学且维护方便等优点而广泛应用于各行各业中;交流伺服电机控制采用了磁场定向矢量控制原理, 具有动态响应快、稳态运行精度高、转矩脉动小, 低速运行平滑等性能, 而且调速范围较大,做为进给传动装置得到了广泛的应用。PLC一般具备脉冲输出接口,所以以PLC和脉冲式伺服组成的简易数控系统是经济型机床的首选。   PLC和伺服都是专门为工业控制环境而设计的,因此本身可靠性强,所以在一般的控制系统中不用抗干扰设计或进行简单的抗干扰设计就可以使系统安全可靠地运 行。但在特别恶劣的应用环境中,如强电场、强磁场、剧烈的冲击和振动环境, 控制系统和执行机构并不一定能可靠地工作;另外,在对可靠性要求特别高的场合,就要对控制系统和执行机构进行特别的抗干扰设计。为提高系统的可靠性,首先 要认真分析相应的应用环境中各种可能产生干扰来源,在此基础上选择可靠性强的PLC及相关模块,从硬件的角度如工程设计、施工布线、使用维护等进行抗干扰 设计,另外,还要有针对性地从软件方面进行抗干扰设计。 二 系统中主要的干扰来源和抑制措施   干扰的来源众多,破坏了系统的稳定性。 系统的不稳定的主要表现为内部信息被破坏,导致控制系统混乱,执行机构误动作和网络出错,影响设备的正常运行。 2.1 PLC   从形式上讲, PLC控制系统的干扰分为两类:内部干扰、外部干扰。   内部干扰,是PLC本身的问题;   外部干扰,包括导线传入的干扰(由电源线、控制线各信号线等外部线引入的干扰) 、空间感应和辐射干扰、地线传入的干扰。   在现实的工业实际情况中,内部干扰的情况比较少见。下面首先分析来自外部的干扰。   (1)选用性能优良的电源,采取措施抑制电网干扰   在PLC控制系统中,电源占有极其重要的地位,也是干扰进入PLC的主要途径之一。电网线路上挂接了各种用电设备,如大功率电动机、交直流传动装置、变频 器、家用电器等等,这些设备的启、停会引起电网的电流电压波动,产生的幅值很大浪涌和高次谐波。如果使用PLC系统的交流供电电源,在干扰较强或可靠性要 求很高的场合,可以在PLC的交流电源输入端加接带屏蔽层的隔离变压器和低通滤波器,屏蔽层应可靠接地;也可以在初级、次级绕组之间加屏蔽层,并将它们和 铁芯一起接地,以提高高频共模干扰能力。   (2) 来自空间感应和辐射的干扰   大多PLC控制系统所处的空间中有各种各样的电场和磁场,这些电场、磁场无不影响着控制系统。电磁场(EMI)主要由电力网络、电气设备的暂态过程、雷 电、无线电广播、电视、雷达、高频感应加热设备等产生的;屏蔽效果差的PLC控制系统本身也会产生电磁场,所产生的电磁场反过来又影响控制系统本身。这些 电磁场统称为辐射干扰,其分布极为复杂。只要PLC控制系统处于辐射范围内,其就会受到干扰。控制系统受到干扰的程度和辐射的强弱和频率有关。辐射通过以 下两种途径影响PLC控制系统: ①直接对PLC内部的辐射,由电路感应产生干扰; ②对PLC通信网络的辐射,由通信线路的感应引入干扰。针对此种干扰,屏蔽、滤波和接地是三种主要的方法。   (3) 由信号线引入的干扰   相邻信号线上的串扰信号会在被串单线路上产生噪声或在被串线路对上产生耦合信号,即在被串线路上有串扰信号存在。由信号引入干扰会引起I/ O 接口信号工作异常和测量精度大大降低,严重时将引起元器件损伤。对于隔离性能差的系统,还将导致信号间互相干扰,引起共地系统总地线回流,造成逻辑数据变化、误动和死机。   (4) 由地线引入的干扰。   接地的目的有两个:一是为了安全;二是为了抑制干扰地线的连接方式不当,会引起地环流。   地环流在屏蔽线内部产生电磁场,进而干扰屏蔽线,造成信号的失真。   (5)不科学安装和布线   不同类型的PLC有不同的安装规范,如CPU与电源的安装位置、机架间的距离、接口模块的安装位置,1/O模块量、机架与安装部分的连接电阻等都有明确的 要求,安装时必须按所用的产品的安装要求进行。PLC应设有独立、良好的接地装置,接地电阻要小于100Ω,接地线不能超过20m,PLC不能与其它设备 共用一个接地体。PLC电源线、I/O线、动力线最好放在各自的电缆槽或电缆管中,线中心距要保持至少大于300mm的距离。模拟量输入/输出线最好加屏 蔽,且屏蔽层应一端接地。PLC要远离干扰源,信号线若不能避开干扰源,应采用光纤电缆。在室外安装时须采取防雷击的措施,比如在两端接地的金属管线中走 线。   为了减少动力电缆电磁辐射干扰,尤其变频装置馈电电缆引起的电磁干扰,决定采用两条基本原则:   一是在实际工程中,尽量采用铜带铠装屏蔽电力电缆,降低动力线产生的电磁干扰,这种方法的实际效果在许多场合被证明是非常有效的;   二是对不同类型的信号分别由不同电缆传输,信号电缆应按传输信号种类分层敷设,严禁同一电缆的不同导线同时传送动力电源和信号,避免信号线与动力电缆平行敷设,以减小电磁干扰。    在PLC控制系统中,硬件上的抗干扰设计是基础也是抑制干扰的根本的措施。除此之外,还可以在软件设计上,可以采用数字滤波和软件容错等经济有效的方法,进一步提高系统的可靠性。   (1)数字滤波   现场的模拟量信号经A /D转换后变为数字量信号,存人PLC中,再利用数字滤波程序对其进行处理,滤去噪声信号从而获得所需的有用信号。工程上的数字滤波方法很多,常用的有:平均值滤波法、中间值滤波法、加权滤波、滑动滤波法等。   (2)软件容错   尽管采用了各种抗干扰技术,但不能够完全杜绝干扰,干扰或多或少、或大或小总是存在的,并且在特定的条件下还有可能对控制系统造成大的干扰,因此,我们还 应该在程序编制中采取软件容错技术。所谓容错,就是在干扰不能避免的情况下,万一其对控制系统造成大的干扰而使系统出现异常时,控制系统能对其及时的进行 反应,并根据出错时的状态决定系统下一步补救措施。主要有以下容错技术:   ①程序重复执行技术:在程序执行过程中,一旦发现现场故障或错误,在某些情况下可以重新执行被干扰的先行指令若干次。若重复执行成功,说明引起控制系统故障的原因为干扰,否则是干扰以外的原因,此时应输出软件失败( Fault)并停机、报警。   ②对死循环作处理:在程序中设计了定时狗(WDT)程序,当定时超过原定时间时,可以断定系统进入了死循环。当控制系统进入了死循环,可以根据程序的判断,决定下一步是停机还是进入相关的子程序进行系统的恢复。   ③软件延时:为确保重要的开关量输人信号、易抖动信号的检测和控制回路数据采集的正确性,可采用软件延时15ms―20ms,并对同一信号多次读取,结果一致,才确认有效,这样可消除偶发干扰的影响。 2.2 伺服   伺服系统和PLC系统类似,PLC的外部干扰源和抗干扰措施同样适用于伺服系统。同时,伺服系统和PLC还有不同之处。伺服驱动器的抗干扰主要式防止干扰脉冲的输入。   (1)伺服驱动器的脉冲输入端口分为开路集电极方式和差分输入方式。由于开路集电极方式的抗干扰能力比差分输入方式的差的多,所以,选型的时候尽量选取含有差分输入方式的伺服驱动器。   (2)为了尽量减少伺服驱动器在没有上位定位指令的时候将干扰信号输入,在程序设计中要在没有脉冲输入时,将伺服驱动器的“脉冲输入禁止”信号激活,这样能有效的减少干扰脉冲的输入。   (3)伺服驱动器和伺服电机之间的连线要使用屏蔽线,线缆的拨开屏蔽层的部分不能大于75mm,屏蔽层要在伺服驱动器侧可靠接地。   (4)如果条件允许,应采用伺服的速度控制模式和上位控制器构成闭环控制。 三 实例   某公司生产了一种采用简易的数控钻床,控制系统为三菱公司的Fx系列的PLC,X、Y轴为伺服电机带动丝杠进行定位控制,Z轴为液压进给方式,主轴为变频器带动普通的三相异步电动机通过减速箱控制。在实际的调试中发现定位不准确。经检查发现,该机床的伺服电机在没有脉冲指令的时候仍然存在脉冲输入,且伺服驱动器收到的脉冲数和上位控制器PLC发出的脉冲数不相等,尤其是在变频器启动的瞬间,情况更为严重。所以判断此系统存在严重的干扰。   经过以上的分析,拟在PLC的电源处增加一个输入滤波器,PLC与伺服驱动器的脉冲信号连线采用屏蔽双绞线连接,并且使这根线尽量的短;在伺服驱动器的电 源处增加一个输入滤波器;在直流电磁阀处增加续流二极管,在交流接触器处增加浪涌吸收器;信号线和动力线分别敷设在不同的走线槽中并且间隔200cm;变频器的输入端增加一个输入滤波器,把变频器和电动机的连接线改用屏蔽电缆,并且在变频器侧良好接地;修改PLC的控制程序,使伺服驱动器上的“脉冲输入禁 止”信号在上位控制器没有脉冲输出的时候就生效。   经过改进,机床的性能完全符合要求。 四 结论   要提高设备的可靠性,一方面要求PLC和伺服的生产厂家进一步提高产品的抗干扰能力;另一方面要求在工程设计、安装施工和使用维护中,多方配合才能完善解决干扰问题,有效地增强系统的抗干扰能力。
  • 热度 29
    2013-8-23 10:13
    1740 次阅读|
    1 个评论
    Electronic engineers may love to play with small mechanical 'toys'. DC Servo Motor is one of these. Most of the time, if we do not overload the servo, the lifespan of the motor can be very long, in spite of the brushed design. However, some DC servos are out of order not because of the motor is burnt (or the brushes are ruined), but due to some components on the PCB. I have bought a brand-new DC analog servo from somewhere, it costs HKD $90. I write some codes on my STM32 platform to test it. The program is simple, which makes it to run back and forth in small steps. Fig.1 Newly bought RC servo After testing it (not continuously) for some time which was less than an hour, the servo motor suddenly became out of order... As usual, what wass going to be next would be a screwdriver with the servo motor! Haha   Fig.2 Ready to disassemble the motor with a screwdriver   Then the casing was opened, there were a control PCB assembly and the motor.   Fig.3 The casing is opened   Then the motor was powered on and PWM signals were given to the servo motor. I traced the signals from the motor. The signals inputted to the two Dual NMOS and PMOS ic, which formed a H-bridge, did not show any waveform, given the message that the later part of the circuit did not receive the control signal.   After that, I started tracing from beginning... I found that there are one of the two small SOT-23 transistors had some problems. The base terminal (pin 1) of the PNP transistor was LOW (turned on) and pin 3 (emitter) was 5V (supply voltage), but pin 2 (collector) was 0V... So the transistor was not functioning!   A soldering iron and utilities were prepared to replace the transistor   Fig.4 Prepare a solder iron to replace the transistor   I replaced the original transistor with a SS8550, keeping the other components unchanged. If it did not work, I would have tested other components.   Fig.5 Before and after transistor replacement   To my surprise, the servo motor worked normally again!! Yeah!  
  • 热度 29
    2013-5-28 17:15
    1390 次阅读|
    0 个评论
    My chum Matthew Villeneuve sent me an email leading me to his brother Pierre's "Smoked Bits" blog, which keeps the reader informed as to Pierre's "Project du Jour." One entry I really enjoyed was Pierre's Dancing Lego and Five Servos column. This involves a Raspberry Pi, five servos, and Pierre's son's Lego set, with the whole thing being synchronised to some "Groovy Music" (Pierre's words, not mine :-). I wish I could have done stuff like this with my dad when I was a kid. Unfortunately, what we used to call Lego simply involved plastic blocks you clipped together – no servos or microcontrollers or anything like that. Thinking about it, the Raspberry Pi would probably have counted as a supercomputer in those days of yore. It truly is amazing how fast and how far we've come...
  • 热度 21
    2013-5-28 17:11
    1259 次阅读|
    0 个评论
    I just got an email from my chum Matthew Villeneuve pointing me at his brother Pierre's "Smoked Bits" blog, which keeps the reader informed as to Pierre's "Project du Jour." One entry I really enjoyed was Pierre's Dancing Lego and Five Servos column. This involves a Raspberry Pi, five servos, and Pierre's son's Lego set, with the whole thing being synchronised to some "Groovy Music" (Pierre's words, not mine :-). I wish I could have done stuff like this with my dad when I was a kid. Unfortunately, what we used to call Lego simply involved plastic blocks you clipped together – no servos or microcontrollers or anything like that. Thinking about it, the Raspberry Pi would probably have counted as a supercomputer in those days of yore. It truly is amazing how fast and how far we've come...  
相关资源