Menu

Help driving mult steppers at different speed

Help
confusered
2011-07-24
2013-05-30
  • confusered

    confusered - 2011-07-24

    New and learning.  I am able to drive a stepper motor from my experimental board.  I am trying to design a clock that uses individual stepper motors for hour, minute, and second hands.  Can this be done using one PIC?  I can't seem to figure out how to drive three motors at different speeds from one PIC.

    I could use three separate pics but would like to use one if possible.

    Any help or pointers are welcome.  Thank you.  And thank you for developing GCBASIC and the graphical.  Much help in my effort to learn.

     
  • mmotte

    mmotte - 2011-07-25

    Sounds like an article I saw in Nuts and Volts magazine.  Arch Ball Clock by Elza Simpson  July 2009 issue

    Instead of trying to run 3 motors at a speed, themotor you are using are stepper motors so you advance them so many steps after each  event.

    Event generator would be a one second interrupt. each second you would advance the second hand 0ne second
    Once you have 60 seconds then you advance the minute motor on the minute  hand 1 minute
    Once you have 60 minutes then you advance the hour hand 1 hour.

    a lot of stepper motor have 200 steps per revolution which isn't easily divides by 60. Ther are some steppers with 360 steps but they are much rarer.

    GL
    Mike

     
  • confusered

    confusered - 2011-07-25

    Thank you for the reply.  I have seen/built that arch ball clock. 

    Because of the problem dividing the steps, I was just trying to run the motors at a certain speed.  The motors I have are very small and already have gear heads on them.  They actually require 4096 steps to get one revolution of the output shaft.  The are available on ebay with a small circuit board that has a DIP with darlinton transistors and led's for indication.  All for about $6 from china. 

    I was trying to avoid extra external gearing.  I am really a mechanical engineer and the EE's I work with say us ME's always want them to "make it work" through software.  I guess now I'm my own enemy since I'm trying to program something.

    Still looking for ideas.

     
  • kent_twt4

    kent_twt4 - 2011-07-26

    How accurate is the clock supposed to be?  Do you have an external watch crystal, or are you using a separate clock IC?  What PIC have you chosen?

    It looks like the challenge is to keep track of the error rate over time, and adjusting the seconds stepper every so often to keep the accumulation in check.

    The step rate is  4096/360 = 11.377778 steps per second.  So 11 steps every second.  To handle the error keep adding successive steps by accumulating the modulo.  So add another step after a three second period (3 x 0.377778 = 1.133334).  Another step after 24 seconds (8 x 3 (i.e.3 second error) x 0.133334 = 1.066672).  Another step after 360 seconds or an hour (15 x 24  (i.e. 24 second error) x 0.066672 = 1.00008).

    Hope my thinking cap was on straight this morning.  Good luck.

     
  • kent_twt4

    kent_twt4 - 2011-07-28

    Surprised no one jumped on my math,  So will try again.

    The division should have been:
    (4096 steps/rev) / (60 secs/rev) = 68.26667 steps/sec.
    68 steps every one sec interval, remainder 0.26667
    Add one step for every 4 sec  interval (4 x 0.26667(1 sec error)) = 1.06668), remainder 0.0668
    Add one step for every 60 sec interval (15 x  0.06668(4 sec error)) = 1.0002), remainder 0.0002
    Add one step every 30000 sec interval (500 x 0.0002(60 sec error) = 1.00000)

    Same correction factors for the mins servo, with the hours servo having to be recalculated.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.