Servo Project

Prior Art

Existing smart servo projects

Considered Hardware

Micro Controller:

  • M0
  • SCM3
  • AVR
  • Nordic NRF51822
    BLE + Cortex M0

    • On Monday, a question came up about whether or not the NRF51822 was able to do
      PWM. I found some demo code from Nordic and tried it out. It appears to work
      fine and I had three pins all doing 20KHz PWM (checked signal with scope).



Alternative Encoder:

Design proposal

General specifications

  • Target cost 10 USD each (quantity not clear, 100?)
  • 32 bit microcontroller
  • Small enough to fit standard servoLooks like (16×20)mm PCB should fit most standard servos.
    Probably need to be ~(8×10)mm to fit micro servos, which is too small.
  • 2 amps continuous at 12 volts(Might go down to 8 V if there was a significant advantage.)
  • PWM frequency at least 30 kHz
  • Two-wire communicationsInitially RS232 style. May support RS485. Either way multi-drop.
  • Support potentiometer feedback or magnetic feedback with AS5040 or similar.
    May support quadrature inputs.
  • Controller power consumption under 100 mA, hopefully well under.
  • Surface mount components down to 0.5 mm pitch qfn.


  • nRF51822, microcontroller with 2.4 GHz RF (BLE & proprietary)
  • RT9625A, quad mosfet driver
  • four power transistorsI see 3 ways to go
    • Two dual nfets, PMDPB28UN,115
    • Four small single nfets, CSD17313Q2 (slightly larger AON7410)
    • Four sot23 single nfets, PMN25EN,115

    The dual, or small solutions are great for size, but the sot23 is admittedly
    advantageous except for size.

  • MCP1703T-3302E/MC, linear regulator
  • CX3225GB16000P0HPQCC, 16 MHz crystal, (3.2×2.5)mm
  • SN65HVD72DRBT, RS485 transceiver
  • GRPB022VWVN-RC, JTAG connector


(DigiKey prices as of 2014.04.05)
What Desc # $ea $@10 $@100 Area(mm2) % target
nRF51822 microcontroller 1 4.11 3.70 3.01 36 30%
RT9625A fet driver 1 1.42 1.26 1.00 16 13%
PMDPB28UN,115 dual Nfet 2 0.76 0.67 0.51 16 13%
MCP1703T-3302E/MC 3.3V regulator 1 0.73 0.61 0.48 6 5%
CX3225GB16000P0HPQCC 16 MHz 1 1.01 0.88 0.61 8 7%
SN65HVD72DRBT RS485 1 2.90 2.60 2.13 9 7.5
GRPB022VWVN-RC JTAG header 1 0.56 0.40 0.26 9 7.5
Totals 8 11.49 10.12 8.00 92 77%
Target 10.00 120


The nRF is fairly capable. Not as capable as the STM32F series, but sufficient
here. It earns points for the radio and cross-point event switching.

More than one way to drive fets. The chosen driver seems reasonable given the
requirements. Could be done differently.

Might use individual fets rather than duals. This is a trade off for area and
parts-count, versus flexibility and ease of assembly.

The JTAG header is only 4 pins. It is in fact the upper corner of the standard
0.05″ 10-pin ARM standard JTAG. This is sufficient for SWD.

Area target is based on ~35% of a (16×20)mm PCB. Low utilization is justified
because target is 2-sided traces, components on one side, and some loss to
connectors and board edge.

Code and board design files can be found on the PARTS github repository

An initial prototype board design (tagged as V0.1) has been routed and submitted to OSH Park.  Check the github to see the current state of the design.


We started stuffing a PCB from OSHpark.

We needed to shrink the stencil apertures to account for the laser kerf as we
cut the vellum. We didn’t know how, but Scott suggested modifying the apertures
directly in the Gerber RSX274 file. Jeff wrote a command-line perl script to do
it (below)

cat parts_servo.tcream | perl -n -e 'if(/(\%ADD\d+[CR],)([\d\.]+)X([\d\.]+)\*\%/){$a=$2-.003;$b=$3-.003;print "$1${a}X${b}*\%\n"} else {print}' > tmp.txt


We got one board built and testing has started. So far, the processor is running and programmable, the motor control is able to run a simple DC motor in both directions and the radio works with a BLE test program (which can be detected and communicated with from an iPhone). Next step is to hook up to a servo and try to do some closed loop control using either the existing potentiometer or the magnetic encoder.


We now have three boards built and working.  One servo has been modified to use the AMS sensor in place of the potentiometer and the firmware has been revised to use either one (compile time switch) as the position sensor.   An Android app has been generated (based on a Nordic demo program) to send angles based on the tilt sensor data.  We have disassembled and measured a number of different servos and are working on the board and mechanical layout for the next revision of the design.


One thought on “Servo Project”

  1. I added a link to a 360 degree dual-wipe potentiometer as an alternate encoder. It’s about 20% of the cost of the AS5050, at least at Mouser.

Leave a Reply

Your email address will not be published.