Introduction: Large Stepper CNC Clock
My upstairs stairwell always seemed empty, and I wanted to make a large clock that could be seen from the front entrance as well as upstairs. The clock is essentially a CNC milling machine with an X and Y plane - an Ardunio running GRBL 1.1 (G Code conversion to stepper drive) with a CNC Shield on top, DRV8825 stepper drivers, two optical sensor "endstops" and NEMA 17 stepper motors. An Orange Pi Zero running Debian uses WiFi to get the current time, convert it to G Code using Python and sends it serially to the Ardunio. The attached video shows the clock starting up, homing to the two optical sensors (rocks back/forth twice to ensure it is at 12:00), then setting the time to 10:58.
Software theory: The stepper motors are set to 1/32 microsteps, with 200 steps per rev and 3 to 1 gearing on the pulleys. With the Steps/mm set to 32, this gives 600mm for one revolution of the hands, thus 1 minute = 10mm, and 1 hour = 50mm. The Python function "localtime" (which allows for TZ and DST) returns the current hour/minute/sec. To step to this time (for example) 10:30:36, the minute step value is 30 mins * 10mm/min = 300 steps plus the seconds offset of 36 secs / 12 = 3: therefore the minute hand would be stepped to 303 steps. (a fraction past the clock digit 6) Similarly, the hour hand would be 10 hours * 50 steps/hour = 500 steps plus the minute hand offset of 303 / 12 = 25.25, so the hour hand would step to 525.25 (indicating ~halfway between 10 and 11). The G-code sent would be: G1X303Y525.25F3000 = step minute hand to 303, hour hand to 525.25, both at the speed 3000 mm/min.The local time is converted from 24 hour time to 0-11: with 12:00 being 0 - with the minute hand homing at 12 (vertical) to reset the count back to zero. At a time of 12:00, both hands will home. The file grblclk.py is (hopefully) well commented.
Accurate time in Debian is via NTP (Network Time Protocol), run "ntpq -p" to ensure it is syncing properly. Good article at: https://pthree.org/2013/11/05/real-life-ntp/
Step 1: Mechanical Assembly
The clock shaft comes through the wall from the closet behind - the minute shaft is 3/8" aluminium, the hour is 3/4" nylon/delrin, and the outer support is 3/4" aluminium tubing (or 7/8" aluminium with internal diameter of 0.759"). This was done on a small lathe, but could be done on a drill press - drill a 3/4" hole in a scrap wood block, then without moving the block, chuck in a 3/8" bit and put the 3/4" nylon into the hole. The 3/8" hole will centered into the nylon. The mounting plate was done on a milling machine, but could be done in plywood. The pulleys on the shaft are 60T GT2, 20T GT2s are on the motors, with a 200mm belt between the pulleys - giving a 3 to 1 reduction for the 200 step per revolution steppers. This results in full 600 steps per clock rotation, but the stepper drivers are jumpered to 1/32 microstepping : Steps per mm is set to 32 to make 10mm = 1minute. The optical sensors are mounted on a bent thin aluminum sheet, with flags screwed to the pulleys. These can be mounted anywhere, and the hands attached at the correct location.
Step 2: Hand Assembly
Because the hands are fairly large (~1M from centerline), they have to be made light. Wood 1/4" dowels make up the longer section to the center line, then 1/4" steel rods counterbalance the wood. The center dowel/rod holders are drilled at 3 degrees with set screws for the wood and steel rods, as well as set screws to lock to the shafts. The wood dowels are tapered at the end 3 degrees, glued together, and treated with an ebony penetrating stain (to match the steel rods and look like one piece). Likely could be made easier by gluing wood dowels/steel rods into 1/4" ID tubing and attaching to hub(?). I tried many different types of hands, and the counterbalanced method seems to work the best. The minute and hour hand hubs are now 3D printed, the STL files are attached.
The numbers on the wall are 6" Gothic font plastic (Amazon, Staples). To aid in positioning the numbers, while ssh logged into the Orange Pi, enter: "screen /dev/ttyACM0 115200" . This sets up a serial connection through the Pi to GRBL. Enter $H to home the arms, then move the arms to the desired position by typing "G1X300F1000" which will position the arm to the 6 o'clock position.(Increments of 50 will point to consecutive numbers, i.e.: x=50 would be 1 o'clock, x=100 would be 2 o'clock, x=150 would be 3 o'clock...) To exit "screen", enter "CTRL A", then "K", then enter "Y" (Yes) to kill screen.
Step 3: Electronics
The Ardunio / CNC shield is well documented on the internet, a search of Instructables: www.instructables.com/id/How-to-Installuse-GRBL-W... will bring up instructions for installing it on the Ardunio. The Orange PI (or Raspberry PI with WiFi) is similarly well documented for loading Debian server (lucsmall.com/2017/01/19/beginners-guide-to-the-orange-pi-zero/ ). Install the Python serial library (http://pyserial.readthedocs.io/en/latest/pyserial.html ), and the attached Python scripts that read the time and send the G Codes to the Ardunio. The demo.py file is shown running in the video below.
GRBL is configured via the EEPROM settings from defaults - the stepper motors are held with the power on them between steps so there is no chance the arms will interact (i.e. minute hand lightly dragging hour hand through bearing surfaces or unbalanced arms rotating), this is done by setting $1=255. The steps per mm is $100 for X and $101 for Y, both are set to 32 steps/mm. Homing has to be turned on via $22=1.
Step 4: Possible Modifications
If the clock is to start and stop at certain times (i.e young children in the bedroom behind the wall), copy the start / stop scripts, and modify your /etc/crontab file as the attached.
-Due to the size of the clock, the hour hand alone is sufficient to judge the time (early clocks were copied from sun dials and only had one hand). With a smaller, well balanced hand - it may run directly off the stepper shaft. (?), greatly simplifying construction.
- As another stepper motor can be driven by the CNC shield (Z), it could be used for a pendulum, or a cuckoo clock animation, or....
-There is also a switchable output (coolant mist) and an available PWM output (spindle drive) could be used like an alarm clock or hourly chime.
-The Ardunio UNO / CNC Shield could be replaced by an Ardunio Mega / RAMPS 1.4 , which would support 5 motors and more outputs.
-A circular light pattern could be projected from the opposing wall to add a circular outline, or even possibly do marking and numbers with light
- The clock can be started and stopped using crontab, and as the WiFi on the Orange Pi is used to get accurate internet time (NTP), it could also be controlled remotely.
- If driven too fast, the motors can make a screaming sound, and certain high speeds cause the wall to resonate slightly with a spooky droning sound (the neoprene / hockey puck mounting cut this down somewhat)
Step 5: Parts List
(2) NEMA 17 stepper motors (AliExpress)
(2) NEMA 17 motor mounts (AliExpress)
(2) 20T GT2 5mm ID pulleys (AliExpress)
(2) 60T GT2 5mm ID pulleys (ID drilled to size) (AliExpress)
(2) Closed loop GT2 belt 200mm (AliExpress)
(2) Optical sensors or equivalent (mechanical, hall) (AliExpress)
(1) 7/8" aluminium 6061T6 tube (Aircraft Spruce 0.759" ID)
(1) 3/4" Delrin rod (hour shaft) (Aircraft Spruce 0.750 OD)
(2) 3/4" electrical cable clamp (Home Depot)
(1) 3/8" aluminium rod (minute shaft) (Home Depot, Aircraft Spruce)
(1) 3.5" x 12" aluminium (or plywood) mounting plate (Metal SuperMarkets - cutoff bin)
(2) 1.5" x 4" x 3/4" aluminium block (hand rod support - could made in plastic) (Metal SuperMarkets)
(4) 1/4" x 48" wood dowel (hands) (Home Depot)
(1) 1/4" x 36" steel rod (hands counterweights) (Home Depot)
(1) Ardunio UNO with CNC Shield V3 (or Ardunio Mega with RAMPS 1.4) (AliExpress)
(1) Orange Pi Zero (or Raspberry PI with Wifi) (AliExpress)
(1) Surplus laptop power supply (or any 18 volt to 30 volt 2-3 amp)
(1) DC to 5v USB adapter (or 5V USB power for Orange Pi) (AliExpress)
(1) 6" plastic Gothic letters (Amazon, Staples)
We have a be nice policy.
Please be positive and constructive.