Servo Control - C#?

General Robotics Forum - All aspects of robots and their applications. 

Bookmark this page:  YahooMyWeb Yahoo!  Google Google  Windows Live Favorites Windows Live  del.icio.us del.icio.us  digg digg  Add to Netscape Netscape
Subject Author Date
Servo Control - C#? c83k2 07-18-2008
If you were  Registered and logged in, you could reply and use other advanced thread options
Posted by on July 18, 2008, 10:15 am
Hi Guys,

First post on the group. Finishing up a PhD and I have been doing a
lot of instrument control the past few years through .NET applications
- C# primarily and recently became interested in a little side project
that would involve a tilt-pan servo controlled from the same. 2 Servos
only.

I have absolutely zero experience dealing with Servos. GPIB, D/A, A/D
- I've got it clocked, but this is new territory for me. Overall it
seems most servos are controlled by pulse length to determine angle of
turn. That's fine - I can generate those from my desktop NI D/A cards.

But I'm looking at looking at working from a laptop.

Any reccomends on a pre-packaged USB interface that I can address
through the C# applications? I'd be willing to spend some money if an
accessory was available that streamlined my .NET control. I would
rather focus on code than troubleshooting a baseline device I don't
fully understand.

I see something like this at ServoCity -
http://www.servocity.com/html/pc_servo_programmer.html
. Are these usually bundled with .NET libs? Or do you just use
standard serial interface libraries?

I'm completely ignorant. Any help is appreciated.

Jake

Posted by Gordon McComb on July 18, 2008, 1:17 pm
Time to Google.

USB-to-serial dongles appear to your PC (or laptop) as a serial port.
You write your code to that port. You'll need Framework 2.0 or later
unless you're okay with using an ActiveX control for the serial output.
What you hang on the dongle is up to you. A serial servo controller
works just fine; however there are ready-made USB servo controllers that
do this all-in-one so you save money. Parallax sells one such
controller. I've not used it but I've seen some C# code for it in the
Parallax forums. It's about 40 bucks.

Read up on servo control. Most people get this wrong and try to apply a
continuous stream of pulses, which is easy in the typical D/A card, and
is standard for PWM. That won't work with an R/C servo, which is not a
true PWM device. You need to put in delays between in each single pulse.
The nominal delay is 20ms. Your card may or may not have this feature,
but it seems a waste anyway when low-cost hardware (serial or USB servo
controllers) is available that will do it set-and-forget.

-- Gordon


c83k2@unb.ca wrote:
> First post on the group. Finishing up a PhD and I have been doing a
> lot of instrument control the past few years through .NET applications
> - C# primarily and recently became interested in a little side project
> that would involve a tilt-pan servo controlled from the same. 2 Servos
> only.
>
> I have absolutely zero experience dealing with Servos. GPIB, D/A, A/D
> - I've got it clocked, but this is new territory for me. Overall it
> seems most servos are controlled by pulse length to determine angle of
> turn. That's fine - I can generate those from my desktop NI D/A cards.
>
> But I'm looking at looking at working from a laptop.
>
> Any reccomends on a pre-packaged USB interface that I can address
> through the C# applications? I'd be willing to spend some money if an
> accessory was available that streamlined my .NET control. I would
> rather focus on code than troubleshooting a baseline device I don't
> fully understand.
>
> I see something like this at ServoCity -
http://www.servocity.com/html/pc_servo_programmer.html
> . Are these usually bundled with .NET libs? Or do you just use
> standard serial interface libraries?
>
> I'm completely ignorant. Any help is appreciated.

Posted by Si Ballenger on July 18, 2008, 2:58 pm
On Fri, 18 Jul 2008 07:15:03 -0700 (PDT), c83k2@unb.ca wrote:

>Hi Guys,
>First post on the group. Finishing up a PhD and I have been doing a
>lot of instrument control the past few years through .NET applications
>- C# primarily and recently became interested in a little side project
>that would involve a tilt-pan servo controlled from the same. 2 Servos
>only.
>I have absolutely zero experience dealing with Servos. GPIB, D/A, A/D
>- I've got it clocked, but this is new territory for me. Overall it
>seems most servos are controlled by pulse length to determine angle of
>turn. That's fine - I can generate those from my desktop NI D/A cards.
>But I'm looking at looking at working from a laptop.
>Any reccomends on a pre-packaged USB interface that I can address
>through the C# applications? I'd be willing to spend some money if an
>accessory was available that streamlined my .NET control. I would
>rather focus on code than troubleshooting a baseline device I don't
>fully understand.
>I see something like this at ServoCity -
http://www.servocity.com/html/pc_servo_programmer.html
>. Are these usually bundled with .NET libs? Or do you just use
>standard serial interface libraries?
>I'm completely ignorant. Any help is appreciated.
>Jake

Get a serial servo controller (~$40 or less) and connect it to
the computer using a USB to serial adapter. Then you can even
control the servos using a notepad batch file if you want.

Posted by Roland Latour on July 18, 2008, 8:28 pm
On Fri, 18 Jul 2008 07:15:03 -0700, c83k2 wrote:

> First post on the group. Finishing up a PhD and I have been doing a lot
> of instrument control the past few years through .NET applications - C#
> primarily and recently became interested in a little side project that
> would involve a tilt-pan servo controlled from the same. 2 Servos only.
>
> I have absolutely zero experience dealing with Servos. GPIB, D/A, A/D -
> I've got it clocked, but this is new territory for me. Overall it seems
> most servos are controlled by pulse length to determine angle of turn.
> That's fine - I can generate those from my desktop NI D/A cards.

See http://www.seattlerobotics.org/guide/servos.html (What's a servo-
quick tutorial)

> But I'm looking at looking at working from a laptop.
> Any reccomends on a pre-packaged USB interface that I can address
> through the C# applications?

IMHO the cheapest way to go is get an Arduino Diecimila microcontroller
with a motor/servo shield from adafruit.com, and elsewhere. USB
interface. 12 IO pins which can be used for PWM, ~490Hz. As Gordon McComb
said: "...nominal delay is 20ms." Don't use the unit without a motor
shield--I burned mine out trying that.

Can't help you with software-I use linux. Script package at
user.cavenet.com. Sorry.

Posted by Gordon McComb on July 19, 2008, 12:48 pm
Roland Latour wrote:
> Don't use the unit without a motor
> shield--I burned mine out trying that.

I'm curious if you mean you burned out your Arduino running an R/C
servo, or a standard DC motor? The signal input of an R/C servo is at
TTL level, and the AVR should be able to drive that. Some folks put a
~300 ohm resistor in line to limit the current draw, but it's not really
necessary. Ladyada's schematic for the motor shield shows the pins are
just passed through for the servo motor connections, with nothing
between (which is within acceptable practice).

-- Gordon


The site map in XML format XML site map
other useful resources:
Official Robosapien Website
Lego Mindstorms Website

Contact Us | Privacy Policy