Servo cycle time

Wrenow

Senior Member
Curious as to the application. Some servos and related things like ESC's are not really happy with a much longer pulse frame rate. If we knew how and why you are wanting to do stretch the frame, we might be able to give better advice.

For instance, if you are reading servo pulses from a R/C receiver, and just looking to give yourself more time, you may be creating additional issues. This is relatively easy to do with, say 3 receiver servo pulse streams, if read in order, within the given 20ms pulse window (frame), but exceedingly difficult to do with 6-8. You can even do it without the Servo command (using pulsout instead), as the timing becomes handled by the pulsin reads.

Cheers,

Wreno
 

RobertN

Member
I need slower pulse rate to run a solenoid valve. Running servo in the background with 40ms cycle time would be a good start.
 

Andrew Cowan

Senior Member
Slow down a PWM command using poking to get th right timing?

If you can't do it via software, you can always have an 08M doing pulsouts continuously. It could respond to a serin.

Andrew
 
Last edited:

RobertN

Member
I would like to to have a pulse stream that runs in the background like servo at a lower frame rate (if that is possible). Is it possible to poke or otherwise slow down servo frame rate?
 

Wrenow

Senior Member
Why bother with the servo command a all? Just do a pulsout loop. Not background of course. I am not sure what changing the frequency would do to/for you offhand, but, if it worked, should change both the cycle and the pulse length at the same time.

Are you sure that the solenoid valve can cycle that fast? a max of 4ms and 36 ms off sounds a bit quick..

Cheers,

Wreno
 

BCJKiwi

Senior Member
What does the pulse look like?
Is it a repeated short burst of pulses then a wait until 40ms are up, or is a sustained (and variable length) pulse every 40ms?
Do you want to vary the pulse width / frequency and/or the Cycle rate?
A single pulsout could initiate an external sequence using one shot, flip/flops, delays or whatever.
Presumably the Solenoid won't be driven directly by the PICAXE port so what is doing the driving?

40ms is 25 Hz which is near the limit for PWM on the slowest PICAXE clock speed possible but the PICAXE won't be much use for anything else as it would be running so slowly.
 

RobertN

Member
Pulsout precludes any other activity for the duration of the pulse. There would be one variable length pulse per servo cycle at a fixed cycle rate. It appears the servo pulse length can be extended beyond the normal time used by RC servo's by entering larger pulse length times. About 10 to 40 - 50% duty cycle would operate the small solenoid at 40 - 50ms cycle time just fine.

So can the servo cycle rate be slowed down? I'd prefer not to slow down the clock rate.
 

BCJKiwi

Senior Member
Think the following scheme might work (subject to my correct understanding of the various parts of the solution). I'm sure others will comment on the validity of the theory!

Basically you want a slow PWM that runs in the background without slowing the chip. This is what I came up with for a similar issue but have not tested it!
(or you could dedicate an 08M on reduced clock and PWM for this task)

A 28X1 with a timer driven interrupt running could drive a one shot which drives a flip/flop.

The one shot toggles the flip flop - the flip flop delivers alternately a high, then a low, each time the oneshot is triggered.

A very short pulsout triggers the one shot.

timer is primed for the length of the High pulse and a short Pulsout triggers the one shot. Timer times down in the background while the main program code continues.
When timer runs out, main program is interrupted and then timer is primed with the Low time and a short Pulsout triggers the one shot sending the flipflop low.

This process continues automatically in the background.
The only thing you need to adjust is the cycle time and pulse width.
TimerH = pulse width
TimerL = cycle time - timerH

Check out setintflags Manual2 Page152, and, settimer Manual2 page 154
Recent code was posted showing the use of these routines.
 
Last edited:
Top