Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: dcole07 on February 27, 2007, 09:26:37 PM

Title: Computer to multiple servos or sensors
Post by: dcole07 on February 27, 2007, 09:26:37 PM
How do you go from USB or some other port on a computer to servos, if the number of servos is greater than the number of pins.

Like using port numbers (80,21...) in the programming..
Do you use a microprocessor as a middle man to some how check where it needs to go? How does the process work in detail?
Title: Re: Computer to multiple servos or sensors
Post by: JesseWelling on February 28, 2007, 02:10:09 AM
Most definitely yes, you will need a microprocessor like a pic,avr or arm to interface between a computer and servos.

Heres probably what it will look like:
Computer USB<---->USB to Serial adapter<---->MicroProcessor<---->as many servo's as the MicroProcessor can Handle
or alternately:
Computer Serial<---->RS-232 to TTL level Shifter<---->MicroProcessor<---->as many servo's blah blah blah

So the general Idea is you could come up with any protocol you wanted to use.
You could transfer straight binary numbers or transfer ASCII or any combination of both.
So to move servos you have to send pulses from .5 milliseconds to 2.5 milliseconds.
If you encode that as 500 to 2500 it can be encoded with unsigned 16 bit integers.
So say you have 6 servos. So you could send ASCII A,B,C,D,E,F or G followed by the
16 bit integer (wich would be two bytes) and an escape character( like a . or a : or anything)
to flush the buffer. Or you could send all ASCII and use actual returns to help flush your buffers.

Hope that answered some questions. If you have any other Specific questions don't be afraid to ask.
Some companies also sell Serial to servo contraptions already made:
http://www.pololu.com/products/pololu/#servcon
Title: Re: Computer to multiple servos or sensors
Post by: Admin on February 28, 2007, 11:11:16 AM
if by chance you wanted to make your own usb servo controller, dunk wrote up this tutorial:
http://www.societyofrobots.com/member_tutorials/node/25