Simple Clock Is Great Stepper Motor Project

You’d think that we’ve posted every possible clock here at Hackaday. It turns out that we haven’t. But we have seen enough that we’ve started to categorize clock builds in our minds. There are the accuracy clocks which strive to get every microsecond just right, the bizzaro clocks that aim for most unique mechanism, and then there are “hello world” clocks that make a great introduction to building stuff.

Today, we’re looking at a nice “hello world” clock. [electronics for everyone]’s build uses a stepper motor and a large labelled wheel that rotates relative to a fixed pointer. Roll the wheel, and the time changes. It looks tidy, it’s cyclical by design, and it’s a no-stress way to get your feet wet driving stepper motors. And it comes with a video, embedded below.

The clock is driven by the ubiquitous 28BYJ-48 stepper motors that can be found on eBay for a few bucks. They don’t have much torque, but all they have to do here is turn a cardboard disk. It’s the perfect match.

There is one caveat with these motors, though: they don’t have an integral number of steps per turn. If you have the “1:64” geared version, it’s actually geared 8910:567424. The upshot? Instead of 2,048 steps per turn, you need 2,037.8864. Get this wrong and you’re losing 14 minutes per day with a 12-hour wheel.

So between just driving the motors, and the low torque and the non-integral gearing, there’s more to learn here than you’d think. You can add a real-time-clock circuit if you want it precise. With all this room to expand, you can get it built and running in a weekend for a few bucks. And that makes it the perfect “hello world”.

23 thoughts on “Simple Clock Is Great Stepper Motor Project

        1. That was a separate sentence. In the preceding sentence, you called it a motor, not a motor assembly or a gear motor, which implies contained gearing, but just plain motor, which implies a motor and exclusion of things not a motor. If you would like to insist that gears and motors are interchangeable and reference to either implies inclusion of the other, I will simply smile and nod and offer to come round sometime and top up your engine oil and transmission fluid.

        2. The joys of the English language. Three different readers can understand a sentence 12 different ways.

          To me, the offending sentence is this one:

          “There is one caveat with these motors, though: they don’t have an integral number of steps per turn.”

          The preceding paragraph mentioned that it is a stepper. This sentence talks about it’s number of turns.

          No mention of a gearbox or gears. It was confusing enough that I clicked the link, where I learned that this specific model of motor has an integrated gearbox.

      1. Integral is also a noun – the result of mathematical integration.

        As an adjective, it primarily means “formed as a unit with another part”, as how rebar is crucial for the integrity of reinforced concrete, being integral to its structure, having been integrated to it.

        So the sentence appears to be saying that the motors do not fundamentally have a number of steps to complete a turn, in the sense that the number does not exist – maybe being variable or down to luck – rather than simply not being an integer.

    1. Rations should always be factorized down until you have one prime number.

      The the numbers mentioned (8910:567424 and 405:25792) completely baffle me.

      I read the spec as 5 and 5/8 degrees per step which is 64 steps per rotation then deduced by 1:64 giving 4096 steps per rotation and that’s a very simple ratio.

      Sure that leaves problems with 12 hours of 10 minutes being 72 positions per rotation as 4096 / 72 = ~56.888 steps per position or a ration of 512:9.

        1. I read the links again (as you politely asked) and I believe that the math is wrong for a number of reasons.
          1) I didn’t see any gears with a non-integer number of teeth.
          2) I did the math myself (as true integer/ratio math) and came to a different result.
          3) I didn’t see any gears with a non-integer number of teeth.

          Perhaps I will go do the math again.

          1. His conclusion => 513 steps = 0.999933 turns
            My conclusion => 512.00000000000000 steps is 1.0000000000000000 turns
            It’s a rounding error that has resulted from using a calculator in decimal mode.

          2. I went over it again and it’s true that there in a non-integer number of steps per rotation so I learnt something new about these motors. I still don’t like the way the math was done by reverting to decimal but that’s because I do actually know how to do it more accurately.

            On a separate issue – when was it declared open day on HAD authors? Did I miss something? Is is one or two people behind revolving profile names?

            Keep up the good work HAD authors / staff. I enjoy me time here and that isn’t going to be spoilt by a couple of miss-fits.

            PS: My grammar is terrible and I like it that way :p

      1. We indeed speak of “computing power” therefore a device providing that computing power is said to be powering an application…

        However, since the time output is quantised to 10 minute intervals, i.e. it does something useful once every 10 minutes, and that can be achieved with a single pulse, we could say that the actual useful effective MIPS required is in the order of 10^-9 or the approximate computing power represented by a stalactite in a cave dripping regularly. (Ugg the neanderthal maintains he has invented the first simple gravity water fed CPU implemented in air, that can only process the single instruction “pass clock pulse through to output” ) So maybe powering is a misnomer, based on how little computation is optimal, unless you want to insist on going with “Horrendously overpowering by 10 to the tenth power”

  1. If you did just a little bit more mechanical work, you could design this mechanism around a Lavet stepper motor design. That makes it similar to every other cheap plastic clock that’s been manufactured in the last 50 years or so, but I will say I haven’t seen a whole lot of truly DIY Lavet steppers.

    The idea is that you make a gear train designed so that the last gear moves 180° per second. You attach a permanent magnet to that gear and rest it inside a stator. You pulse the stator at 1 Hz, but at opposing polarity. That flips the magnet-bearing gear 180° once a second. You design the stator so that after the magnetic pulse, the gear falls forward just a few degrees, which will encourage the next pulse to flip the magnet in the correct direction.

    Having done (and now sell) a replacement Lavet stepper controller board, I can tell you that making a crystal driven microcontroller clock accurate to modern standards for clockmaking (±10 ppm at a minimum) is not a trivial undertaking. You either have to make one of the loading caps variable and then carefully tune it (and probably retune it regularly), or you need to write the firmware to allow it to trim by adding or deleting cycles periodically.

    1. re: Lavet steppers. The ones inside cheapo clocks. I didn’t know they had a name. Thanks. :)

      Clocks. Very tricky. I’ve taken the trim-it-in-firmware approach and it works, but then the temperature changes or the battery sags. RTC modules embody a lot of smarts for not all that many bucks, in comparison.

      NTP and GPS are great options when you’ve got networking or clear skies and a bunch of money.

  2. Really?! No arduino-haters? No comments explaining how a 555 timer and a few flipflops will do it?

    I am disappoint.

    (Seriously though, if you ditched the dirt-cheap geared stepper for a nearly-as-cheap 1.8-degree motor, you’d just have to step once per 216 seconds — use a 16kHz watch/clock crystal, and you’ve got nice integer ratios, whether you use dedicated dividers or a microcontroller. And since you aren’t backdriving a ridiculous gear train, you can almost set the clock to 10 minute accuracy by rotating the disk manually — it’ll pop over 14.4 minutes at a time. Soooooo close, maybe we should find a 0.9deg motor instead?)

    1. Hey Ben, creator here, i completely agree, a 555 timer would have been a lot smarter to use and cheaper, however I wanted to add more features which needed a microcontroller to control them.
      Thankz for the comment

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.