Servo Sequencer

Introduction: Servo Sequencer

This servo sequencer learns a sequence of up to 32 servo positions then plays them back repeatedly. It can drive up to four servos simultaneously. I use it pretty well every time I make something containing servos.

It includes a battery holder with 4 AA cells which makes it self-contained.

This is not a project for a beginner. You'll need to be able to solder stripboard and program a PIC.

Step 1: What It Does

There are four buttons:

  • A CCW nudge current servo counterclockwise
  • B CW nudge current servo clockwise
  • C Next select next servo
  • D Learn learn this position
  • C+D Run run sequence

The A and B buttons nudge the "current" servo clockwise and counterclockwise. LEDs show which servo is current.

The C button selects which is the current servo; its LED lights up.

D appends the current position to the sequence.

Click C and D together to run the sequence.

When turned-on, the circuit remembers the current sequence and will run it when you click C+D. But, after turn-on, if you click D before clicking C+D then it forgets the old sequence and starts learning a new one.

Click Learn without changing CW/CCW to append a pause of 1 sec.

While running:

  • A Stop now stop running and freeze the position
  • B Stop at end complete the sequence then stop

It will learn up to 32 steps. A step is either

  • a servo position
  • 1..256 pauses

Any Learn after 32 steps is ignored. Adding an extra pause to 256 wraps around to 1 pause.

If you want the board to always run the sequence it's learned (for a school project for instance) solder bridges across the C and D switches and the board will run the sequence when it's turned on.

Step 2: Components

You will need the following components

  • PIC12F629 (1)
  • 1k resistor (4)
  • 100R resistor (1)
  • 10k resistor (1)
  • 3mm LED (4)
  • miniature "tactile" switches (4)
  • row of 3 header pins (4)
  • miniature switch (1)
  • diode (1)
  • 100nF capacitor (1)
  • 10uF tantalum capacitor (1)
  • 8-pin IC socket (1)
  • stripboard - 2.3" x 1.3" (1)
  • 4 AA cell battery holder (1)
  • AA cell (4)

If you're going to follow my stripboard layout, the miniature switch should have 3 pins 0.1" apart and the pushbuttons should have their pins on a 0.2" square.

And, of course, you will need the usual tools for electronic work:

  • soldering iron with fine tip
  • solder
  • wire cutters
  • stripboard strip-cutter
  • PIC programmer
  • etc.

Step 3: The Circuit

The circuit is straightforward. Four pins of the PIC drive the servos,the LEDs and the switches.

A control pulse is sent to each servo in turn. While the pulse is high, GP2 goes low to turn on the LED (if required) and GP3 is read to see if a button has been pushed.

The 4 AA cells produce around 6V which is right for the servos but a little high for the PIC. The diode forward drop lowers the 6V to about 5.5V which the PC can withstand. The diode and capacitors together help prevent noise from the motors reaching the PIC.

Step 4: Construction

I built the circuit on stripboard. It's laid out as shown above. It's rather crowded but not too hard if you have a steady hand. The diagram is shown from the component side.

Notice that some adjacent tracks are connected under the board; those links always pass over a gap in the track. The longer links are above the board.

Instead, you could design your own PCB or your own solder-pad layout.

I have painted stripes on the pcb to show which way round the servo should be plugged. It's possible to damage servos if you plug them in the wrong way so always turn off the switch first.

There are several Instructables on how to solder stripboard. For instance

Be the First to Share


    • Make It Bridge

      Make It Bridge
    • Big and Small Contest

      Big and Small Contest
    • Game Design: Student Design Challenge

      Game Design: Student Design Challenge



    5 years ago


    Outstanding and simple - Very (and I mean very-very) nice project, that is actually usable (contrary to about 99% of the Arduino projects).

    A suggestion might be to post an upgrade around Halloween, for "haunted house fun" - and with upgrade, I mean something that can control more servos (and perhaps a number of plain digital outputs with or without relay driver modules and such)

    Extremely well thought out!

    If it's not a deep secret, what programming software did you use?

    Perhaps make a note that not all servo connectors are created equally, neither their colors, nor their pinouts, so users should seek the knowledge relating to their specific servos.


    Peter Balch
    Peter Balch

    Reply 5 years ago

    I think the advantage of this project is that it's stand-alone with just four buttons.

    The programming language is a weird BASIC compiler I wrote over 20 years ago when there were no decent compilers for PICs. It has all sorts of quirks but produces extremely tight code so it's good for cramming lots into a small 16F chip.

    I'd be happy to give the compiler away for free but I don't want to have to support it. You're better off using the free C compiler from Microchip as it also works with 18F and bigger chips.

    I do have other servo drivers with up to 12 outputs but the learning pattern is "taught" over a serial line from an app running under Windows. There are quite a few projects like that around the web.

    As you say, not all servo plugs are the same. (I've got at least one dead servo as a result.)

    Here's a good list

    I reckon the oddball connectors are becoming rare.