Drive 10 Servos using only 2 Arduino Pins



I've been building both AutoPilots, and QuadraCopters, and I wanted to drive more servos and ESCs, with less jitter, so I used some ideas from the Paparazzi gang and developed a way to drive up to 10 servos with just 2 output pins from an Arduino or ATMega8.

The design uses just one chip, a Johnson style Decade Counter, and requires only two output pins from the Arduino. The Arduino uses one PWM pin (pin9), and one general IO pin (pin8). All the pulse are generated in sequence on the PWM pin, then spread out to the individual servos via the decade counter. The decade counter costs 63 cents.

Now I can build Hexa-Copters without having to use I2C ESCs, and still have servo outputs available for camera controls.


E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • Works very well indeed! Thanks a lot. Also Arduino 1.0 compatible. I also took a look at the ServoShield examples. I still have problems with getting my setup working with that, but it seems they have a special mode for the ATmega1280 and a flag for 'HIGHACCURACY'. 

  • This idea still could be used to drive the servos for the camera mount. Hmmm.
  • That is cool, and I had just ordered a few more Teensy++ boards to drive more servos
  • that's exactly how old (pre-PCM) receivers work. one note, you can't get 10 servos with a steady frame rate unless all the pulse length's just happened to add up to 20mSec exactly, the normal thing to do is not use the first channel and hold the 4017 in reset (the Q0 output will be on) until the frame starts - release reset and the first clock turns Q0 off and Q1 on and start timing the pulses from there. when you get to the end of the last pulse turn reset back on and wait for next frame. the old receivers are max 8 channel for exactly this reason, they didn't use Q0 (held in reset) or Q9 (waiting for reset).
  • And a satellite board to input (rx) side also! ;-)
  • This is a nice idea for servos but if I understand your setup correctly I wouldn't recommend using this for driving ESCs on a multicopter. The reason is that you limit your update period to approximately 2 ms * 10, which is 50 Hz. Many standard ESCs these days support update rates of between 150 and 400 Hz with very noticable improvements in the stability of the multicopter.
  • This has been done before many times in the same fashion.

    You can actually drop this to one pin , and some additional circuitry to drive the 4017 reset pin. Holding the data pin high longer then a regular pulse to charge a capacitor that triggers reset. Here's an example:

    http://that.homepage.dk/PDF/1-8_Servo_Expander_v1a.pdf

    BTW, this is (almost) exactly how PPM decoders work as well.

    3689302388?profile=original

  • You may want to investigate isochronous control of the servos... here's a hint (code example).
  • Developer
    That's very interesting! Getting rid of the output pins on the main board and using a satellite board is the way to go. It saves space and IO pins.
This reply was deleted.