NE555 timer and hobby servo Question

Discussion in 'The Projects Forum' started by dk31, Jun 3, 2015.

  1. dk31

    Thread Starter Member

    Oct 30, 2014
    36
    0
    Hi everyone.
    I am designing a project that involves controlling a hobby servo with a pot, and have been reading about servos and 555 timers.
    I found this circuit shown in the picture below, replicated it and works fine .
    (http://www.instructables.com/id/Drive-Servos-with-a-555-timer-IC/)
    [​IMG]
    Problem is, I have a hard time understanding the waveform that makes the servo work. Searching the internet about servos, all sites repeat the same info: servos read a PWM square signal that has about 20ms period (anything 5-25ms will do), 1.5ms high time correspotnd to 90 degrees (neutral) and 1-2ms (or 0.5-2.5ms ) correspond to full left and full right.
    [​IMG]

    The 555 datasheet gives the formulas for the square signal as
    Period (in sec)= 0.693 * C1*(R1+2*R2)
    High Time (in sec)= 0.693*C1*(R1+R2)

    If I put the R and C values in the formula, I get 12 / 7ms (Period / high time) for full left and 4 / 3ms for full right. Looking at other similar 555 circuits I get all different kind of values for Period & ht, both changing between full left and full right.

    What do I miss here?
     
  2. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,548
    2,373
    When the the PWM wavform is at the 50% width point, the servo should be stationary, anything either side of this positions the servo in that particular direction.
    Max.
     
  3. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,809
    834
    Here is a pic that I'm sure you understand.
    [​IMG]
    I borrowed it from an article on how hobby servos work.

    While hobby servo motors may work with different periods, they should be at 20ms. Your examples had periods of 13ms and 4ms, which are way out of spec (I doubt that 4ms period would work). The published servo testers have their RC values carefully calculated to be in the range of servo control.

    A servo driver with only one 555 is going to vary both the period and duty cycle; it's preferred to have period constant and vary the duty cycle. Hence, I prefer a circuit that uses a 556 (or dual 555s) instead. One generates the 20ms period, which triggers the appropriately desired pulse width. Like this one:
    image.jpg
     
  4. dk31

    Thread Starter Member

    Oct 30, 2014
    36
    0
    Thanks guys for your replies.
    So it works both ways? Either 20ms periods and 1-2ms pulse widths (the correct way) or
    40-60% pulse widths of whatever period (the "dirty" way) ?

    @MaxHeadRoom
    The circuit that I replicated (1st post), worked fine although, according to the 555 datasheet the pulse widths of the two servo extremes were 60% (7ms/11.7ms) and 81% (3ms/3.7ms). Not below 50% at any case.

    @djsfantasi
    Thanks for the 556 diagram. It's hard for me to understand how it works. Any more info? The 556 datasheet lacks the nice examples given in the 555 datasheet.
     
  5. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,809
    834
    The 556 is nothing more than two 555s in the same package. The first 555 generates a short pulse every 20ms. This triggers the second 555 to generate a pulse that is 0.5ms wide to 2ms wide, which serves as the control pulse for the servo. 1.5ms pulse turns the horn to its 90 degree position.
     
  6. dk31

    Thread Starter Member

    Oct 30, 2014
    36
    0
    I can see the usual pattern of Resistors and Capacitor C2 in ports 1,2 and 6 of the first,upper 555 (same pattern as ports 2,6,7 of a single 555). The second, lower 555 has only a capacitor (C3). How do you control pulse width there?
     
  7. Bernard

    AAC Fanatic!

    Aug 7, 2008
    4,172
    397
    Here is another single 555 servo controller used in a pop-up target. Input is either low or high which sets or resets target. Servo-4 00000.png Servo-4 00000.png
     
  8. upand_at_them

    Active Member

    May 15, 2010
    246
    29
    Huh? The PWM period is 20ms and the "stationary point" pulse is 1.5ms wide. That's a duty cycle of 7.5%.
     
  9. Bernard

    AAC Fanatic!

    Aug 7, 2008
    4,172
    397
    The duty cycle of interest here is the positive 1 ms to 2 ms pulse. Average width is 1.5 ms or 50 % duty cycle.
    I've seen strange servo behavior when period is changed much less or beyond 20 ms.
    Note that in drawing in post # 7, period changes with duty cycle of pulse, but only a ms or so.
     
  10. dk31

    Thread Starter Member

    Oct 30, 2014
    36
    0
    Thank you all for your replies.
    My initial question was more like:
    On "theory" all internet sources tell the same thing about servos : 0.5-2.5 ms pulse widths and 15-25ms periods.
    The "practical" 555 timer circuits I find in the internet, including the one in my 1st post that actually worked, produce totally different widths and periods. How come they work, if they are so out of line with theory?

    I guess I can live without knowing that. I will spend the coming weekend (maybe next too) to experiment with the 555 IC, using larger capacitors (x1000) so I can count seconds instead of ms and figure out how the output square wave looks.
    Then I will replicate djsfantasi circuit and start from there.

    @Bernard
    Your diagram confuses me a little. In the middle of the left side there's an "X" ? (between U1 & R2) and resistance R3 is shown to not connect to anything.
     
  11. Bernard

    AAC Fanatic!

    Aug 7, 2008
    4,172
    397
    I havent the slightest idea of where R3 went. Origional ckt had a random time delay so that when target was hit, target was not reset for something like 1 to 30 sec.
     
  12. dk31

    Thread Starter Member

    Oct 30, 2014
    36
    0
    So, I took my time to experiment with the 555 using large capacitors (66uF in place of 100nF)and a clock-timer to count the pattern of a LED flashing on/off.
    Then, working on djsfantasi suggestion, I made a circuit with two NE555 one feeding the other. For some reason the servo had some buzzing sound at 20ms period, that was gone when I increased the period to 30ms. So the final circuit goes like this:

    1st NE555 works in the astable mode, with C=200nF R1=204K and R2=2.4K, and outputs a 28.9ms pulse (28.6ms High + 0.3ms low)

    This output is fed in the trigger pin of the 2nd NE555, which works in the monostable mode and has C=100nF. By ajdusting R=5K to 19K, you get a 0.55ms to 2.10ms signal (every 28.9ms) that will move the servo 90deg left to 90deg right.

    Last, I tried to build a parallel and series pot network for the second NE555, to get some trimming and end-point effects for the servo, but found that they can't work independently: when I adjust the series pot for trimming(centering) the end-points move along and vice-verca. That's not a big issue though, if you don't need the full servo range (180deg) or if you don't care where center is.

    Thank you all for helping.
     
Loading...