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.


Views: 17255


Developer
Comment by Jason Short on November 28, 2010 at 8:33pm
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.
Comment by Lew Payne on November 28, 2010 at 9:09pm
You may want to investigate isochronous control of the servos... here's a hint (code example).
Comment by Bill Porter on November 28, 2010 at 9:35pm
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.

Comment by OpticalFlow on November 29, 2010 at 3:47am
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.
Comment by Tero Koivunen on November 29, 2010 at 4:01am
And a satellite board to input (rx) side also! ;-)
Comment by Paul G. on November 29, 2010 at 6:20am
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).
Comment by GR0B on November 30, 2010 at 3:01am
That is cool, and I had just ordered a few more Teensy++ boards to drive more servos
Comment by Copter Richie on December 4, 2010 at 3:35pm
This idea still could be used to drive the servos for the camera mount. Hmmm.
Comment by ministickers on January 18, 2012 at 3:43am

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'. 

Comment

You need to be a member of DIY Drones to add comments!

Join DIY Drones

Groups

Season Two of the Trust Time Trial (T3) Contest 
A list of all T3 contests is here. The current round, the Vertical Horizontal one, is here

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service