Introduction: 'Antique' Auto Correcting Analog Clock
"'Antique' Auto Correcting Analog Clock" is an analog styled clock I designed to resemble a clock owned by my grandmother many years ago. Her clock had a wooden case with brass hardware and inner workings. This clock has a 3D printed case using wood and copper PLA for the clock case, details, and inner workings, and black PLA for the clock hands. Her clock used a spring driven windup mechanism, this clock uses an Adafruit Feather ESP 32, stepper motor and stepper motor controller to drive the clock hands at a rate of once per minute.
The clock software is designed to "home" the clock on power up or reset (e.g. rotate the clock hands to the 12:00 position) using a reed switch and magnets to detect the home position. Then using one of the numerous NTP clock servers to maintain time, the software rotates the clock hands to the correct time. The NTP clock server is polled by the software at the top of each hour and the time received from the NTP server is written into the ESP32 real time clock. At 12:00 (noon and midnight), if the clock is slow (detected by NTP time of 12:00, but the reed switch is not activated), the software will fast forward the clock to the 12:00 position (reed switch activated), then resume normal operation.
As usual, I probably forgot a file or two or who knows what else, so if you have any questions, please do not hesitate to ask as I do make mistakes in plenty.
Designed using Autodesk Fusion 360, sliced using Cura 3.5.1, and printed in PLA on an Ultimaker 2+ Extended and an Ultimaker 3 Extended.
Step 1: Purchase, Print and Prepare the Parts.
I purchased the following parts:
- One Adafruit Feather ESP32 (Adafruit).
- One set of Adafruit "slim" female socket headers for the Feather ESP32 (Adafruit).
- One stepper motor, controller and cables (TIMESETL 5pcs DC 5V Stepper Motor 28BYJ-48 + 5pcs ULN2003 Driver Board, online).
- One reed switch (ORD2210V/20-25 AT, Mouser.com. These are very fragile, so I purchased 10).
- Four 2mm by 10mm cap screws (local hardware store).
- Four 2mm nuts (local hardware store).
- Nine 3mm by 1.5mm neodymium magnets (local hobby shop).
- One USB to ESP32 USB cable (Adafruit).
- One lithium battery (3.7vdc, 1200mah, Adafruit). The battery is optional, see wiring.
I printed all 3D printed parts at .15mm layer height, the bolts and standoffs at 50% infill, the remaining parts at 20% infill, no support. The 3D printed parts include:
- One "Axle Gear, Minutes To Hours.stl".
- One "Back.stl".
- Two "Bolt, 4mm.stl".
- Seven "Bolt, 6mm by 8mm.stl".
- One "Bolt, Holder, Switch, Reed.stl".
- One "Cover.stl".
- One "Door Knob.stl".
- One "Door.stl".
- One "Frame.stl".
- One "Front, Dual Extrusion.3mf" or "Front.stl".
- One "Gear, Hours.stl".
- One "Gear, Minutes To Hours.stl".
- One "Gear, Minutes.stl".
- One "Hand, Hour.stl".
- One "Hand, Minute.stl".
- One "Holder, Switch, Reed.stl".
- One "Rear, Dual Extrusion.3mf" or "Rear.stl".
- Four "Spacer, Frame to PC Boards.stl".
- Three "Standoff, Front to Rear.stl".
- Four "Standoff, Frame to Rear.stl".
Prior to assembly, test fit and trim, file, sand, etc. all parts as necessary for smooth movement of moving surfaces, and tight fit for non moving surfaces. Depending on the colors you chose, your printer model and your printer settings, more or less trimming, filing and/or sanding may be required. Carefully file all edges that contacted the build plate, especially in and around the gear teeth, to make absolutely certain that all build plate "ooze" is removed and that all edges are smooth. I used small jewelers files and plenty of patience to perform this step. This model uses 4mm, 6mm and 8mm threaded components, so a tap and die set may be useful in cleaning the threaded parts.
Attachments
Axle Gear, Minutes To Hours.stl
Back.stl
Bolt, 4mm.stl
Bolt, 6mm by 8mm.stl
Bolt, Holder, Switch, Reed.stl
Cover.stl
Door Knob.stl
Door.stl
Frame.stl
Front, Dual Extrusion.3mf
Front.stl
Gear, Hours.stl
Gear, Minutes.stl
Gear, Minutes To Hours.stl
Hand, Hour.stl
Hand, Minute.stl
Holder, Switch, Reed.stl
Rear, Dual Extrusion.3mf
Rear.stl
Spacer, Frame to PC Boards.stl
Standoff, Front to Rear.stl
Standoff, Frame to Rear.stl
Step 2: Install the Reed Switch in the Reed Switch Holder.
A few notes about reed switches:
- They are very fragile.
- They are very fragile.
- They are very fragile.
Well, you get the picture. I used a reed switch in this design because they require no power, and, well, I had a few left over from an earlier project. When bending the reed switch wires, always bend them using needle nose style pliers to hold the wire being bent. Never bend the wires at the glass as this will break the reed switch.
Begin by sliding the reed switch into "Holder, Switch, Reed.stl" to the position as shown. Hold the reed switch wire using needle nose pliers as shown, then bend the wire up and over the reed switch holder as shown. Repeat this process with the remaining reed switch wire.
Place this assembly in a safe place until wiring.
Step 3: Assemble the Feather ESP32.
Assemble the Feather ESP32 using the "slim" female socket connectors as described here: https://learn.adafruit.com/adafruit-huzzah32-esp32-feather/assembly.
Step 4: Wire the ESP32 to the Stepper Motor Controller and Reed Switch.
To wire the ESP32 to the stepper motor controller, I loosely attached the two boards, solder side up, to the gear side of "Frame.stl" using the four 4mm by 10mm cap screws and nuts (note there are only two cap screws, spacers and nuts per board), then:
- Soldered a wire between the ESP32 pin 14 to stepper board pin IN4.
- Soldered a wire between the ESP32 pin 32 to stepper board pin IN3.
- Soldered a wire between the ESP32 pin 15 to stepper board pin IN2.
- Soldered a wire between the ESP32 pin 33 to stepper board pin IN1.
- Soldered a wire between the ESP32 pin GND to the stepper board pin "-".
- Soldered a wire between the ESP32 pin "BAT" (for battery backup) or "USB" (non-battery use) to the stepper pin "+".
- Soldered a wire between the ESP32 pin 27 to one wire of the reed switch.
- Soldered a wire between the ESP32 pin GND to the remaining wire of the reed switch.
- Using thick cyanoacrylate, glued the wires to the side of the reed switch holder to provide strain relief.
Step 5: Assemble and Test the Clock Frame.
Attach both the ESP32 and stepper motor controller boards to the non-gear side of "Frame.stl", component side up, using four 4mm by 10mm cap screws, four "Spacer, Frame to PC Boards.stl" and four 4mm nuts as shown (note there are only two cap screws, spacers and nuts per board).
Attach the stepper motor to the frame assembly using the two "Bolt, 4mm.stl", then carefully rotate the stepper motor shaft to the vertical position as shown.
Press "Gear, Minutes.stl" fully onto the stepper motor shaft as shown.
Place "Gear, Minutes To Hours.stl" into position on the frame assembly orienting the vertical slot as shown, then secure in place with "Axle Gear, Minutes To Hours.stl". Do not over tighten.
Stack three of the neodymium magnets together, then press them into position on the flat side of "Gear, Hours.stl" as shown.
Position the reed switch assembly over the slot in the frame assembly, then secure in place with "Bolt, Holder, Switch, Reed.stl" as shown.
Wrap the excess stepper motor wires around the stepper motor, then plug the stepper motor connector into the connector on the stepper motor controller board.
Place the hour gear assembly onto the minute gear noting the alignment of the slot.
Once completed, all gear slots should be vertical which is the clock 12:00 position.
Next, power up the boards via USB and battery (if you wired the clock for USB and battery) or USB only (if you wired the clock for USB only), load the file "Clock.ino" into the Arduino environment, then perform the following:
- Change the source code constant "HOME_SWITCH_CALIBRATE" to "true".
- Change the source code variable "chSSID" to your wifi router SSID.
- Change the source code variable "chPassword" to your wifi router password.
- Download the code to the clock.
When downloaded, the clock minute gear should rotate 90 degrees counter clockwise, then move clockwise until the reed switch activates.
If the clock does not stop at 12:00:
- If the clock is early, rotate or slide the reed switch holder away from the rotation of the hour gear magnets.
- If the clock is late, rotate or slide the reed switch holder towards the rotation of the hour gear magnets.
- Press the reset button on the ESP32.
- If the clock stops at 12:00, you're done, but if not, back to step 1.
Once the reed switch holder is properly located, secure the reed switch holder into position using a small dot of thick cyanoacrylate glue.
Finally:
- Change the source code constant "HOME_SWITCH_CALIBRATE" to "false".
- Set the source code constant "TIME_ZONE" to your time zone (the offset from UTC to my time zone is -5).
- Download the code to the clock.
- Remove power.
Step 6: Attach the Clock Frame to the Clock Rear.
Press three neodymium magnets, one each into the three small holes in "Rear, Dual Extrusion.stl" or "Rear.stl". Make sure all magnets are oriented the same.
Thread the four "Standoff, Frame to Rear.stl" into the rear assembly as shown.
Position the frame assembly onto the four standoffs, then secure in place with four "Bolt, 6mm by 8mm.stl".
Step 7: Assemble the Clock Front.
Thread the three "Standoff, Front to Rear.stl" into either "Front, Dual Extrusion.stl" or "Front.stl".
"Cover.stl" is optional, and if you decided to print it, press it into place in the slot around the front.
Step 8: Assemble and Attach the Door.
Press the remaining three neodymium magnets, one each, into the three small holes in "Door.stl" making sure they align magnetically with the magnets in the rear assembly.
Screw "Door, Knob.stl" into the door assembly as shown.
Attach the USB cable to the ESP32, then route it out of the rear as shown.
Place the door assembly onto the rear assembly as shown.
Step 9: Final Assembly.
If you will be using a battery, plug it into the ESP32 battery connector, then position it as shown and carefully slide the front assembly onto the rear assembly. Be very careful to not break the reed switch.
Secure the front assembly to the rear assembly using three "Bolt, 6mm by 8mm.stl" as shown.
Press the hour hand fully onto the hour gear.
Press the minute hand fully into the minute gear.
Apply power to the clock. The clock will begin rotating clockwise to the 12:00 position, after which it will rotate via the shortest route to the NTP indicated time.
And that's how I printed and assembled "'Antique' Auto Correcting Analog Clock".
Hope you enjoy it!

