Page 1 of 2

Simple Servo Control

Posted: Mon Sep 13, 2010 4:58 pm
by bsmithyman
Version: 1
Status: Under development
License: BSD
Download: /files/project_builds/busservo.zip

This is a reposting of my "Servo Driver Fragment" from XMOSLinkers.
Basically this is just a really simple single-thread code for driving RC servos. I'm sure there's a smarter way to do some of these steps (the for-loop over signal pins is a bit of a busy wait). This should be relatively high-performing though, and it's easy to fit to any port size. I'm sure it wouldn't be hard to go from here to using a multiplexed output, but I only need a few channels.
This should work on just about anything you can hook it up to, but the demo code is set up to use ports on the XC-1. Note: The timing accuracy is improved quite a bit by compiling on the "Release" profile in the XMOS tools. This should give just over ~1.2 us resolution on each servo pin (assuming an 8-bit port). The error is quite a bit higher (thought possibly still within the error of most servos) if compiled using the "Debug" profile.
Video:


Re: Simple Servo Control

Posted: Mon Sep 13, 2010 5:00 pm
by bsmithyman
I haven't been using this much lately, so no updates since the XMOSLinkers post. This should work just fine on any of the boards with a port reassignment.

I use a 5V octal buffer to protect the pins on the XMOS chip, just in case the servo melts down.

Re: Simple Servo Control

Posted: Wed Sep 15, 2010 3:51 am
by rp181
This should be helpful for my helicopter project! Let me know if i can help.

Re: Simple Servo Control

Posted: Wed Sep 15, 2010 11:27 pm
by bsmithyman
Sure, feel free to take a look and let me know if there are any issues with it. It should work mostly out of the box, and it's designed to use one thread and one multi-bit port, but handle everything else automatically. It should be fast enough to do simultaneous movements in robotics, etc. without any trouble. I've tested it no problem.

The 3.3V signals work fine in my testing, but to be safe I would suggest boosting them to 5V with a buffer of some kind (e.g. 74HC244) so you don't risk frying the XMOS chip if you melt a servo and drive 6V or 7.2V back into the I/O bus. Also that should make the comparator in the servo happier.

Re: Simple Servo Control

Posted: Fri Sep 17, 2010 8:15 am
by wardy
I'd quite like to follow your progress - this could actually save me some R & D with my project. Good luck with it.

Re: Simple Servo Control

Posted: Fri Oct 29, 2010 8:23 pm
by bsmithyman
No major updates, but I just wanted to point out that this works great out of the box with the XMOS breakout board for bluetooth and servo headers; just set the output port to the right 8-bit port, and you have 8 servo channels. Takes about 5 minutes to make it work on the XK-1 (changing which core things are on, etc.).

Re: Simple Servo Control

Posted: Sat Oct 30, 2010 12:56 am
by RogerH
Hi bsmithyman,

Tell me more about the XMOS breakout board. I have not come accross this in roaming the XMOS sites.

Cheers, Roger...

Re: Simple Servo Control

Posted: Tue Nov 02, 2010 7:15 am
by bsmithyman
Hi Roger,

My understanding is that XMOS made a few for internal use and the like. It's not for sale, but they included one with an XK-1 board in the Pass-the-Parcel contest, which I won. The development documents are available on the XMOS website under the XK-1 section. This includes a Roving Networks RN-41 bluetooth adapter and a bank of servo pins connected to the 8-bit port. The servo high line isn't connected to the XMOS board, so you can drive 5V, 6V, 7.2V, etc. to the motors.

Re: Simple Servo Control

Posted: Wed Nov 10, 2010 10:25 am
by RogerH
Hi,

Thanks, I see that they are still putting this combination out in the parcels. Maybe I will win one.. here's hoping.

Regards, Roger...

Re: Simple Servo Control

Posted: Fri Dec 03, 2010 9:49 pm
by bsmithyman
After some discussions in the forums, I've got a few ideas for ways to improve this project, and will be trying to find some time to implement them soon. If you're looking at this and I haven't released a new version in December, feel free to bug me about it.