[Back to Home Page]


DC Motor Speed Encoder
Very cheap simple system to measure DC motor speed.
Roman Black - April 2001

What is it?

This is a one-transistor circuit that gives a digital pulsed output which is dependant on the speed of a small DC motor. This "speed" frequency signal can be fed to a PIC or other Micro which can then measure motor speed and possibly control the motor speed.


Small DC motors have a brass commutator which alternately connects the windings (usually 3 windings) as the motor armature rotates.

As the brushes "commutate" across the joins in the commutator, the current drawn by the motor ripples at a frequency that represents the motor speed, at a set number of pulses per rotation.

This effect can be seen as a voltage ripple waveform on the CRO when the motor is running. The ripple is more obvious, and more reliable, when the motor has some load (like a fan etc). Adding a small resistor like 1 ohm or 10 ohms before the motor makes this even more obvious.

How it works

The circuit is very simple;
  • Trimpot is adjusted so transistor is JUST OFF
  • Ripple voltage is made by the commutator as the motor rotates
  • Each ripple voltage pulse turns the transistor ON for a short pulse
  • Transistor output is a digital output, frequency can be fed to a PIC input etc


    As the motor can sometimes produce spurious extra or missed pulses this cheap circuit is NOT reliable for positioning accuracy or to measure how many times a motor has rotated. It is NOT a replacement for a "proper" optical encoder.

    But it is reasonably reliable to measure the motor speed of a small DC motor under moderate loads at a fairly constant speed.

    It is suitable for measuring/controlling;
  • A fan
  • 12v water pump (will also detect zero water over-rev)
  • Speed-controlled rotating device etc.
  • Small DC motor handtools etc (no mechanical mods needed).

    Circuit Details

    Motor voltage ripple is needed and about 50mV to 100mV peak to peak ripple waveform is ideal.

    R1 (maybe 1 ohm) is only needed if ripple voltage is less than 50mV under normal running conditions. Increasing R1 gives bigger ripple and better speed sensing but reduces motor performance and wastes heat in R1.

    D1 (1N4148 or 1N914 glass diode) is only needed for larger motors (over 2 amps).

    C1 (about 1uF) allows pulses to be fed to the transistor.

    C2 (about 0.1uF to 1uF) gives a smoothed ripple voltage at the transistor base. Reducing C2 can increase the ripple voltage and improve sensitivity but if too small it can also allow some noise and spurious pulses to occur. C1 and C2 perfect values depend on the motor size and speed.

    Q1 is not a critital part, just about any small NPN transistor will work.

    Tips for using it

    You can adjust the trimpot safely when the motor is running and find the "sweet spot" where speed sensing is most reliable.

    If mounted a long distance from the motor, the main signal wire to C1 should be a COAX sheilded type cable. Grounds are not that critical, but if using COAX only ground the sheilding at the end AWAY from the motor.

    Use a CRO to measure the ripple waveform, about 50mV at the center pin of the trimpot is ideal.

    The output is best fed to a schmitt trigger type digital input pin of a PIC or other micro. This provides extra "squaring" of the digital frequency waveform. If you don't have a ST digital input pin (you only have the TTL type), check that the circuit output is very square with full 5v-0v swing and fast rise and fall times. You can improve this by increasing the ripple voltage, by increasing R1 and/or reducing C2.

    Important! The commutator does NOT produce evenly spaced pulses BUT it does produce a set number of pulses per shaft rotation. Speed measurement is best performed by measuring the number of pulses over a timed period and not by measuing the time between 2 pulses!

    Frequency averaging helps to reduce the effect of spurious pulses and noise, for best accuracy have at least 50 pulses in the timed period or even more.

    - end -

    [Back to Home Page]