Let's Make Robots!

Can a Picaxe "Read" Servo Outputs?

So I am playing with a RF radio control system. For one instance, it is a perfect set-up just to have a pot stuck on to a servo (all the outputs on the receiver are servo outputs) and the pot data to be fed into an ADC on my picaxe. Now, seeing that I have a total of 8 channels on the RC unit, 8 individual servos, 8 pots and 8 ADC inputs is just not feasable.

Question:

I know that servos run off of little pulses, I'm sure there is a way to have a Picaxe "read" these pulses and execute a chunk of code. Any thoughts? There is a "count" code that will count pulses within a given time, maybe that is a way to go...?

At any rate, give me any thoughts you have and I would give my right kidney for some chunks of code.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Check out Chris' walk through.

G'day Chris, using the picaxe basic, the pulsin command will read the pulse in 10uS units with a 4MHz clock (same resolution as servopos command). Usually 1ms is full anticlockwise (or is it clockwise), 1.5ms is centre and 2ms is full the other direction. With some systems the range might extend from 0.75ms to 2.25ms. See the servo/servopos command in manual2 for more info. This will still need 8 digital inputs unless you multiplex using something like a 4051 1 of 8 analog switch.

http://www.jaycar.com.au/images_uploaded/CD4051BC.PDF

Since your pulse is 6V and your pic is running on 5V you should setup a voltage divider, say 1K2 and 3K9 to protect your pic input.

Servo_divider_Schematic.jpg

From my exp with a (parallax)bs2(maybe the bs1 as well), you would normally control the servo with a pulsout command. I think the servo command does this exact thing only in a nice little easy to use wrapper. I would assume that pulsin could read this information. I have yet to try it, but something I've been interested in finding out. I was going to look at the bs1 manual to see if it has any info on servo control as it's timing is very similar to the picaxe. Could be something to look into...?