dedicated motor controller protocols

Interested in Robotics? Here's the place to be.
Post Reply
L. Daniel Rosa
Posts: 400
Joined: Tue Dec 25, 2001 1:01 am
Location: Bellingham, WA
Contact:

dedicated motor controller protocols

Post by L. Daniel Rosa »

Good morning everyone. I'm considering building a dedicated controller for steppers and another for servos. I'm fairly familiar with the theory on how they work, but I'm at a loss to find the protocols in use for talking to such a controller.<p>I'd like to use an established protocol, but I'll write my own if I have to. As it is I'll probably be modifying the servo protocol I found (I only saw one so far, lots of wading through articles and asvertisements).<p>The servo protocol seemed simple enough, but the stepper one won't be so compact. Anyone have any links?
hlreed
Posts: 349
Joined: Wed Jan 09, 2002 1:01 am
Location: Richmond, TX
Contact:

Re: dedicated motor controller protocols

Post by hlreed »

I don't have a stepper motor controller, but I do have a servo motor controller.
It is SM node on my web page. It is bit serial in and servo out.
Be glad to send you the code if you don't need the hardware. Just ask.<p>
http://www.halbrain.com
Harold L. Reed
Microbes got brains
L. Daniel Rosa
Posts: 400
Joined: Tue Dec 25, 2001 1:01 am
Location: Bellingham, WA
Contact:

Re: dedicated motor controller protocols

Post by L. Daniel Rosa »

Thanks Harold. I probably won't need the code either. Right now I'm just trying to find the protocols.
hlreed
Posts: 349
Joined: Wed Jan 09, 2002 1:01 am
Location: Richmond, TX
Contact:

Re: dedicated motor controller protocols

Post by hlreed »

Servo protocal is:
Cycle is 20 milliseconds.
At cycle end:
1 millisecond is full counterclockwise (-128)
1.5 millisecond is center (0)
2 milliseconds is full clockwise (127)
1. read number
2. Produce pulse from number
3. produce 20 milliseconds space
4. go to 1.
This is how I do it.
Harold L. Reed
Microbes got brains
dyarker
Posts: 1917
Joined: Fri Aug 22, 2003 1:01 am
Location: Izmir, Turkiye; from Rochester, NY
Contact:

Re: dedicated motor controller protocols

Post by dyarker »

I think L. Daniel Rosa means a protocol between the controllers he's building, and a PC or master microcontroller. As Harold said, the signal needed by a servo is already specified. Stepper motor signals will depend on motor type.<p>For PC to controller protocol I would guess RS-485 as most popular. CAN is another posability. A servo will need one data byte. 255 for max one way, 128 for center, 0 for max the other way. Not much room/need to modify.<p>A stepper motor controller could need two or three data bytes. Direction, number of steps or continuous, step speed. Following some standard would be more convenient, but not absolute neccessary. Each module would have a different address.<p>[ April 01, 2004: Message edited by: Dale Y ]</p>
Dale Y
L. Daniel Rosa
Posts: 400
Joined: Tue Dec 25, 2001 1:01 am
Location: Bellingham, WA
Contact:

Re: dedicated motor controller protocols

Post by L. Daniel Rosa »

Thanks Dale. Okay, maybe I'm using the wrong words here. As for hardware protocol I'll be using I2C. What I'm looking for is data structure. For servos I'll use what both of you have mentioned organized as:<p>[byte 0] device ID
[byte 1] servo #
[byte 2] position<p>I think Scott Edwards was credited with what this is derived from. It contrasts in that the first byte was originally FF to synchronize the bus. The third byte had a disallowed state of FF, which may prove useful to append more data for special tricks.<p>I've found one format that someone used for steppers, but it seems wasteful.<p>[0] device ID
[1] ASCII "+" or "-", direction
[2] ASCII 10k digit, steps
[3] ASCII 1k digit, steps
[4] ASCII 100 digit, steps
[5] ASCII 10 digit, steps
[6] ASCII units digit, steps
[7] ASCII ":"
[8] ASCII 100 digit, delay
[9] ASCII 10 digit, delay
[A] ASCII units digit, delay
ASCII linefeed<p>Twelve bytes to send 33 bits of useful data. I'm sure there's something better out there.
Engineer1138
Posts: 458
Joined: Thu Feb 05, 2004 1:01 am
Location: Minneapolis, MN
Contact:

Re: dedicated motor controller protocols

Post by Engineer1138 »

There used to be something called Serpos that was popular a few years back for networking motor controllers. Google may help here.<p>I think you'll find that unless you need to be interoperable with some legacy system, you're best off designing your own protocol and letting it evolve as your needs change (make one of the opening bytes/words a LENGTH field and the data frame can grow as need be)<p>As far as your comment about 12 bytes to send 33 bits of data: well, considering that the move usually takes MUCH more time than the data transmission, bandwidth is normally not an issue compared to the relative ease of monitoring/debugging ASCII serial protocols versus binary protocols.
L. Daniel Rosa
Posts: 400
Joined: Tue Dec 25, 2001 1:01 am
Location: Bellingham, WA
Contact:

Re: dedicated motor controller protocols

Post by L. Daniel Rosa »

Thanks E'8, I'll look into serpos.<p>I'll take the rest backwards- I suppose my (probably apparent) preference for a binary protocol is linked with my choice of native code instead of BASIC. I'm trying to get the most out of the items on hand.<p>As for bandwidth, I'm against a trilemma. The least is my lack of familiarity with RF black magic, so I figure that by keeping the bus speed down I'll have fewer nasties to iron out. The greater one is that I don't want to use interrupt service routines in this application, so by keeping the bus to 9k6 I'll be able to poll the I/O buffer once or twice per mS (depending on whether I use parity and stop bits) and not worry about speed glitches. The middle (and vying for first) is that even though one movement will last (likely) much longer than the command, I may be trying to coordinate two or four motors to propel and steer something in real time.<p>As for "legacy" v. home brewed, I'm afraid you're right. What I've seen so far hasn't matched my (future possible) needs. From the hobbyist side it's been a bit limited. From the commercial side, one of them had the brains in the controller (more appropriately stated as the controller subroutines appended to the brains). Another has some nice features on ganged motors, but from separate controllers and I won't have the space for internode communication subroutines (Man, my words are getting long!).<p>I'm not committed to anything yet though. So if anybody knows of something, please share the wealth.
dyarker
Posts: 1917
Joined: Fri Aug 22, 2003 1:01 am
Location: Izmir, Turkiye; from Rochester, NY
Contact:

Re: dedicated motor controller protocols

Post by dyarker »

oops, when I said "RS-485", I should have said "I2C". A lot of PICs and other microcontrollers have I2C built in. A very popular standard!
Dale Y
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests