My latest project is a better stepper motor driver for the desk clock. When I designed the clock, the resistor-based driver circuit was the quietest solution I could find. It was mostly silent, but over time the gears started to develop a slight rumbling sound. The motor itself seemed quiet, but the gears were starting to rattle. Another thing that really bothered me was the ridiculous cost to ship the tiny circuit board overseas. Shipping and customs costs were often 3X higher than the board itself.
I went searching for something better and believe I may have found a solution. The secret is to use a board called a CNC Shield V4 which is designed to allow an Arduino Nano to control three A4988 stepper motor drivers. The A4988 is replaced with a much better Trinamic TMC2208 driver. This reduces the noise and allows everything to run on 5V. A precision real time clock was added to serve as a reference timer.
Here is the bill of materials:
1) CNC Shield V4 – Amazon US$10.96 for 3 boards.
2) TMC2208 drivers – Amazon US$21.99 for 6 drivers.
3) Arduino Nano – Amazon US$16.99 for 3 modules.
4) DS3231 Real Time Clock – Amazon US$12.11 for 4 modules.
5) NEMA17 stepper motor – Amazon US$9.99 each.
The CNC Shield V4 was modified to fix a known bug and to wire the RTC into one of the unused driver ports.
Here is the circuit:

The TMC2208 was set to 16X microstepping mode. The algorithm adjusts the stepper motor delay to stay synchronized to the real time clock reference. The DS3231 is voltage and temperature compensated to stay accurate to around 1 minute per year. And the clock is significantly quieter.
One downside is that the CNC Shield V4 is huge compared to the custom driver that I was previously using. I am designing a new base to fit the larger circuit. It looks like it will fit. The ability to buy off-the-shelf components is a big advantage. It does not make sense to design a more compact custom circuit board.
Updates to the existing MyMiniFactory desk clock are coming soon. A larger version of the desk clock is also in progress. I designed it a while ago but did not release it because the gear noise was too high. That rattling noise is gone with this new driver circuit. And a wooden gear version of the clock is in progress.
Stay tuned for more information.
Steve
Steve,
Thank you for such a cool project and great instructions. I successfully built the CNC V4 configuration and everything is working as expected. Jumpers change the speed and the monitor shows randomly alternating + and - as expected.
I wanted to try something and ran into unexpected results, so I wanted to run this by you to make sure I understand the code. I replaced case 1 numbers with the following;
I want 0.5 RPM. This gives 26.6667 steps/min. So I set
motor_steps = 26
extra_steps = 2
extra_step_time = 3 (2/3=0.6667)
Using the formula of 960000 / motor_steps / 2 and 1010000 / motor_steps / 2 I get min and max delay time. I see in your code that the different cases did not use the exact value and you even specify actual values determined by trial and error. This is where I am getting stuck as no matter what values I put in I get +++++++++++++ repeating quickly.
min_motor_delay = 18461
max_motor_delay = 19423
I have changed these delays but I always get +++++++++++++++++++++++++++
Side note/observation: when this happens, if I change a jumper the monitor shows that it changes to a different speed but it gives ++++++++++++++++++++++++++++. If I power down, then power up the Nano I get a proper mix of + and - for that speed. But no matter what I do with power, the case I am using for 0.5 rpm (case 1) just gives ++++++++++++++++++++
In your addendum you wrote that a + indicates the algorithm needs to speed up. In my mind this means the delay time between HIGH/LOW step command is too long. But even if I reduce min to 10000 I get the same results. I was expecting all --------------------------------------
What do you think is going on here? Is the RTC module not compatible with such a long delay?