Go Back  RCU Forums > Radios, Batteries, Clubhouse and more > RC Radios, Transmitters, Receivers, Servos, gyros
Reload this Page >

microcontroller-actuated servo, number of steps / precision?

Community
Search
Notices
RC Radios, Transmitters, Receivers, Servos, gyros Discussion all about rc radios, transmitters, receivers, servos, etc.

microcontroller-actuated servo, number of steps / precision?

Thread Tools
 
Search this Thread
 
Old 04-05-2006, 04:48 PM
  #1  
Access
Senior Member
Thread Starter
 
Join Date: Mar 2005
Location: , CA
Posts: 4,900
Likes: 0
Received 0 Likes on 0 Posts
Default microcontroller-actuated servo, number of steps / precision?

Right now I am using an Atmel AVR microcontroller (atmega16 series, clock speed = 8MHz) to actuate a servo.
To actuate the servo, the microcontroller generates the PWM signal (instead of an RC receiver).
My question is, how many individual 'steps' (positions) does an individual servo have; is it 256 or is it more? And is it standard or does it differ from servo to servo?

Right now I am using a Futaba S3004 and even with 256 different PWM pulse settings it still seems to jerk a bit rather than move smoothly.
I know it has a least 256 since I already tried 1/256 and 1/1024 timer prescaler settings (see below) and there is a definate improvement in smoothness going to the 1/64 timer prescaler setting. Will I gain even more precision if I go to a timer prescaler setting of 1/8, which will also force me to use the 16-bit timer? I figured I'd ask first, maybe someone else has already done the same thing and I don't want to have to rework everything for no benefit.

This is my interrupt handler that actually moves the servo:
prescaler is set in this line: "TCCR0 = _BV (CS01) | _BV (CS00); // prescaler = 1/64"

SIGNAL (SIG_OUTPUT_COMPARE0) {
/*
// full interrupt-driven implementation
if (cp_state == CP_STATE_DOWN) {
PORTA |= 0x80;
cp_state = CP_STATE_UP;
OCR0 = TIME_INITIAL + servo_up;
} else if (cp_state == CP_STATE_UP) {
PORTA &= 0x7f;
cp_state = CP_STATE_DOWN;
TCNT0 = 0;
OCR0 = TIME_INITIAL;
}
*/

// blocking implementation
TCCR0 = _BV (CS01) | _BV (CS00); // prescaler = 1/64

PORTA |= 0x80;
cp_state = CP_STATE_UP;

TCNT0 = 0;
while (TCNT0 < (SERVO_PREWAIT))
;

TCNT0 = 0;
if (servo_up < 128) {
while (TCNT0 < servo_up * SERVO_MULTIPLIER)
;
} else {
while (TCNT0 < 128)
;
TCNT0 = 0;
uint8_t servo_up_minus;
servo_up_minus = servo_up - 128;
while (TCNT0 < servo_up_minus * SERVO_MULTIPLIER)
;
}

PORTA &= 0x7f;
cp_state = CP_STATE_DOWN;
TCCR0 = _BV (CS02) | _BV (CS00);
TCNT0 = 0;
}

I know the blocking implementation is non-optimal but I don't think a full interrupt-driven implemention could later be expanded to control multiple servos.
Old 04-06-2006, 11:35 AM
  #2  
dirtybird
My Feedback: (5)
 
Join Date: Jan 2002
Location: San Tan Valley, AZ
Posts: 5,768
Likes: 0
Received 0 Likes on 0 Posts
Default RE: microcontroller-actuated servo, number of steps / precision?

Since it really is an analog servo, the S3004 theoretically has infinite steps. PCM systems found that 512 digital steps was not adaquate so switched to 1028. There is a system now available that has 2048 steps but I think that is gilding the lilly.

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Contact Us - Archive - Advertising - Cookie Policy - Privacy Statement - Terms of Service -

Copyright © 2024 MH Sub I, LLC dba Internet Brands. All rights reserved. Use of this site indicates your consent to the Terms of Use.