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.
- 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
- wire cutters
- stripboard strip-cutter
- PIC programmer
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 https://www.instructables.com/id/Stripboard-PCB-D...