Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Running an Analog Futaba S3003 Servo w/ PIC

Status
Not open for further replies.

Peter_wadley

New Member
Well as the name states.. im trying to fine tune my assembly code for running a S3003 standard servo..

I really dont understand how the servo is to be controlled..

When I send the command line a Square wave with a 0/1 frequency it turns Counter Clockwise.. the higher the frequecy the fast it turns..

When I get over a certain frequency.. it goes the other way..

Is this how you control it?

I cant seem to find out the correct Delay time.. for each way..

The google tutorials arent really explaining this very well..


Here is the servo specs: **broken link removed**

Thanks
 
Assuming this is a standard RC servo?, you don't alter the frequency you alter the width of the pulse - between 0.5mS and 1.5mS, with 1mS being the centre position. You repeat the pulse every 20mS, although this timing isn't critical.
 
All the research I've done suggests you send a 1.0 msec to 2.0 msec pulse each 20.0 msec period with a 1.5 msec pulse taking the servo to the center position. Some servos require an extended pulse width range of perhaps 0.75-2.25 msecs (1.5 msecs still the center position).
 
So what you want is a PWM channel (preferably 16bits) set to a fixed frequency of 50hz (I've driven servo's as high as 100hz before problems occur) all you do is adjust the duty cycle to adjust the servo position. Since the majority of the time the servo is waiting you won't get full resolution from the timer but even the most sophisticated digital RC setups only use 10bits, and even 9 or 8 bits is usually fine.
 
Great!

Works perfectly!

Using the Delay-o-matic from PIClist I found..

Min POS = 2.3 MS

Neutral = 1.4 MS

Maximum = .5 MS

These things really fight to stay where they are! Love it.

Twirl on lil' buddy:
Click for EL Crappy .GIF Complete with Lighting change and Unexplainable position changes :p
 

Attachments

  • AnimationWizard1.gif
    AnimationWizard1.gif
    51.1 KB · Views: 513
Mike said:
All the research I've done suggests you send a 1.0 msec to 2.0 msec pulse each 20.0 msec period with a 1.5 msec pulse taking the servo to the center position. Some servos require an extended pulse width range of perhaps 0.75-2.25 msecs (1.5 msecs still the center position).

Could well be me who's wrong! :p I'm just going by an old and distant memory! :D
 
It's technically supposed to be 1.5ms center, but 'center' is arbitrary anyways, you'd have to measure it using a protractor and a long arm. I've seen some throttle servo's where the control loop was tweaked so that is was very non-linear, it was on a really old car before even halfway advanced electronic mixing methods were used. If you want a little extra torque out of your servo increase the frequency as high as you can until the servo starts acting strange. The higher the update frequency the greater the immediatly available torque the servo gets because it's getting it's power pulses more frequently. So called digital servo's do this in a slightly more advanced way. It's a good way of partially bridging the performance gap between analog and digital servo's without dropping the cash on digitals.
 
Sceadwian said:
So what you want is a PWM channel (preferably 16bits) set to a fixed frequency of 50hz (I've driven servo's as high as 100hz before problems occur) all you do is adjust the duty cycle to adjust the servo position. Since the majority of the time the servo is waiting you won't get full resolution from the timer but even the most sophisticated digital RC setups only use 10bits, and even 9 or 8 bits is usually fine.
If you could setup a PIC PWM channel with a 20.0 msec period (difficult to do at higher clock frequencies), the 10-bit duty cycle would only provide approximately 20.0 usec steps or about 50 steps across that 1-2 msec pulse width range. Is that enough steps to be useful for an 'average' servo? I ask because several posts have been submitted in the past by folks trying to use PWM for servo control and we all have come up with other creative solutions to help them get around problems and limitations of the PWM module.

Mike
 
Sceadwian said:
It's technically supposed to be 1.5ms center, but 'center' is arbitrary anyways, you'd have to measure it using a protractor and a long arm. I've seen some throttle servo's where the control loop was tweaked so that is was very non-linear, it was on a really old car before even halfway advanced electronic mixing methods were used. If you want a little extra torque out of your servo increase the frequency as high as you can until the servo starts acting strange. The higher the update frequency the greater the immediatly available torque the servo gets because it's getting it's power pulses more frequently. So called digital servo's do this in a slightly more advanced way. It's a good way of partially bridging the performance gap between analog and digital servo's without dropping the cash on digitals.

Yes, saying a position is the exact centre really is not possible with these things seeing as how the horn (The plastic X) can be taken off and placed in many different positions..

Hope that makes sense.. what Im trying to say is.. since you can bring the servo to your supposed centre then take off the horn and screw it back on so that its not pointing to center any more.. then centre was never really a definate place anyhow.. but then again I realize that the servo can only go so much to the left and so much to the right.. center is always going to be the gear position inbetween the two extremes.. just need to adjust the horn to point straight when its at the middle..

either way you look at it.. these things are a god send for many many applications!

Care to share any projects youve used servos in? Im quite intrested!
 
Mike said:
If you could setup a PIC PWM channel with a 20.0 msec period (difficult to do at higher clock frequencies), the 10-bit duty cycle would only provide approximately 20.0 usec steps or about 50 steps across that 1-2 msec pulse width range. Is that enough steps to be useful for an 'average' servo? I ask because several posts have been submitted in the past by folks trying to use PWM for servo control and we all have come up with other creative solutions to help them get around problems and limitations of the PWM module.

Usually it's just done in software, which is another reason I don't like to see it called 'PWM' - but there have been various methods posted on here using the PWM hardware via interrupts, and reprogramming the hardware every interrupt.
 
Yeah, I've contributed to some of those solutions.

I was just hoping Sceadwian would elaborate on his suggestion.
 
Status
Not open for further replies.

Latest threads

Back
Top