Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!snorkelwacker!ai-lab!mikec From: mikec@wheaties.ai.mit.edu (Mike E. Ciholas) Newsgroups: comp.robotics Subject: Re: Cheap servos. Message-ID: <8724@wheat-chex.ai.mit.edu> Date: 25 May 90 01:33:57 GMT References: <56631@bbn.BBN.COM> <8115@brazos.Rice.edu> Reply-To: mikec@wheat-chex.ai.mit.edu (Mike E. Ciholas) Distribution: usa Organization: MIT Artificial Intelligence Laboratory Lines: 49 In article <8115@brazos.Rice.edu> adnan@rice.edu (Sarmad Adnan) writes: >I need to control RC/Model-Aircraft type pwm servos from >a computers parallel port. Specifically what I am looking for >is a circuit to use an 8-bit TTL I/O port to control a few of these >servos for a robotic gripper. I remember seeing such a circuit >a long time back in a British electronics magazine but can's seem >to find anything like it now. >-Sarmad Adnan. It is actually very simple. The servos expect three signals, ground, plus 5 volts, and a pulse signal which is TTL compatible for the most part. Simply wire the servo power leads to a power source (best not use the same one as for the computer with the motor noises on it) and then hook the signal lead straight into the parallel port. There, no circuit at all! The pusle signal carries no current, so you don't have to buffer it. The servos expect a positive pulse that varies from 1 to 2 mS in duration. They will operate best with a repeat period of about 16 to 20 mS which is what they get from an rc radio receiver. If you do not deliver any pulses, the servo will become limp. Generally, you can drive 8 servos from an 8 bit parallel port by sequencing through them one at a time and using an interrupt generated by a timer. It works like this: interrupt routine: 1. set all bits low 2. get next servo value from servo value array (8 entries, say) 3. set the bit high that corresponds to the servo 4. load interrupt counter 5. return from interrupt main code: simply set the servo value you want in the servo value array. In step 2, you just cycle through all the servo values. You can expand this idea to add another array that indicates whether a servo should be limp or not for more flexibility. Also, for inproved timing accuracy, you can use the "change an output bit" option on most timers so that software overhead won't add variability to the output pulse (liek the variable interrupt latency). (Why, yes I have done this, why do you ask? :-) Mike Ciholas email: mikec@ai.mit.edu snail: 289 Highland Ave, #108/Somerville, MA 02144 phone: (617) 623-3563 air: N1909C, 1954 Cessna 170B