3D Printed Mantel Style Auto Correcting Clock With Chimes and Daylight Savings Time

1,988

18

13

About: You fail only when you decide to quit learning.

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.

Step 1: Purchased Parts.

I purchased the following parts:

      1. One Adafruit Feather ESP32 (https://www.adafruit.com/product/3405).
      2. One set of Adafruit "slim" female socket headers for the Feather ESP32 (Adafruit).
      3. One Adafruit Feather Music Maker (https://www.adafruit.com/product/3436).
      4. Two 1.5 inch 4ohm speakers (https://www.amazon.com/gp/product/B01LN8ONG4/ref=oh_aui_detailpage_o05_s00?ie=UTF8&psc=1).
      5. One stepper motor, controller and cables (TIMESETL 5pcs DC 5V Stepper Motor 28BYJ-48 + 5pcs ULN2003 Driver Board, online).
      6. One reed switch (ORD2210V/20-25 AT, Mouser.com. These are very fragile, so I purchased 10).
      7. Nine 3mm diameter by 1.5mm thick neodymium (local hobby shop).
      8. Four 2mm by 10mm cap screws (local hardware store).
      9. Four 2mm nuts (local hardware store).
      10. One USB to ESP32 USB cable (Adafruit).
      11. One lithium battery (3.7vdc, 1200mah, Adafruit, optional).
      12. One Micro SD card.

      Step 2: 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:

      1. One "Axle Gear, Minutes To Hours.stl".
      2. Seven "Bolt, 6mm by 8mm.stl".
      3. One "Bolt, Holder, Switch, Reed.stl".
      4. Two "Bolt, Motor.stl".
      5. One "Cover.stl".
      6. One "Door.stl".
      7. One "Frame.stl"
      8. One "Front.3mf" or "Front.stl".
      9. One "Gear, Hours.stl".
      10. One "Gear, Minutes To Hours.stl".
      11. One "Gear, Minutes.stl".
      12. One "Hand, Hour.stl".
      13. One "Hand, Minute.stl".
      14. One "Holder, Switch, Reed.stl".
      15. One "Rear.3mf" or "Rear.stl".
      16. Four "Spacer, Frame PC Boards.stl".
      17. Four "Standoff, Frame to Front.stl".
      18. 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.

      Step 3: Install the Reed Switch in the Reed Switch Holder.

      A few notes about reed switches:

      1. They are very fragile.
      2. They are very fragile.
      3. 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 4: 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").

      Step 5: 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:

      1. Soldered a wire between the ESP32 pin A0 to stepper board pin IN1.
      2. Soldered a wire between the ESP32 pin A1 to stepper board pin IN2.
      3. Soldered a wire between the ESP32 pin A5 to stepper board pin IN3.
      4. Soldered a wire between the ESP32 pin 21 to stepper board pin IN4.
      5. Soldered a wire between the ESP32 pin GND to the stepper board pin "-".
      6. Soldered a wire between the ESP32 pin "BAT" (for battery backup) or "USB" (non-battery use) to the stepper pin "+".
      7. Soldered a wire between the ESP32 pin 27 to one wire of the reed switch.
      8. Soldered a wire between the ESP32 pin GND to the remaining wire of the reed switch.
      9. Using thick cyanoacrylate, glued the wires to the side of the reed switch holder to provide strain relief.
      10. Soldered red wires to the the "+" terminal on each speaker.
      11. Soldered black wires to the "-" terminal of each speaker.
      12. Connect one speaker to each of the speaker terminals on the music maker.

      When finished, I removed the boards from the frame.

      Step 6: 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:

      1. 12.mp3: Top of hour tune.
      2. 15.mp3: Quarter hour tune.
      3. 30.mp3: Half hour tune.
      4. 45.mp3 Three quarter hour tune.
      5. Hours1.mp3: 01:00 chime count.
      6. Hours2.mp3: 02:00 chime count.
      7. Hours3.mp3: 03:00 chime count.
      8. Hours4.mp3: 04:00 chime count.
      9. Hours5.mp3: 05:00 chime count.
      10. Hours6.mp3: 06:00 chime count.
      11. Hours7.mp3: 07:00 chime count.
      12. Hours8.mp3: 08:00 chime count.
      13. Hours9.mp3: 09:00 chime count.
      14. Hours10.mp3: 10:00 chime count.
      15. Hours11.mp3: 11:00 chime count.
      16. Hours12.mp3: 12:00 chime count.

      Insert the micro SD card into the music maker.

      Step 7: 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:

      1. Change the source code constant "HOME_SWITCH_CALIBRATE" to "true".
      2. Change the source code variable "chSSID" to your wifi router SSID.
      3. Change the source code variable "chPassword" to your wifi router password.
      4. 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:

      1. If the clock is early, rotate or slide the reed switch holder away from the rotation of the hour gear magnets.
      2. If the clock is late, rotate or slide the reed switch holder towards the rotation of the hour gear magnets.
      3. Press the reset button on the ESP32.
      4. If the clock stops exactly at 12:00, you're done, but if not, back to step 1.
      5. 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:

      1. Change the source code constant "HOME_SWITCH_CALIBRATE" to "false".
      2. Set the source code constant "TIME_ZONE" to your time zone (Oklahoma is -6).
      3. 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).
      4. Download the code to the clock.
      5. Remove power.
      6. Remove the minute and hour hands.
      7. Plug the music maker into the ESP32 header.
      8. 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.

      Step 8: 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.

      Step 9: 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!

      Share

        Recommendations

        • First Time Author

          First Time Author
        • Big and Small Contest

          Big and Small Contest
        • PCB Contest

          PCB Contest

        13 Discussions

        0
        None
        zanod

        10 hours ago

        Nice project - and very pretty. Here's an idea that you may like.
        I have had an ambition for a long time to make a wooden clock (with wooden gears) with two chimes, and the chimes would be easy to port to your project - if you're interested, of course. Each quarter hour, the clock would completely specify what time it is. With the traditional Westminster chimes, you may know that it's quarter past something, but the chime itself doesn't tell you what. My two chimes would be a ding and a dong, and would represent binary 1 and 0. and there would be six chimes on the quarter hour. The chimes would be...
        chime .. chime .. chime .. chime .. [space] .. chime .. chime (4 chimes for the hour and two chimes for the quarter-hour.

        Each chime would be a ding or a dong (a 1 or a 0)
        The hour chime would go from 0 0 0 1 for 1:xx (where xx is the quarter)
        to 1 1 0 0 for 12:xx
        The quarter chime would be 0 0 on the hour, 0 1 for quarter past, 1 0 for half past, and 1 1 for quarter to.
        Every hour chime has at least one ding and at least one dong, so the difference can be discerned. This means that even if the quatrer-hour chime is 0 0 , you already have a 0 and a 1 in mind from the hour chime, so the quarter hour is easy to distinguish also.

        So if the clock goes...
        ding .. dong .. ding .. dong ....... ding .. dong
        ... then it's half past ten.

        If it goes...
        dong .. ding .. dong .. ding ....... dong .. ding
        ... then it's 5:15

        1
        None
        Wynfordeagle

        1 day ago

        What an impressive project. It is on my list to build. Very well done.

        1 reply
        0
        None
        Fred Doolie

        1 day ago

        An excellent project and a clever idea. The only problem I can see is you are locking it to one wifi server and it's password. Therefore a person would need to be a computer operator and have access to the source code to change that.

        What I mean is this clock wouldn't be too great a gift for somebody.
        "What's your wifi SSID and password? Don't ask questions around Christmas; just tell me".

        It's very cool though.

        3 replies
        0
        None
        gzumwaltFred Doolie

        Reply 1 day ago

        Hi Fred,

        First, thank you very much, I'm truly glad you enjoyed it.

        And second, you probably won't believe it, but just before I published the software, I removed the code that placed the ESP32 in both station and access point mode and the code that provided a setup page where one could set the volume of the clock along with the SSID and password of the wifi router. The reasoning behind this was to simplify the code for someone who just wanted a clock.

        Guess I'll put it back in... :)

        Thanks again!

        Greg

        0
        None
        MikeH36gzumwalt

        Reply 1 day ago

        You could put in code and a switch for WPS...

        BTW, your design looks like a mocha cake. yum...

        0
        None
        gzumwaltMikeH36

        Reply 1 day ago

        I can no longer eat mocha cake :(, keeps me up at night!

        :)

        Greg

        0
        None
        jeffreye

        1 day ago

        Awsome Project! I can see I need to blow the dust off my 3D printer and fire it up!
        I will Def be making this, Very Cool!!!!

        1 reply
        0
        None
        gzumwaltjeffreye

        Reply 1 day ago

        Thank you very much jeffreye, I'm happy that you enjoyed it!

        Now get printing! :)

        Greg

        0
        None
        Build_it_Bob

        1 day ago

        This is an incredible project. Awesome integration and execution!
        I am enjoying your other Instructables creations as well.
        Your newest follower,
        Bob D

        1 reply
        0
        None
        gzumwaltBuild_it_Bob

        Reply 1 day ago

        Bob,

        Thank you so very much for your kind words, I'm truly happy that you enjoyed the clock!

        And thanks also for being a follower!

        Greg