PDA

View Full Version : [Question(s)] servo and motor controllers



csdude
06-14-2008, 04:49 PM
I have been reading up on some things and have a few questions about servo and motor controllers. The preferred way, it seems, is to connect a motor controller to a servo controller and control the motors of a robot by sending 'commands' to the servo controller. correct?
I read that here: http://www.trossenrobotics.com/store/c/2664-Motor-Servo-Controllers.aspx

Is the motor controller hooked up to one channel on the servo controller only ? Or is there a channel/hookup on the servo controller for each motor connected to the motor controller?

So for example say I have a robot with two dc motors and a servo somewhere:

Do I use 3 servo controller channels ?
[1] motor 1
[2] motor 2
[3] 'that' other servo ?

Also, I assume, in the situation above that I only have to talk to the servo controller if I want to do 'something' with the motors and not really have to worry about the motor controller. correct ?

Are there libraries for Linux and for Windows that I can use to talk to the servo controller ?
(or is that just a matter of sending 'commands' to/on some io port ?)

What controllers and combination of controllers (that I saw in the page above) are easiest/best
to use in C ? Do the controllers come with drivers ? Or is there an API ? (I want students to communicate with the board(s) in C (in Linux, maybe in windows but chances are slim for windows)

thanks,

Ron

lnxfergy
06-14-2008, 08:56 PM
You are correct that you will need one servo channel for each motor (if you want to be able to control each separately). If they are attached to the same servo channel, they will go the same speed, they cannot vary in relation to each other.

Thus, for two motors in a differential drive setup, you need 2 channels.
If you are doing more of a car style, with steering and speed, you may find that your steering is actually a servo itself and does not require a motor controller.

One of the reasons people like to use motor controllers that connect to a servo controller is because they already have the servo controller. Most advanced controllers take either a servo input, or a serial port input. Since your servo controller typically needs a serial port (and most computers have a very limited number of serial ports) you end up almost needing the servo-channel motor controller. (this argument of course is starting to falter given USB support and nearly unlimited number of ports, but of course many popular products such as the SSC-32 still use good old RS-232, and drivers can be finicky for USB)

You are correct that if you go with a servo-port motor controller you just have to talk to the servo controller - it tells the motor controller what to do.

As for drivers, it varies based on product. For instance, the SSC-32 gives you 32 channels of servo control via the serial port. Since the serial port is nice and standard you can program in almost any language that provides serial port support: Java/C/Python.... The SSC-32 takes easy commands over the port, you can write your own API (I believe there is also some great sample code out there, I know one this board's members has posted a Python example over at Lynxmotion's forums). Any USB-based product would probably have a ore-canned API and drivers (unless it appears as legacy serial port to the computer). Unfortunately, someone else will have to answer about any other products....

-Fergs

csdude
06-14-2008, 10:39 PM
Hi Fergs, thanks for the elaborate reply.

Ok, cool, one servo channel per motor, that's cool.

If there is 'just' a dc motor for driving and a servo for steering involved I can do both the driving and steering with servo style communication.
btw: if the rc car is originally a 2-speed or so, does hooking it up to a motor controller and servo board make it proportional ?

The number of serial ports is something I take into account. I have a pico ITX board and that one has only one rs232 port. I want to save it in case I need some hardware that only can be hooked up with serial. (so far so good, a lot comes with USB nowadays, even though more $$$)

What i like about serial is that it is just 'right there' you plug it in and the OS can't play with it.
USB, you plug it in and never know for sure what port etc the thing ends up at. That is just annoying.
Also, you're right when it comes to API's etc.. serial is just easir. (however some USB devices just act like they are hooked up to a serial port, but you still have to deal with the hide and seek thing)

At some point I want to put in a bunch of sensors, and I believe the board for that is a serial one too.

Of course when I find a car that already has servos that i can just use I can omit the motor controller. But a car like that is more expensive.
Besides, using a good motor controller and servo board might give you more precision.

I would like to access things in C, that just works better. (Especially because more things (software) need to be build). If there are already examples for how to use some hardware than that would be cool.. I'll check that forum.


So basically any combination motor controller with servo board would work ?


thanks,

Ron




You are correct that you will need one servo channel for each motor (if you want to be able to control each separately). If they are attached to the same servo channel, they will go the same speed, they cannot vary in relation to each other.

Thus, for two motors in a differential drive setup, you need 2 channels.
If you are doing more of a car style, with steering and speed, you may find that your steering is actually a servo itself and does not require a motor controller.

One of the reasons people like to use motor controllers that connect to a servo controller is because they already have the servo controller. Most advanced controllers take either a servo input, or a serial port input. Since your servo controller typically needs a serial port (and most computers have a very limited number of serial ports) you end up almost needing the servo-channel motor controller. (this argument of course is starting to falter given USB support and nearly unlimited number of ports, but of course many popular products such as the SSC-32 still use good old RS-232, and drivers can be finicky for USB)

You are correct that if you go with a servo-port motor controller you just have to talk to the servo controller - it tells the motor controller what to do.

As for drivers, it varies based on product. For instance, the SSC-32 gives you 32 channels of servo control via the serial port. Since the serial port is nice and standard you can program in almost any language that provides serial port support: Java/C/Python.... The SSC-32 takes easy commands over the port, you can write your own API (I believe there is also some great sample code out there, I know one this board's members has posted a Python example over at Lynxmotion's forums). Any USB-based product would probably have a ore-canned API and drivers (unless it appears as legacy serial port to the computer). Unfortunately, someone else will have to answer about any other products....

-Fergs

JonHylands
06-15-2008, 07:25 AM
What i like about serial is that it is just 'right there' you plug it in and the OS can't play with it.
USB, you plug it in and never know for sure what port etc the thing ends up at. That is just annoying.

Actually, if you're using Windows XP, its pretty easy to associate a given USB device (the specific device, not one just like it) with a given COM port. Once your device is plugged in, and the drivers installed and working, right click on "My Computer" and select "Properties", click on the "Hardware" tab, and push the "Device Manager" button.

If your USB device is just a virtual serial port, it will show up under "Ports (COM & LPT)"

Select the device from the sub-list under that, right click, "Properties", click on "Port Settings" tab, and push the "Advanced" button.

This dialog differs depending on the device, but you should always get a "COM Port Number:" drop-down at the top. Choose the port you want (even if it says "in use"), as long as you don't actually have anything plugged in that is using that port. You'll get a warning dialog:

"This COM name is being used by another device (such as... Do you want to continue"

Just click on "Yes", and hit "Ok" to close the other dialogs, and your port will be hard-coded. Note that this only sets the port for that specific USB port on your computer - if you plug it into a different port, you may have to do it again.

I'm pretty sure there's a way to do this under Linux as well, although I have no idea how...

- Jon

csdude
06-15-2008, 09:55 AM
Well, XP runs on the board I have but I doubt I'll let the students use it for this project though.



Just click on "Yes", and hit "Ok" to close the other dialogs, and your port will be hard-coded. Note that this only sets the port for that specific USB port on your computer - if you plug it into a different port, you may have to do it again.
- Jon

that is the problem. I built a 'docking station' for that rover I am building (mouse, cd-rom, floppy, keyboard etc.) That all is hooked up to a little hub and connects to the board with just one plug.
0f course I could never do that with regular serial, but it does mess with the ports.
In linux you can get around it by switching kudzu off but than if you have something new ...

what I wanted to say was that serial ports the 'old way' are straight forward . With usb it's a crapshoot where it will be but usb is really convenient.

Thanks! for the xp tip, I didn't know that one. I am starting to forget about XP (on vista for over a year). XP runs on the pico ITX but doubt I'll use it. Vista.... well I'm not going there with that rover (didn't even try). Linux seems to run really well and will make things easier to do.

