# Good Ol' Servo PWM

Discussion in 'The Projects Forum' started by blah2222, Dec 26, 2010.

1. ### blah2222 Thread Starter Well-Known Member

May 3, 2010
565
33
Hi! So after reading a bunch of the well explained posts/tutorials on generating some solid servo PWM on the forum, they all seemed to contain one 555 timer and at least one transistor somewhere in the circuit. They are probably more accurate then what I'm thinking, but I'd like to get some help with explaining another way of getting around this, that I found.

I would like to set up a circuit with an astable 555 timer (oscillating as close to 50 Hz as I can get it, for servo control frequency), as well as a monostable 555 timer (with period control by a pot).

Astable Mode:

Where R1, R2, and C determine the frequency of oscillation (50 Hz), given by the formula:

$F = \frac{1.44}{C(R1 + 2R2)}$

Monostable Mode:

Where R (variable resistor) and C determine the period of "on" time for the pulse, given by the formula:

$T = 1.1RC$

Putting It All Together:

The output (pin 3) from the astable timer is connected to the trigger (pin 2) of the monostable timer. From there, the output (pin 3) of the monostable timer is the final PWM signal that can be manipulated by changes in the variable resistor in the monostable circuit.

My Question:

This all looks great to me on paper, but there's just one small thing that I am unsure about. Does the duty cycle of the astable timer signal matter when it comes to triggering the monostable timer signal?

Thanks a lot!
JP

2. ### blah2222 Thread Starter Well-Known Member

May 3, 2010
565
33
Hm, the only reason I ask is because I'm having some trouble with my circuit. I have it wire exactly like above with values stated below:

Astable:

R1 = 2 kΩ
R2 = 2 kΩ
C = 4.7 uF
$f = \frac{1.44}{4.7u(2k + 2(2k))} = 51.06 Hz$

Monostable:

R = 4.5kΩ + 20kΩ pot
C = 0.1 uF
$T_{pot/off} = 1.1(4.5k)(0.1u) = 0.495 ms$
$T_{pot/full} = 1.1(24.5k)(0.1u) = 2.695 ms$

"Ideally" this should produce a good working range for the PWM with respect to the pot's rotation, but I have no visible control of the servo and I'm thinking it has to do with how the trigger of the monostable timer is reacting to the output of the astable oscillator timer.

Anyone think of any other problems that I might be having?

3. ### retched AAC Fanatic!

Dec 5, 2009
5,201
313
Are you using decoupling/bypass caps on the 555 ?

4. ### blah2222 Thread Starter Well-Known Member

May 3, 2010
565
33
I've got 10nF capacitors on between the control pin and GND for both, if that's what you mean.

5. ### thatoneguy AAC Fanatic!

Feb 19, 2009
6,357
718
The monostable 555 (your second one) will not reset if the trigger is held high. You need to create a "non-retriggerable" one-shot.

The astable 50 Hz gen (first one) should be outputting pulses narrower than the narrowest pulse the retriggerable one-shot will generate, i.e. 5% duty cycle or less.

--ETA: 555 Internals Tutorial You will see that the trigger feeds a comparator that directly drives the output flip flop. If it is held, the other functions do not override it.

6. ### blah2222 Thread Starter Well-Known Member

May 3, 2010
565
33
Ah that makes sense. I was thinking it had something to do with the trigger.

Awesome! Got it working with a lower duty cycle in the astable timer. Thanks a bunch! For anyone who wants to use this circuit...

Works with values:

Astable:

R1 = 27560 Ω
R2 = 560 Ω
C = 1 uF

Monostable:

R = 4560 Ω + 20kΩ pot
C = 0.1 uF

Last edited: Dec 29, 2010
7. ### blah2222 Thread Starter Well-Known Member

May 3, 2010
565
33
Just another question. This works pretty well for PWM between 0.5 and 2.5 ms but at the ends, it gets kinda jittery. Is there a way to keep the servo stable if it is greater than 2.5 ms or less than 0.5 ms. The pot allows for slight access to PWM just outside those bounds, and I would like to prevent the servo from jittering.

Thanks

8. ### thatoneguy AAC Fanatic!

Feb 19, 2009
6,357
718
Put a resistor in series with the pot, and a smaller pot so the total resistance is lower than that of the pot you are currently using.

This will increase the minimum resistance and decrease the maximum resistance, it should result in what you want after a few tries.

blah2222 likes this.