Silent Clock Drive Mechanism
by Stevesclocks in Circuits > Clocks
5200 Views, 75 Favorites, 0 Comments
Silent Clock Drive Mechanism
I design a lot of 3D printed pendulum clocks and wanted a quiet desk clock that never needs winding. It should be accurate and built using readily available components. I wanted it to have a second hand and lots of extra motion.
Stepper motors are useful for driving a clock since their movement is very precise. However, early experiments were incredibly noisy. The basic operation causes the motor to jump from one position to the next. It was obvious that micro-stepping was going to be required. Experiments with A4988 stepper motor drivers were noisy. A TMC2208 stepper driver with 16X micro-stepping proved to be a better solution. The TMC2208 can be configured to run using 5V power. This seemed like a great starting point.
Wiring was minimized by using a CNC Shield V4 board to hold the TMC2208 and an Arduino Nano controller. Powering everything through a single 5V USB cable appeared to be possible. The stepper motor current is adjusted to the lowest possible level to avoid overloading the USB power source.
The Arduino Nano has an on-board oscillator with an accuracy of around +/-0.5% which is good enough for some applications but horrible for running a clock directly. A simple real time clock module increases the accuracy to about one minute per month. A DS3231 precision RTC with voltage and temperature compensation improves it to about one minute per year.
A few wiring modifications are required to the CNC Shield V4 control board for use in a clock. The CNC Shield V4 was originally designed to run three XYZ motors in an engraving machine. One motor port is modified to connect 5V power to the TMC2208. Another port is re-purposed for the RTC, and one port is unused.
The clock has gears between the stepper motor and the second hand, a 60:1 gear ratio to the minute hand, and a 12:1 gear ratio to the hour hand. The clock above has a layer of rapidly spinning gears providing extra dynamic motion. That is a topic for another Instructable. This Instructable describes the clock drive mechanism used to provide smooth silent operation. It can be used in a clock of your own design by modifying a few timing parameters.
Supplies
All of the components used to build the drive mechanism can be purchased on Amazon for reasonable prices. Prices for multiple components are often similar to single components, so you can make several clocks for nearly the same price as building a single clock.
Components:
- CNC Shield V4 - https://amzn.com/dp/B0B6Z71Y5F
Be sure to get CNC Shield V4 and not CNC Shield V3
- TMC2208 stepper motor driver - https://www.amazon.com/dp/B08DFVZV5Q
TMC2209 has been reported to not function properly
- Arduino Nano - https://amzn.com/dp/B0B42GRG15
Pre-soldered headers and USB-C connectors are recommended
- DS3231 real time clock - https://amzn.com/dp/B07QBPV263
Must be the style with a 5-pin header and a yellow battery
- NEMA17 stepper motor - https://amzn.com/dp/B0B38GX54H
NEMA17 motors are recommended due to their availability and low cost.
- 6" small gauge electrical wire
- USB-C cable to match the Arduino Nano
- USB power port, only needs to provide around 100mA
Tools:
- Soldering iron and solder
- Wire cutters and strippers
Software:
- Arduino IDE software development environment
Modify CNC Shield V4
The CNC Shield V4 needs a few modifications to re-purpose it from an engraving machine to a clock drive module. The images show the back side of the CNC Shield V4. One image identifies the power supplies and SPI port locations that will be used. The second image shows the modifications required.
Edit #1 fixes a known bug to allow the stepper motor control jumpers to pull up to Vcc instead of Gnd. Solder a piece of wire from the 5V Vcc location marked as edit #1 to the three pins above it. This edit will hard-wire the TMC2208 for 16X micro-stepping that will be used in the clock. The jumpers on the front side of the board under the stepper motor controller need to be removed to prevent shorting Vcc to Gnd.
Edit #2 provides 5V power to the TMC2208 so it can be powered with a simple USB cable. This simplification is only possible with a TMC2208 style stepper motor controller. The older A4988 stepper motor controller requires 7-8V which would require an additional power supply, so the TMC2208 is a much better option. Extend the wire used in edit #1 and solder it to the Vmot connection on the left (marked as edit #2). This shorts Vmot and Vcc so the TMC2208 output driver will be powered using 5V Vcc. Both edit #1 and edit #2 can be accomplished using a single piece of wire.
Edit #3 brings four wires from the SPI port to an unused four pin header for the real time clock. The SDA and SCL wires are about 1" (2.5cm) long. They will need to be insulated to prevent shorting to the pins they pass over. Vcc and Gnd wires have closer connections as shown in the diagram.
Modify DS3231 and Insert Components
The final edit #4 modifies the DS3231 RTC for the 5-pin socket to plug into an unused 4-pin header on the CNC Shield V4. This seemed like the best location for the RTC.
Solder two pins together on the top of the DS3231. This connects the Gnd pin to an unused NC pin next to it, so the four required pins are now next to each other.
The 5-pin DS3231 plugs into the 4-pin header in the position shown. You can also insert the Arduino Nano and TMC2208 into the CNC Shield V4 as shown. Make sure to remove the jumpers below the TMC2208. The stepper motor current will be adjusted to the lowest possible stable value so the TMC2208 heat sink might be optional.
Connect Stepper Motor
The stepper motor connects to the 4-pin header below the TMC2208. The stepper motor direction can be reversed by turning around the 4-pin connector if the clock runs backwards.
Stepper Motor Algorithm
The clock control algorithm is relatively simple. It rotates the stepper motor with enough steps to move the second hand 1/60th of a rotation. The RTC will then be checked to see if it has advanced by one second. The algorithm switches between two different stepper motor speeds to track the RTC. Think of it like following a car on the freeway. Slow down if you get too close and speed up if you fall behind. Your average speed will be the same as the lead car.
The clock operates in a similar manner. The second hand may move slightly fast for a second or two, then it will slow down for a second or two. The difference between fast and slow modes is so close that the clock will appear to have a perfectly smooth second hand. The reality is the second hand may drift back and forth with about +/- 0.05 second error which is too small to be noticed. Over long periods of time, the clock will continue to stay within +/- 0.05 seconds of the RTC time.
Program Arduino Nano
Open the Arduino IDE and program Arduino Nano with the attached algorithm. This algorithm uses jumpers to select one of four different clocks available on MyMiniFactory. Each of these clocks has different gearing between the stepper motor and the second hand. This requires the stepper motors to rotate at different speeds for each clock. If you design your own clock using different gear ratios, you will need to adjust the algorithm delay settings.
Here are the calculations used for the crazy gear clock seen above:
The clock has two sets of gears between the stepper motor and the second hand. The stepper motor has a 6-tooth pinion driving a 25-tooth gear followed by a 15-tooth pinion driving another 25-tooth gear. The stepper motor needs to rotate 25/6 * 25/15 = 6.944RPM for the second hand to rotate once per minute. This may seem like a lot of complexity, but the extra gears create a clock with lots of dynamic motion.
The stepper motors require 200 full steps per revolution and the TMC2208 is configured for 16X micro-stepping, so 3200 micro-steps are required to rotate the motor one complete revolution. The extra gears require the clock to receive 3200 steps / (60/25*15/25*6) = 370.37037037 steps per second. This breaks down further into 370 steps per second plus an additional 370 steps every 999 seconds (reducing to 10 extra steps every 27 seconds). The extra steps can be considered to be fractional steps.
The Arduino Nano algorithm uses a microsecond timer to control the pulse widths sent to the TMC2208. Each pulse calls the delay routine twice to account for the high pulse and the low pulse. 1,000,000 microseconds divided by 370 steps divided by 2 = a nominal pulse width of 1350 microseconds. The algorithm uses a slightly fast motor delay of 1280uS and a slightly slow motor delay of 1360uS.
The algorithm will need to be modified if your clock uses a different number of gear teeth between the stepper motor and the second hand.
Downloads
Serial Debug Monitor
The Arduino IDE allows additional debug information while programming your Arduino Nano. Serial.print commands inside the algorithm can be sent to the serial debug monitor while connected to the IDE. A sample screen dump is shown.
The first line from the serial debug monitor shows the code revision programed into your Arduino Nano.
The second line shows how many counts were needed to detect a one-second pulse of the RTC. The value in parenthesis is random. It may show something different if the RTC is not found.
The next few lines show the jumper configuration and delay settings. In this example, the module is configured for the SP11 Large Crazy Gear Clock using 200 step per revolution motors. The algorithm will use 370 steps per second plus an additional 10 steps every 27 seconds. The delay settings are 1280uS and 1360uS as described above.
The final lines show the tracking against the precision RTC. A "-" symbol indicates that the clock needs to slow down and a "+" symbol needs to speed up. The ratio of "+" and "-" does not matter as long as there are at least a few of each.
Test the Motors
The serial debug monitor described in the previous step reports if the Arduino Nano is tracking against the RTC. The algorithm also provides a few additional debug routines through configuration jumpers. A jumper is inserted into the 4th position to enable these debug modes. The table above shows the debug modes.
Three modes are simple LED test modes used as a very basic test to confirm that the jumpers themselves are properly connected.
One mode with "1011" jumpers is a simple 1Hz Arduino Nano LED blink test.
The RTC can be tested with "1101" jumpers. The LED will blink at 0.5Hz (one second on, one second off) if the RTC is properly recognized.
The most interesting motor tests ("1110" and "1111") can be performed next. The motor should rotate in one direction for one test and in the opposite direction at a different speed in the other test. A clock driven by a stepper motor requires an extremely low amount of power, so the TMC2208 current adjust potentiometer should be rotated to the lowest possible setting where the motor is stable. This ensures that a low power USB cable can run the clock and also ensures that the stepper motor does not overheat. You should be able to easily stall the stepper motor by holding the shaft and it will still have enough power to turn the clock gears.
Configure Jumpers
This table shows the default stepper motor speeds for the attached Arduino Nano algorithm. It is very specific to gear ratios used in my clocks and may need to be modified if you design your own clock.
Optional Cable Modification
After building several clocks, I noticed that bipolar NEMA17 stepper motors have two different wiring configurations. Most are wired with a cable order of 1B, 1A, 2A, and 2B. However, a few motors are wired as 1B, 2A, 1A, and 2B. The center two wires need to be swapped to get them to work with this system. The key indication of this type of stepper motor is that the motor will not rotate and may only jitter back and forth. The solution is relatively easy.
Look at the 4-pin connector that plugs into the CNC Shield V4. One side has a small tab that can be lifted slightly to pull out the two center wires. Be careful not to break off the tabs. Reverse the center wires and put them back into the connector. The motor should spin smoothly now.
Supported Clock Designs
Here are a few of the clocks I have designed using the circuit described in this instructable. All designs have a sweep second have and are nearly completely silent. The accuracy is as good as the precision real time clock of about a minute per year.
The clocks shown above can be found at the following links:
SP6: Silent Desk Clock - mmf.io/o/183452
SP9: Large Silent Desk Clock - mmf.io/o/275507
SP10: Medium Crazy Gear Clock - mmf.io/o/290349
SP11: Large Crazy Gear Clock - mmf.io/o/290350
The motor control circuit can also be used in a clock of your own design. The algorithm might need to be modified for the second hand to rotate at the proper rate. Then all you need is gearing to divide by 60:1 for the minute hand and 12:1 for the hour hand.
Simplified Controller
After building a few clocks using the CNC Shield V4 module, I decided to reduce the circuit board to the bare minimum required for use in a clock. The comparison between the CNC Shield V4 and the simplified design is shown above. The new board is about half the size, so it is easier to fit into a small clock. My motorized 3D printed clocks support both controller versions. Feel free to use the cheaper CNC Shield V4 design in your clocks. The smaller module is available on Etsy, but there is no way it can compete against Amazon for price.
If you are interested in the smaller controller, it can be found at Silent Shield Clock Controller - Etsy