lnxfergy
06-15-2008, 11:55 AM
If there is 'just' a dc motor for driving and a servo for steering involved I can do both the driving and steering with servo style communication.
btw: if the rc car is originally a 2-speed or so, does hooking it up to a motor controller and servo board make it proportional ?
...

So basically any combination motor controller with servo board would work ?

thanks,

Ron

I'd be especially careful of that last comment. A motor controller is rated for a certain amount of continuous current - if you motor draws more than that amount, the controller will likely explode.

One of the reasons I would HIGHLY recommend going with a slightly more expensive hobby-grade RC car/truck (rather than a toy like you would find in Radio Shack) is that they have standardized hardware. The servo will be a standard hobby servo that takes a normal waveform that hardware such as the SSC-32 can generate. A toy grade RC car might have some proprietary hardware for a servo. With any hobby-grade RC vehicle, you will have a servo for steering. The motor on a hobby-grade RC vehicle will be rated by the number of turns in the motor (27 is considered "stock" and is the most common, lower numbers mean higher current draw). RC electronic speed controllers are then rated, such as "19 turns or higher". The electronic speed control takes a servo-pulse input, and converts this to a voltage that it feeds to the motor.

As to 2-speed becoming proportional, I am assuming you are talking about a toy-grade vehicle, in which case your new motor controller will be replacing all of the electronic guts of the toy. In this case, yes, the new motor controller will provide proportional control - the low-end speed may still be limited based on the rated voltage that the motor works on...

-Fergs

csdude
06-15-2008, 04:48 PM
I think I meant it more in general, that any kind of motor controller and servo controller (that I found on here) will work together. Of course the motor controller needs to 'match' the motors.

I have actually two options. This RC model I saw (it's a new bright) has the body style where I can stuff all the electronics in. (and also has an appearance that can get me possibly more funding) It's not the kind you'd find at radio shack. I have another option in mind too (for an RC car) that I know has all proportional speed motors, I wanted to call the manufacturer to see if it actually already has servos I could just use.

If the first car won't work, I can still buy the second one. (The first one just has better options to make it look 'neat' The 2nd one doesn't have that. (And funding looks at how things look too)

I figured that I need a motor controller that can handle the motors (I saw several 'on here' with all kinds of Amp ratings.)

Adrenalynn
06-15-2008, 08:23 PM
The R/C car that you're looking at does indeed have one of the failings that Fergs mentions. It doesn't use a servo, but rather a steering motor. The cabling for it is kinda funky and it's a PITA to get to it because the case is plastic-staked down on it, and it's recessed. I'm still considering how best to non-destructively reverse-engineer it.

The control electronics are also a worst-case - monolithic single board, all multi-layer surface mount. That said, I have it mostly figured out already - except for that front steering control. Now that I write this it dawns on me that the front motor might be a stepper motor. That'd explain that mass of wires heading up there. Once I get power to it, I should be able to hear whether that's the case if nothing else. Then a multimeter will tell us the phasing on the motor and we'll be good to go with a stepper controller. Hmm. Back later!