Servo control

All technical discussions and projects around startKIT
karakter
Newbie
Posts: 1
Joined: Fri Jul 11, 2014 10:16 pm

Servo control

Post by karakter »

I am working on a project in which i need to control 12 servos. In the XMOS documentation I didn't find anything about servo control, so please, can anybody help me? Is there any library for this?


User avatar
JasonWhiteman
Active Member
Posts: 63
Joined: Mon Jul 15, 2013 11:39 pm

Post by JasonWhiteman »

Your servo control task should be answered by the datasheet of your servo devices.

One item to determine is the electrical interface in terms of voltage and current required to supply power and control signals to the servo. If your XCore is in a different power domain than your servo demands, you may need voltage translation and multiple power sources.

Secondly, you must determine the control type as shown in your datasheet. Most often, a PWM signal is used (varying duty of cycle of a fixed frequency) in order to position the servo. However, this does not describe all servo types and your servo datasheet should have a clear description of the signaling required to position the servo.

In all cases, the search engine is a powerful way to arrive at an answer and I would advise following your email up with your own set of links with servo research and specific questions on any gaps in understanding.

http://www.jameco.com/jameco/workshop/h ... -work.html
Details the PWM method

http://www.jameco.com/jameco/workshop/h ... -work.html
Sample datasheet -- you need to find your own servo's datasheet.

I have found success in contacting the servo manufacturer for the complete electrical specification for past servo projects.

Regards,
Jason
User avatar
asid61
Active Member
Posts: 36
Joined: Sat May 31, 2014 6:39 am

Post by asid61 »

karakter wrote:I am working on a project in which i need to control 12 servos. In the XMOS documentation I didn't find anything about servo control, so please, can anybody help me? Is there any library for this?
You don't need a library for this. You can just run multiple threads controlling a few servos each.
Look up code for servo control (some code from the Arduino might work with modifications).
If I remember right, you need to send a signal of 1500us, then 20us, for no movement. 2000us followed by a 20us pause will yield around 90* of movement. 1000us followed by a 20us pause will yield -90* of movement. You can send shorter or long signals followed by a 20us pause to vary how much it should turn I think. This is assuming you are using an RC servo.
User avatar
infiniteimprobability
XCore Legend
Posts: 1126
Joined: Thu May 27, 2010 10:08 am

Post by infiniteimprobability »

Here's a library and example if you want to re-use rather than write your own:

http://www.xcore.com/projects/simple-servo-driver