Servo Controller - Background


Accurately controlling the position of rotating elements is the heart of a motion controlled system. Often stepper motors are called upon to complete this task. Although cheap and plentiful at lower power levels, more powerful versions are expensive and difficult to source.


Stepper motors are the norm in hobby CNC systems. Although stepper motors have limitations:

  • Constant-power device (power = angular velocity x torque). As motor speed increases, torque decreases.
  • Generally must be over engineered, so that there is no possibility that the motor will lose steps.
  • More vibration than other motor types, as the discrete step tends to snap the rotor from one position to another.


Another device is the servo motor. This combines a standard electric motor and position feedback sensor with a controlling circuit. The electric motor can be DC (brushed) or AC (brush-less).

There are a couple of fundamental components to these servo drives:

  • Actual position conditioning & decoding
  • Desired position conditioning & decoding
  • Error calculation (from actual-desired)
  • Error filtering (PID calculation)
  • PWM generation
  • H-Bridge

Actual position conditioning & decoding
This is the feedback sensor to determine the current position. They are built in to industrial servo motors, and industrial external sensors cost many $100s.
Hobby Option: A low cost optical encoder can be had for US$20, and with a little effort these can be fitted to a standard permanent magnet DC motor. The output from these incremental rotary encoders, is "quadrature" encoded (two output wave forms 90 degrees out of phase). Decode quadrature input with a microcontroller.

Desired position conditioning & decoding
The servo controller must be instructed of the desired position.
Hobby Option: Derived from stepper motors, the defacto standard is STEP & DIRECTION signals. A "step" line is pulsed, and each pulse represents an increment or decrement depending on the state of the "direction" line. Software such as EMC2 & Mach3 can generate these signals.  Decode step/direction input with a microcontroller.

Error calculation (from actual-desired)
Function: From the actual and desired position, an error level must be derived. This can be done via analogue, or digital means.
Hobby Option: Calculate with a microcontroller.

Error filtering (PID calculation)
From the error calculate an output level.
Hobby Option: Calculate with a microcontroller.

PWM generation
From processed error calculate an output level.
Hobby Option: Generate with a microcontroller. This is a logic level PWM signal (or signals) that control the H-bridge.

Produce a high power PWM DC signal.
Hobby Option: The H-bridge needs to match the motor. A simple 100mA unit can be constructed with BC548 NPN and BC558 PNP transistors. At 160A the 16 MOSFET Open Source Motor Controller project is the other extreme. Most setups will lie somewhere in between.

Converts electric power to motion.
Hobby Option: DC Brush motors provide the best performance/price. Genuine high power, low inertia, industrial servo motors cost many $100s. Existing automotive, electric scooter, & general purpose motors can be used quite effectively.


Buy: At the hobby level Gecko (US$114) drives appear to be the norm. The Gecko (320 & 340) appear to be analogue units with gain & dampening trim-pots. A test-point reflecting the error (as voltage) is available to assist in tuning with an oscilloscope. 

Build: A number of DIY controllers, Elm Chan Servo, UHU Servo, Dspic-Servo, were all designed for the specific purposes of their creator, and integrate the H-bridge into the controller PCB. The most variable component is the motor. Different uses will require different motors, and different motors have different drive requirements. It's beyond most hobbyists to modify a PCB and design their own high-power section. A modular approach, with a separate controller & H-bridge would be much more flexible. Allowing you to select a H-bridge matched to you motor.

When looking at the DIY servo controllers I found a few short commings:

  • Elm Chan Servo - No standard PCB available. Not well supported.
  • UHU Servo - Closed source. Getting the preprogrammed chip appears quite an ordeal.
  • Dspic-Servo - Uses uncommon High-Voltage, High-Current Op Amp ($18).

What was missing is a modular DIY servo controller - the lego of DIY servo controllers. This is my goal.

Powered by BlogEngine.NET
Original theme by Mads Kristensen

About the author

Name of author Ivan Hamilton
"My inner nerd can beat up your inner nerd."

E-mail me Send mail



<<  May 2017  >>

View posts in large calendar

Recent comments





    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2017

    Sign in