3D Printed Mantel Style Auto Correcting Clock With Chimes and Daylight Savings Time
by gzumwalt in Circuits > Clocks
6783 Views, 42 Favorites, 0 Comments
3D Printed Mantel Style Auto Correcting Clock With Chimes and Daylight Savings Time
Designed as a mixture of "mantel clock" and "bakelite radio" ("bakelite", what's that?) styling, "3D Printed Mantel Style Clock" is an analog clock featuring electronic chimes, hourly NTP time synchronization over wifi, daylight savings time (optional) and battery backup (also optional).
The clock incorporates an Adafruit Feather ESP32 for time keeping, an Adafruit Feather Music Maker driving twin 1.5 inch speakers for chimes, and a stepper motor / stepper motor controller driving a 3 gear gear train for displaying time in hours and minutes using analog clock hands.
The clock software uses two cpu cores in the ESP32. The setup and loop functions execute in core 1, with the tasks for clock homing, clock hand updating, mp3 startup and mp3 playback executing in both core 0 and core 1. Using this architecture along with a 1hz ESP32 interrupt, the clock timekeeping and display updating occur simultaneously with clock audio.
The clock remains "calibrated" by synchronizing once per hour with an NTP time server. If power is lost, the optional battery backup will keep the clock running during short power outages. If the optional battery backup is not used, when wifi becomes available and power is restored the clock will return to the correct time.
The clock chimes, stored as individual mp3 files on a micro SD card inserted into the music maker, were inspired by an antique clock my wife inherited from her father after his passing, in that I attempted to reproduce the mechanical sounds created by the clock into the mp3 chimes. Based on the time of day, the clock software transfers one of the mp3 files to the music maker via an ESP32 SPI bus. Since each of the chimes (top, quarter, half and three quarter hour, plus the twelve hour count chimes) reside on the micro SD as individual mp3 files, you may load whatever mp3 file desired for the chimes.
The clock daylight savings time feature is optional and is set up at compile time. When enabled, on the user programmable daylight savings time start month and day (either the second Sunday or a specific day of the month) and hour, the clock will wind forward one hour. And on the user programmable daylight savings time end month and day (either the first Sunday or a specific day of the month) and hour, the clock will wind backward one hour.
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 point them out 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.
Purchased Parts.
I purchased the following parts:
- One Adafruit Feather ESP32 (https://www.adafruit.com/product/3405).
- One set of Adafruit "slim" female socket headers for the Feather ESP32 (Adafruit).
- One Adafruit Feather Music Maker (https://www.adafruit.com/product/3436).
- Two 1.5 inch 4ohm speakers (https://www.amazon.com/gp/product/B01LN8ONG4/ref=oh_aui_detailpage_o05_s00?ie=UTF8&psc=1).
- 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).
- Nine 3mm diameter by 1.5mm thick neodymium (local hobby shop).
- Four 2mm by 10mm cap screws (local hardware store).
- Four 2mm nuts (local hardware store).
- One USB to ESP32 USB cable (Adafruit).
- One lithium battery (3.7vdc, 1200mah, Adafruit, optional).
- One Micro SD card.
Printed Parts.
I printed all 3D printed parts at .15mm layer height, the bolts and standoffs at 50% infill, the remaining parts at 20% infill and no supports. The 3D printed parts include:
- One "Axle Gear, Minutes To Hours.stl".
- Seven "Bolt, 6mm by 8mm.stl".
- One "Bolt, Holder, Switch, Reed.stl".
- Two "Bolt, Motor.stl".
- One "Cover.stl".
- One "Door.stl".
- One "Frame.stl"
- One "Front.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.3mf" or "Rear.stl".
- Four "Spacer, Frame PC Boards.stl".
- Four "Standoff, Frame to Front.stl".
- Three "Standoff, Front 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.
Downloads
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.
Assemble the Feather ESP32 and Feather Music Maker.
Assemble the Feather ESP32 using the "slim" female socket connectors as described here: https://www.adafruit.com/product/3436.
Assemble the Feather Music Maker using the included connectors (see "https://www.adafruit.com/product/3436").
Wiring.
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 only two cap screws, spacers and nuts are used per board), then:
- Soldered a wire between the ESP32 pin A0 to stepper board pin IN1.
- Soldered a wire between the ESP32 pin A1 to stepper board pin IN2.
- Soldered a wire between the ESP32 pin A5 to stepper board pin IN3.
- Soldered a wire between the ESP32 pin 21 to stepper board pin IN4.
- 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.
- Soldered red wires to the the "+" terminal on each speaker.
- Soldered black wires to the "-" terminal of each speaker.
- Connect one speaker to each of the speaker terminals on the music maker.
When finished, I removed the boards from the frame.
Install the MP3 Files on the Micro SD Card.
Unzip the file "MP3s.zip" onto the root directory of the micro SD card.
The MP3 files include:
- 12.mp3: Top of hour tune.
- 15.mp3: Quarter hour tune.
- 30.mp3: Half hour tune.
- 45.mp3 Three quarter hour tune.
- Hours1.mp3: 01:00 chime count.
- Hours2.mp3: 02:00 chime count.
- Hours3.mp3: 03:00 chime count.
- Hours4.mp3: 04:00 chime count.
- Hours5.mp3: 05:00 chime count.
- Hours6.mp3: 06:00 chime count.
- Hours7.mp3: 07:00 chime count.
- Hours8.mp3: 08:00 chime count.
- Hours9.mp3: 09:00 chime count.
- Hours10.mp3: 10:00 chime count.
- Hours11.mp3: 11:00 chime count.
- Hours12.mp3: 12:00 chime count.
Insert the micro SD card into the music maker.
Downloads
Assemble and Test the Clock Frame.
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.
Position the reed switch assembly over the slot in the frame assembly, then secure in place with "Bolt, Holder, Switch, Reed.stl" as shown.
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).
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.
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.
Press the hour hand onto the hour gear followed by the minute hand into the minute gear.
Power up the boards via USB to your computer and battery (if you wired the clock for USB and battery) or USB to your computer only (if you wired the clock for USB only), load the file "MantelClock.ino" into the Arduino environment and make sure you have all libraries listed in the "Includes" section loaded into your 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 exactly 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 exactly at 12:00, you're done, but if not, back to step 1.
- Once the reed switch holder is properly positioned, secure the reed switch holder into position using a small dot of thick cyanoacrylate glue.
With the reed switch properly positioned, prepare the clock for normal operation by performing the following steps:
- Change the source code constant "HOME_SWITCH_CALIBRATE" to "false".
- Set the source code constant "TIME_ZONE" to your time zone (Oklahoma is -6).
- Set the daylight savings time source code variables:
- To disable daylight savings time:
- Set both source code variables nDstStartMonth and nDstEndMonth to zero.
- To enable daylight savings time:
- Set the source code variable nDstStartMonth to the starting month (1 - 12, Oklahoma is 3 or "March") when daylight savings time begins, and the source code variable nDstEndMonth to the ending month (1-12, Oklahoma is 11 or "November") when daylight savings time ends.
- Set the source code variable nDstStartDay to the starting day of the starting month (0 for second Sunday, 1 through 28-31 for specific day of the month, Oklahoma is 0) when daylight savings time begins, and the source code variable nDstEndDay to the ending day of the ending month (0 for first Sunday, 1 through 28-31 for specific day of the month, Oklahoma is 0) when daylight savings time ends.
- Set the source code variable nDstStartHour to the hour on the starting day of the starting month when daylight savings time begins (0 through 23, Oklahoma is 2 or 02:00AM), and the source code variable nDstEndHour to the hour on the ending day of the ending month when daylight savings time ends (0 through 23, Oklahoma is 2 or 02:00:00AM).
- To disable daylight savings time:
- Download the code to the clock.
- Remove power.
- Remove the minute and hour hands.
- Plug the music maker into the ESP32 header.
- Carefully place the speakers into the frame on the gear side of the frame and secure in place with small dots of thick cyanoacrylate glue, double sided tape, etc.
Downloads
Assemble the Clock Front.
Thread the four "Standoff, Frame to Front.stl" into "Front.3mf" (or "Front.stl").
Carefully position the frame assembly gear side up then slide the front onto the frame assembly.
Align the four frame standoff holes with the four standoffs, then secure the frame assembly to the front using four "Bolt, 6mm by 8mm.stl".
Thread the three "Standoff, Front to Rear.stl" into the front assembly as shown.
Final Assembly.
For ease of installation, you may wish to plug the optional battery into the ESP32 at this time, but use caution during the remainder of final assembly as the clock will be operational and the gears and hands will move.
Slide "Cover.stl" into position on the front assembly as shown, making sure the cover slides into the slot in front
Press three neodymium magnets into "Rear.3mf" (or "Rear.stl") as shown (it's best to orient the magnets the same for ease of door preparation below).
Place the rear assembly into position on the front assembly as shown, making sure the cover slides into the slot in rear.
Secure the rear assembly, front assembly and cover together using three "Bolt, 6mm by 8mm.stl" inserted one each into each of the holes in the rear assembly and threaded into the three front to rear standoffs.
Press three neodymium magnets into "Door.stl" making sure that the orientation of each magnet in the door attracts to the respective magnet in rear of the clock assembly.
Press the hour hand onto the hour gear, and the minute hand into the minute gear as shown.
Insert the USB cable into the ESP32, then route the cable out of the rear of the assembly as shown.
If using the battery backup option, and not already installed in the first step, plug the battery into the ESP32, then slide it into position between the frame assembly and cover as shown. This is a difficult procedure.
Place the door into position as shown, and you're done!
That's how I printed, programmed, assembled and tested 3D Printed Mantel Style Clock.
Hope you enjoy it!