CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Controlling a Servo like a Stepper Motor

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
JackSparrow



Joined: 14 Mar 2007
Posts: 1

View user's profile Send private message

Controlling a Servo like a Stepper Motor
PostPosted: Tue Mar 20, 2007 6:53 am     Reply with quote

Hi Guys,

I have a problem with my servo motor. I'm using a PIC18F452 to control my motor and I want it to rotate in 1 or 2 degree steps, like a stepper motor. But varying the duty cycle of a normal PWM just doesn't work for me. It jumps great angles some times but I'd like it to rotate step by step, spending the same amount of time at each step.

Do you have any useful codes or advise or anything helpful?

Thanks in advance... Smile
bungee-



Joined: 27 Jun 2007
Posts: 206

View user's profile Send private message

PostPosted: Thu Jul 12, 2007 3:23 am     Reply with quote

If you have RC servo then you have to drive it in a certain way. Typically RC servo needs PWM that is 50Hz and pulse width from 1ms to 2ms, where 1.5ms means center position.

Try to search on the forum for servo. If your servo is some other, please ignore my post. Wink
RLScott



Joined: 10 Jul 2007
Posts: 465

View user's profile Send private message

Re: Controlling a Servo like a Stepper Motor
PostPosted: Thu Jul 12, 2007 5:05 am     Reply with quote

An industrial servo motor is normally coupled with an optical position encoder for feedback. Then some controller electronics varies the motor drive in a closed-loop fashion to achieve a certain position. Are you providing that closed loop?

A stepper motor, even without position feedback, has an inherent sense of position, and so single steps make sense. There are controller devices that can simulate the stepper motor interface for a servo motor, but that still involves a lot of electronics. Do you have such a device? Or are you trying to make such a device? If so, then what are you using to read the optical encoder?

Robert Scott
Real-Time Specialties
Embedded Systems Consulting
Ttelmah
Guest







PostPosted: Thu Jul 12, 2007 7:06 am     Reply with quote

I presume you are actually talking about a radio control 'servo'?. These are of 'varying' accuracy. Basically, they have a closed loop, formed by a potentiometer, feeding back into the control chip, which is used to control an analog multivibrator, which is compared with the value being generated from the incoming pulse. How well this is done, varies with the make of the servo. The overall accuracy of the potentiometer, is also 'variable'. Many types, will exhibit significant 'jitter' (where they will hunt backwards and forwards around the requested position), and also linearity is not fabulous in many cases....
Most units are based on variants of the old NE544, or more modern M51660L control IC. These have a number of controlable parameters, set by resistors/capacitors, which alter how well they behave.
There is a 'deadband' control, which if set to low, leads to the jitter behaviour, while if it is set too high, small 'step' movements, may well be ignored completely.
If you take units from a number of manufacturers, and feed them with identical pulse trains, you will find a massive variation in how well they move.
Generally, makes like Futaba, and Yamaha, tend to produce units that perform comparitively well. Also, many manufacturers offer 'high precision' servo models, which use improved potentiometers, and more accurately setup controller IC's, and these are more likely to work for an application like this, than 'general purpose' servos.
With a good RC servo, a properly setup PWM, should happily allow reasonably repeatable movements of only a very few degrees. If the unit is not behaving properly, you may need to look again at how your timings are set. However wth some makes, it is pure 'luck' how well they will perform, and this may be the problem...
An industrial servo, is a different 'kettle of fish' here.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group