Electric motors come in a million shapes and sizes.  I happen to be using ones that I have found, the Faulhaber 2342S-024CR.  They are core-less brushed DC motors.  Coreless refers to the fact that the internal rotating coil (often called the armature) is not wound around a "core" of iron.  This allows the motor to have very low inertia and in theory much faster response.  Lots to know about motors.  A major trademark of brushed DC motors is that torque is proportional to current.

The necessary equations for modeling a simple DC motor are:

  • Vm - voltage across motor terminals (supply voltage)
  • Vemf - The back emf produced by the armature rotating
  • i - current through the armature (supply current)
  • n - motor revolutions in RPM
  • ω - motor shaft revolution in rad/sec
  • T - motor torque
  • R - resistance of the armature (rotor)
  • L - inductance of the armature (rotor)
  • J - motor inertia
  • B - motor mechanical damping
  • Kn - speed constant
  • Km - torque constant
The Faulhaber 2342S-024CR has the following properties:

 Nominal Voltage  24  V
 Max Current  0.720  A
 Max Torque  16  mN-m
 Rotor Inertia  5.8  g-cm2
 Rotor Inductance  265  uH
 Rotor Resistance  7.1  ohm
 Speed Constant  366  rpm/V
 Torque Constant  26.1  mN-m/A


Pulse width modulation is a general principle of using digital pulses at spaced intervals that when averaged over time approximate a continuous time signal.  This has benefits for motor control in that the power supply can have a fixed voltage, but by switching the supply on and off at different frequencies the effective voltage/current seen by the motor can be changed.

A brief discussion of the Arduino PWM is found here. The Arduino (Atmel 368) is able to supply PWM signals to pins 3, 5, 6, 9, 10, and 11 using the AnalogWrite() command. The PWM frequency defaults to approximately 490 Hz, and can be modified by setting registers associated with the proper timers.  The duty cycle (percentage of time signal is "on") of the Arduino PWM is divided up into 256 levels (level 0 being off and 255 being 100% on).  Pins 5 and 6 have additional overhead that will cause the duty cycle for these pins to appear greater than it normally would.

There are two standard types of PWM control for DC motors, Locked Anti-phase and Sign-Magnitude. These refer to the possible ways of closing and opening the switches to an H-Bridge.
  • Locked Anti-phase Control - A single PWM signal drives the top switch in one leg and the bottom switch in the opposite leg ON and OFF.  These switches are "locked" together so that at 50% duty cycle the relative voltage between the two arms is 0 V.  Increasing the duty cycle from 50% then creates an increasingly positive voltage, while decreasing the duty cycle creates a negative voltage.  This has the advantage that only a single command is required and if the motor switches directions often the current can flow in either direction freely without effecting the voltage across the motor.
  • Sign-Magnitude Control - A PWM signal drives the switches of one leg only (controlling magnitude), while another signal opens or closes one switch in the opposite leg (controlling direction).  This has the advantage of having finer control of the magnitude, since for a set of PWM duty cycle levels there are twice as many compared to locked anti-phase control.
Choosing the optimal PWM frequency to drive your motor depend on the characteristics of the motor.  Below 20 kHz you will hear audible noise, so it may be desirable to run at these higher frequencies, the LMD18200 can be run up to 500 kHz.  Based on the amount of ripple you are willing to allow in the current you can calculate the switching frequency for your motor if you know the appropriate parameters. You need to know the coil inductance, L, and resistance, R, to compute the decay of the current.  Then for a desired percentage of ripple, P, you can determine the switching frequency:

f =\frac{R}{-2L\,\ln\left(\1-\frac{P}{100}\right)}

The Faulhaber 2342S-024CR DC motor has L=265 uH and R=7.1 Ohms, thus the optimal PWM frequency for a ripple of P=35% is 31 kHz.  Thus I will want to change the Arduino clock in order to switch the PWM at near this frequency.  Most of what I have read so far suggests that the switching frequency should be in the 4-20 kHz range to minimize noise of the motor and reduce switching losses.  The break on switching efficiency for the LMD18200 H-bridge is at 10 kHz, so I may want to keep that in mind.

From the Atmel 328 manual and some coaching from the internets I will probably want to mess with the clock frequency for the TCCR1B register:

 7  1  Input capture noise canceler
 6  1  Input capture edge select
 5  0  Reserved bit
 4  1  Waveform generation mode (A)
 3  1  Waveform generation mode (B)
 2  x  Clock select (A)
 1  x  Clock select (B)
 0  x  Clock select (C)

 Then the clock select can be defined by:

 2  1  0 Clock Select
 0  0  0  None
 0  0  1  clk/1
 0  1  0  clk/8
 0  1  1  clk/64 (default)
 1  0  0  clk/256
 1  0  1  clk/1024
 1  1  0  External clock
 1  1  1  External clock

Meaning that if I want 64*490 Hz = 31 kHz I will need to add the following line into my code:

//Set the PWM frequency on pins 9 & 10 to 31 kHz
TCCR1B = (TCCR1B & B11011000) | B001;


The micro-controller can only output a low power PWM signal.  In order to supply a PWM signal with a large amount of current requires an additional power supply and a way to amplify the micro-controller's signal.  This can be done through a simple switching circuit called an H-bridge, so called because it looks like an H.  I am using an integrated circuit (National Semiconductor LMD18200) that neatly packages the H-bridge into a single component.

The package I am using has the following physical layout:

And the functional layout of the device appears like this:

An example implementation of the device is shown below:

When braking the motor the PWM, direction and brake pins (3,4&5) should be set to high in order to take advantage of the over-current protection.

Jeff Bingham,
Dec 18, 2009, 3:39 PM
Jeff Bingham,
Dec 18, 2009, 1:46 PM
Jeff Bingham,
Jun 20, 2009, 7:34 PM