PDA

View Full Version : Servo and pwm



Meriachee
- 27th April 2009, 15:56
Hi all,

In reading the book (that should get me some spam in itself) I read that the PWM output wants an R/C network to "filter" the waveform. The burning question I've had, and now even worse, is that if the pic "wants" an R/C to give you nice clean PWM, why does the servo not work worth a dang when on the tail end of that R/C?

Of course it would be much easier to answer the question if I'd just go buy a scope and watch that for a while.

Has anybody watched these different outputs and can you tell me why the R/C is no go?

Cheers
Gary

Dave
- 27th April 2009, 17:25
Meriachee, An R/C network attached to a pwm output will integrate the signal and turn it into an analog representation of the pwm value in percent between the full scale output voltage and 0. If you are talking about servos used for r/c control, most of them require a continuous series of pulses that are approx. 1.5 milliseconds wide and have a period of approx. 20 milliseconds.. The pulse width varies from about 1 millisecond to about 2 milliseconds. I think this is where you are getting confused....

Dave Purola,
N8NTA

Meriachee
- 28th April 2009, 06:25
Thanks Dave,

Analog makes sense.

Cheers
Gary

Meriachee
- 28th April 2009, 06:41
The little servo I am using is moving the arm when the power comes up in a rather uncontrollable fashion, until the pic is operational. With the linkage I am using, eventually it will cause some issues.

I am thinking about putting a 2n3904 on the ground leg of the servo and bring it up on a gpio, ensuring that the power is "off" until the pic is running and ready to go. Any ideas on this approach, or is there a better way to ensure the servo does not rotate at all until the pic is ready?

Dave
- 28th April 2009, 11:40
Meriachee, Possibly a pass transistor in series with the power lead to the servo. After the pic is up and running w/pwm pulses to the servo, turn on the power to the servo. That is what I can come up with as a quick and dirty solution. All servos act like that upon powerup with no command signal that I have seen...

Dave Purola,
N8NTA

Probotics
- 26th May 2009, 22:14
Hmm. I haven't seen that servo behavior myself, but I thought it might be worth an experiment so I plugged a servo directly into a battery pack with no signal. One out of every ten or so times I plugged it in it would twitch just barely. Is that the issue you're having? If this is it I think you have to go with switched power but it is a very small movement and it might be related to the specific servo you're using.

If not you might want to look at where and what value is associated with thethe first pulseout is in your code. I have had issues where the servo is moved far from a default position and startup includes significant movement as it heads for default and I've also set the default position at the wrong value and had movement. Finally I've had the pic come up with outputs high or not set until late in the program which gave me some issues.

I've also on rare occasion had spurious signals from dirty power - might want to check that. I'm also assuming that you're posting about standard 1-2ms commanded hobby or robotics servos.

Bruce
- 27th May 2009, 20:06
Make sure you're wearing safety glasses before powering-up that servo with a
2N3904 low-side switch...;o}

An FET that can handle your servos stall current might be a better choice?

Meriachee
- 28th May 2009, 01:32
Thanks Bruce,

The servo is one of those micro-miniature jobs. I tried the same code on a "regular" hobby servo and it works like a charm without any switching. The regular one does not even move when you put power to it, the mini job can spin almost 1/2 way around. Not a cycle or two.....

Cheers
Gary

Bruce
- 28th May 2009, 02:23
Hi Gary,

I had one of those micro servos a few years back that did pretty much the same thing.

It had a severe twitch under certain circumstances too as I recall. Can't remember exactly
why, but it was a funky servo. I think it was a BlueBird brand? Can't remember. I blew it up
goofing around, and never bothered replacing it.

chrisshortys
- 29th May 2009, 14:04
Its down to the indidual servo buddy, the experiances i have had is the nice and cheap servos have alot of start up movement.... I got a cheap load of servos from ebay and they all have this problem. I also have another servo which i got from a friend at work which is of a higher wuality that doesnt have the issue

Acetronics2
- 29th May 2009, 14:26
The little servo I am using is moving the arm when the power comes up in a rather uncontrollable fashion, until the pic is operational. With the linkage I am using, eventually it will cause some issues.



Hi, Dave

You CAN'T have your servo, if an "analogic" one, steady while powering on its amplifier ... that's it !!!

The only way is to cut the power to the motor terminals ( relay ...)

Solution is to use a DIGITAL servo which control circuitry won't drive the motor at Power-up.

No simple solution for "old analogic" servos ...

Alain