Participated in the
Electronics Tips & Tricks Challenge
20 Comments
2 years ago
Спасибо!!! Всё очень круто! Заработали с первого раза!
Reply 2 years ago
Поздравляю!
4 years ago on Step 1
Hi Gzumwalt,
Can you confirm if the Frame.stl file is correct? The 3D rendering image does not match.
I am looking to see if I can get our local library to print the parts a few at a time.
Thanks again for an amazing project!
Reply 4 years ago
Hi Build_it_Bob,
I've notice that for some .stl files when "viewed in 3d" on Instructables, the image is not correct and this one appears to be no exception (don't recognize that frame, but it is indeed not showing correctly). To be certain, download the file and load it into Cura to view it.
Best wishes,
Greg
Reply 4 years ago
Hi Gzumwalt, I confirmed the frame.stl file using the windows 10 3D viewer is correct as you thought it would be.
I sent the file off to our local library to have it printed. It will take about 6 weeks, but I should have the bulk of the frame and gears to start building a working clock.
There is so much to learn from this project!
Thank you again, and Happy New Year!
Reply 4 years ago
Hi Build_it_Bob,
Great, I'm glad you've verified the correct file before sending it off. I have some "spare parts" remaining from the prototype of this model if you'd like to have them.
You are very welcome and Happy New Year to you too! And I'm sorry for the delayed response as I had cataract surgery on both eyes and my vision is still somewhat fuzzy, but improving.
Thanks again,
Greg
Reply 4 years ago
Hi Greg, I hope the results from the surgery are better than expected. A friend just had one eye done a bit ago, and now she says she has bionic vision.
With our hobby we need the best vision possible, and good motor skills. I am so enjoying this build; I have a part ready for pick up at the library, and I am going to submit a few more files to print. If all goes well, I would like to build a 2nd clock and try to install it in a keepsake mantle clock my Dad gave me. That would contain the chime from your other design, which I think will be a great feature.
I will send you a PM, and thank you for all your time and effort; it is greatly appreciated.
Question 4 years ago on Introduction
My clock is running backwards, what should I check to fix it?
Answer 4 years ago
Hi nlkirchn,
Sorry for the difficulties.
You can either:
1) swap the wires on one coil of the stepper, or
2) in the function Step(), change:
nPhase = ((nDirection < 0) ? (nPhase - 1) : (nPhase + 1)) & 7;
to
nPhase = ((nDirection < 0) ? (nPhase + 1) : (nPhase - 1)) & 7;
Hope this helps!
Greg
Reply 4 years ago
Thank you as always your assistance fixed the problem I changed the code. I purchased a kit for a robotic arm that uses an Arduino UNO as a controller. I need to learn how to program an Arduino what would you recommend as a good starting tutorial?
Reply 4 years ago
Hi nlkirchn!
I'm glad you are now up and running!
There are many good sites for Arduino style programming. Also, in your Arduino environment, select the "File, Examples" menu and you'll find a number of examples from blinking a led to, if you've installed the wifi libraries, web servers. The Adafruit site has many useful examples, as well as this one, Instructables.
The Arduino environment supports both C and C++ programming, so if you're not yet a "programmer". studying these sites may help also.
Best wishes!
Greg
Answer 4 years ago
your stepper motors may be wired incorrectly. The driver has a step and dir input on the pcb. Is there a way to change the code for that?
Reply 4 years ago
Changed the code in the function Step(), change:
nPhase = ((nDirection < 0) ? (nPhase - 1) : (nPhase + 1)) & 7;
to
nPhase = ((nDirection < 0) ? (nPhase + 1) : (nPhase - 1)) & 7;
Solved the problem.
4 years ago on Introduction
The parts list needs to more specific regarding the ESP32 Feather Board, I ordered one but didn't realize that there are many different modules and ordered the wrong one. The correct module is Adafruit HUZZAH32 – ESP32 Feather Board. The holes in the feather and the stepper board are for 3mm fasteners not 4mm. I'll post a photo when its finished.
4 years ago
Hey nice work, but just to let you know that one of the files, rear.stl will not download, I get an error. thx
Reply 4 years ago
Thank you very much, I'm glad you liked it!
This isn't the first time that's happened here, but I did just downloaded "Rear.stl", loaded into Cura 3.5.1 and it appears fine, but I will let Instructables know of the difficulties you are experiencing.
Thanks again!
Greg
Reply 4 years ago
great thanks, works now. looking forward to trying this, although I need to order this board. I never heard of this before, I was trying to program a nano to run a motor (stepper) and switch with a counter and just pause motor each minute as to what the rotation is. I would set it up to be slightly over 1 rpm, then the switch would force a pause, calculate the timing and pause for that many step.
Reply 4 years ago
You are very welcome.
Here's something I published you may find helpful: https://www.instructables.com/id/Stepper-Motor-Tes...
Greg
Reply 4 years ago
thanks I will have to look into this. I do not know much about this board. I have been playing mostly with the uni/nano boards. Does this get the correct time from wifi or something?
Reply 4 years ago
Hi reichert99,
Yes, the esp32 accesses an ntp server using wifi to maintain the correct time. If you search for ntp servers, you'll find a variety of ip addresses where ntp time is available.
Greg