0

Blog posts are just like buses...

Posted by Chris on Saturday, May 09, 2009 in , , , , , ,
...you wait for ages for one, then three come along at once.
Just a quick note to say that, despite there being no blog updates for a while, it's not all ground to a halt here at Nerd Towers.

After the success (mostly) of the USB relay switching device I've been inspired to help out with a project for Steve at www.botbuilder.co.uk, which is a USB-driven multiple-servo controller.

Simply put, to drive a servo, you need to send a signal pulse to the servo every 20ms or so (50hz) the duration of which must be between 1ms and 2ms.
A 1ms signal means "0 degrees" (or -90 if your zero position is half way between the two extremes). To move the servo to 90 degrees (or its mid-point) a signal of exactly 1.5ms must be sent, and a signal of 2ms represents "fully extended" or "180 degrees" (or 90 degrees if you're working from -90 to 0 to 90).

Many PICs have a PWM (pulse-wave-mode) module built into them, and some even have two or more. But very few (if any) can support up to 16 servos.
Allowing for errors, and a signal pulse time of 2.5ms per servo - remembering that each servo must have a signal sent to it every 20ms at most - the maximum number of servos that a PIC can control, serially, is 8.
(servo 1 takes 2.5ms, followed by servo 2, another 2.5ms, followed by servo 3 etc...)

8 x 2.5 = 20m/s.

And on top of all this, your PIC is running at 100% capacity - there's no room in there for receiving data requests to update the position of the servos.
So I'm trying to recreate PWM using an 18F series PIC, but using timer1 to create interrupts to drive all servo pins high at the same time, then use some form of offsetting to drive them low again after a period of time between 1ms and 2ms.

Look out for some Oshonsoft PICBasic code shortly (if I get it working!)

0 Comments

Post a Comment

whos.amung.us

Copyright © 2009 .Nerd Club All rights reserved. Theme by Laptop Geek. | Bloggerized by FalconHive Supported by Blogger Templates.