DC motor at very slow precise "clockwork" speed

Discussion in 'The Projects Forum' started by THE_RB, Apr 13, 2013.

  1. THE_RB

    Thread Starter AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    Hi, this is something that comes up on the forums from time to time, with things like solar tracking and clock mechanisms etc.

    It's a system using a cheap common PIC microcontroller to run any DC motor at a very precise speed, including error correction if the motor is bumped forward or backward etc.

    [​IMG]

    It requires that the DC motor has an encoder fitted (a standard quadrature encoder), or in my case I just pulled an encoder disc from an old Microsoft mouse and glued that to the motor. (Motors with encoders already fitted are commonly available on ebay and from hobby robot suppliers like Sparkfun and Pololu etc.)

    [​IMG]

    As you can see the circuit required is very simple with practically no parts, just enough to get the encoder working (3 resistors) and something to drive the motor with PWM (a transistor and a diode).

    The "precise stuff" is all done in software using a Bresenham math system to make a precise xtal-locked reference frequency and a simple algorithm so the motor must maintain the same average speed as the reference frequency (and it auto-corrects any short term speed errors).

    Like any good clock system it can be tweaked with one number to set the motor speed, in very fine adjustment steps.

    You can set the DC motor to exactly 1 rev per second, and it will keep clock accuracy for weeks or months afterward.

    This is a viable alternative to using stepper motors for clock type applications, and will run much quieter, smoother and many times less energy consumption than a stepper motor, and no motor driver IC's are required.

    The whole project is here, with C source code supplied;
    http://www.romanblack.com/onesec/DCmotor_xtal.htm
     
    #12, strantor and JohnInTX like this.
  2. JohnInTX

    Moderator

    Jun 26, 2012
    2,341
    1,024
    Very cool, Roman. Thanks for sharing.
     
  3. ScottWang

    Moderator

    Aug 23, 2012
    4,853
    767
    Good sharing, thanks.
    I think you should change the title, because it's different from what you introduced.
     
  4. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    Very nice, I had no idea they could turn that slowly. Now I know why I've been keeping old mice.
    Even optical mice tend to have a encoder for the scrollwheel. The one I've got here has 12 slots, so would be good for faster speeds.
     
  5. #12

    Expert

    Nov 30, 2010
    16,261
    6,770
    This is the kind of thing I put in my blog space on AAC so I can point people at it without leaving this site.
     
  6. THE_RB

    Thread Starter AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    Thanks guys. :)
     
Loading...