Basic Manipulator on PIC — Multi-Servo Arm with PIC16F887
A servo-driven manipulator built on the PIC16F887 with the CCS C compiler. Notes on timing, power integrity, and the minimal interrupt scheduler that drives multiple hobby servos from a single MCU.
August 9, 2025
PIC16F887
CCS C
PICkit
PWM
Servos
Embedded
Robotics
“If you understand time, you can move anything.” — lab notes
What I built
A basic robotic manipulator controlled by hobby servos. The controller is a Microchip PIC16F887, programmed via PICkit and the CCS C toolchain.
Project goals were: reliable multi-channel servo PWM, smooth motion from joystick/knob inputs, and a robust power layout that survives lab abuse.
Hardware at a glance
MCU: PIC16F887 (internal 8 MHz RC).
Outputs: up to 6 servo channels on PORTC with 1–2 ms pulses @ 50 Hz.
Inputs: pots/joystick on ADC; buttons for preset poses.
Power: dedicated 5 V BEC for servos + separate 5 V LDO for logic; common ground, TVS + bulk caps near the servo rail.
Programming:PICkit via ICSP (MCLR header on the board).
Firmware design (CCS C)
Using CCPx PWM with Timer2 is convenient, but not ideal for 50 Hz frames across many channels.
I implemented a lightweight Timer1 interrupt scheduler instead:
Why it works: one timer deterministically times all channels; the main loop stays free for ADC reads and simple kinematics; jitter is low because there’s no busy-wait.
What I focused on (and learned)
Timing discipline: measuring real pulse widths on a scope and budgeting the 20 ms frame.
Power integrity: isolating servo surges from logic rails; bulk + decoupling placement; short return paths.
CCS C practice:#INT_TIMER1, setup_timer_1, precise integer timing; EEPROM for trims; clean startup at neutral.
Bring-up workflow: PICkit ICSP, safe boot, brown-out recovery, quick reflash without disassembling the rig.
Next steps
Add encoder feedback for the wrist with a simple per-joint position loop.
A small PC tuner to record/recall poses and play sequences.
Consider PIC18/dsPIC if we need more channels or trajectory planning.
Takeaway: A lean Timer1 ISR is a reliable way to drive many hobby servos on small PICs. This project sharpened my embedded timing, power design, and CCS C tooling on real hardware.