Shop Learn P1 Docs P2 Docs
P2 Servo interface — Parallax Forums

P2 Servo interface

JRoarkJRoark Posts: 1,079

Quick question for the robotics guys: when driving a 9G servo from a 5 volt supply, how stiff of a driver do I need on the 50hz pulse train driver? Also, does the 1-2 mS pulse train need to swing rail-to-rail or is there a spec as to the minimum pulse amplitude?

All I am finding is basic motor info - nothing on the controlling pulse driver characteristics.

Comments

  • Christof Eb.Christof Eb. Posts: 634
    edited 2022-07-01 06:22

    Hi,
    As you have not yet got a better answer:
    I do not know specificly about 9G.
    But there are lots of projects and tutorials driving a servo with 3.3V cmos microcontroller outputs. And I have never had any issues doing so. So I assume that 3.3V cmos signal voltages will be fine at least for short wire length.
    Christof

  • It's only really the pulse width that matters. The 50Hz rate isn't very important, and can be faster or slower and have significant 'jitter' without affecting the servo. You shouldn't go too high with the frequency (not more than about 100 Hz) as very high frequencies can burn out the servo amplifier. If the servo isn't required to move for a time, and doesn't need great holding power (not too much mechanical load on it) then you can stop sending pulses completely: the servo will then remain in its current position, behaving very much as though it is powered down. The servo draws very little current in this state. I've used 9 gram servos to drive the hands of a mechanical 3D-printed clock (via gears to step up the servo movement to provide 360-degree rotation). No signal is normally sent to the servos, but when the clock hands are required to move, the pulse train to the servo is activated for about one second.

  • JRoarkJRoark Posts: 1,079

    Ha! Cool clock! And thank you both for the answer.

    I’ve worked with servos a bit before in breadboarding, but the lack of a spec for the PWM voltage/current has given me pause. I dont want to drive a servo directly from the P2 without a firm spec. My experience with interfacing “real world/off-board” devices to micros says “buffer everything” because doo-doo happens. So I’ll stick a little MOSFET in there and call it good. That lets me drive rail-to-rail using the servo supply. Probably overkill, but it keeps bad things from hurting the P2.

  • ceptimusceptimus Posts: 133
    edited 2022-07-01 20:55

    The servos have a very high input impedance on their signal wire and work fine with a 3.3V signal. If you don't need great power from the servos, you can power them from 3.3 V too - they still work, but with lower output torque and slower movement speed. If you choose to power the servos from a 5V source, then the signal can still be a 3.3V one, and I've never had any problems with the 5V supply somehow "leaking back" to the signal pin and damaging the 3.3V drive electronics. I've tested my servos with a signal of just 3V, and they still work fine. I've not tried going lower than that, but I suspect they'd likely work down to 2.5V, maybe lower.

    I don't remember ever driving my servos with a P1, and I don't have a P2, yet; but I would have no hesitation in connecting servos to a propeller.

    Remember that all the radio control receivers sold by radio control manufacturers just drive their servo outputs direct from the microcontrollers - I've never seen a receiver that has MOSFET buffers between its MCU and its output pins.

  • Duane DegnDuane Degn Posts: 10,565
    edited 2022-07-05 18:00

    @ceptimus said:
    It's only really the pulse width that matters. The 50Hz rate isn't very important, and can be faster or slower and have significant 'jitter' without affecting the servo.

    That's true for analog servos but digital servos care about the pulse length.

    I can't recall having a problem driving servo logic using the 3.3V output from a Propeller 1 but there might be servos out there which won't work properly at 3.3V. Again, I've never run across one of these servos.

    When the QuickStart board first came out I rounded up 32 servos and used the QuickStart board to drive them all. The most servos I've used in a "practical" project was 22. My hexapod used 18 servos in the legs and two servos in each eye.

    @ceptimus said:
    I would have no hesitation in connecting servos to a propeller.

    Same here.

    @ceptimus said:
    I've used 9 gram servos to drive the hands of a mechanical 3D-printed clock

    Very cool clock.

  • JRoarkJRoark Posts: 1,079

    That is a cool hexapod. Some of the things Parallaxians do just amaze me.

    Circling back (for the sake of those who may come later), it appears from my breadboarding efforts that most 9G servos look like a ~7K to 10K ohm load to the Prop. Very little current is needed on the PWM output. But you do need to be at or above ~3.0 volts during the pulse "hi" time.

    With regards to P2 output pin protection, you should consider not running "naked". The servo logic itself doesnt seem to kick anything nasty back, but when the servo is moved quickly it pulls a bunch of power, and I am seeing this couple into the PWM line. On a 3 ft unshielded ribbon cable (power, ground and pwm drive), the scope shows about 0.5v worth of trash on the PWM pin during hard moves, so a couple of Schottky diodes to the rails might be worthwhile especially for longer cable runs. YMMV.

Sign In or Register to comment.