Introduction: Inside-out Clock

Picture of Inside-out Clock

This table or desktop clock is an "inside out" clock, where the gears that drive the hands are intentionally clearly visible rather than hidden inside a case or housing. I think it makes the clock much more interesting and quite attractive. I built the clock because it combines my lifelong fascination with clocks and my career experience in software and electronics engineering, and adds mechanical engineering, which is quite new to me.

The clock obviously has a mechanical movement, but it is driven by a stepper motor. The motor is controlled via an Ardunio acting through a sohpisticated stepper motor driver. The net result is a mechanical clock that is I feel aesthetically appealing, and that is as accurate as a typical quartz clock.

An important feature of the clock is that the hands are removable. The pictures show two different types of "standard" hands. However, it is also possible to use different materials, such as laser-cut pointers, arrows, or whatever.

Step 1: The Parts

You can think of the clock as constructed from several sub-assemblies:

  • the stand
  • the frame
  • the movement, or gear train
  • the drive motor
  • the electronics
  • the software

The frame, the movement and the stand are built totally using Actobotics parts. The precision of Actobotics parts allowed me to build a precision device without having a machine shop. The beauty of Actobotics parts allowed me to build something I can proudly display in my condo.

I used a stepper motor to drive the movement. Initially, I tried a precision planetary gear DC motor. However, I wanted virtually silent operation, and that motor made way too much noise. After examining some alternatives, I decided to try a stepper motor. Research indicated that stepper motors can also be noisy unless driven "cleverly". That leads to the electronics.

Given my requirement for virtually silent stepper motor operation, I searched for a motor or driver or combination that would meet the requirement. I found the SilentStepStick that works quite well, and with just about any stepper motor. In three different clocks with different movements and different speed requirements, the SilentStepStick has provided literally silent operation.

Obviously, the motor, and electronics, have to be powered. The SilentStepStick has a maximum current capability around 2 Amp. I decided to try to limit the currents involved to less than 1 Amp. I found that 12VDC power supplies are readily available. That set the parameters for the motor I choose. Other power supplies and motors could likely work just as well or better.

The SilentStepStick alone cannot control a stepper motor. I concluded that for the kind of flexibility and relatively low cost I desired, I'd use an Arduino-based controller to command the stepper driver. The Arduino and its 16MHz crystal account for the overall accuracy of the clock.

An example of the flexibility I mention relates to some of the realities of time keeping. As accurate as the clock is, it will loose or gain time. And, at least in many areas, time keeping moves from standard to daylight savings to standard. So, the clock must be set. It is certainly possible to do it manually, but I wanted to provide an electronic means. To achieve that, I added a push-button switch monitored by that Arduino. The switch allows a human to command the Arduino to perform various actions, which will be detailed in the software steps.

Finally, to the parts:

Mechanical - frame

Mechanical - movement

Mechanical - stand

Mechanical - hands

The pictures in the introduction show two different styles for the hour and minute hands. Parts for both are listed. It is also possible to create and attach custom hands.

Second hand

  • 1 * 6.16" aluminum beam

Minute and hour hands, option 1

Minute and hour hands, option 2

  • 1 * 4.62" aluminum beam
  • 1 * 3.08" aluminum beam
  • 2 * 1/4" #6 nylon spacer
  • 2 * 5/8" #6 nylon spacer

Mechanical - miscellaneous

The motor

The electronics and associated parts

Tools

  • 7/64" extra long ball end hex key
  • 3/32" extra long ball end hex key
  • 2 mm hex key (if you use the coupling listed; others may need a different size)
  • small Philips head screw driver
  • wire stripper
  • needle nose pliers
  • soldering iron and solder
  • (optional, but highly recommended) multi-meter
  • (optional) oscilloscope

Step 2: Build the Stand

Picture of Build the Stand

It is a good idea to build the stand first because is it quite convenient to have the clock on the stand during the rest of the construction.

  1. Mount a 1" bore clamping hub on "top" of the triple channel bracket with the clamping screw of the hub on the long axis of the bracket. Use socket screws at least 3/8" coming "up" from the "bottom" of the bracket. See the second picture.
  2. Attach the bracket on top of two of the 7.7" beams, with a beam on each end of the bracket. Make sure the bracket is in the middle of the beam. Use socket screws at least 7/16" and nuts. The screws go thru the bracket and into the beams, with the nuts below the beams. DO NOT YET TIGHTEN THE SCREWS ALL THE WAY.
  3. Mount a beam attachment block B at the end of each of the beams attached to the bracket. The flat part of the block orients to the bottom of the beam. See the third picture. Use 3/8" socket screws. DO NOT YET TIGHTEN THE SCREWS ALL THE WAY.
  4. Attach another 7.7" beam two the two blocks on one side of the bracket. Make sure you have centered the "crossing" beam. Use 1/2" socket screws. Repeat with the remaining 7.7" beam on the other side. DO NOT YET TIGHTEN THE SCREWS ALL THE WAY.
  5. Place the assembly on a flat surface. Now tighten all screws. Make sure all parts remain square and the bottom beams remain level on the surface.
  6. Insert the 4" long 1" diameter tube into the clamping hub and tighten the clamping screw.

Step 3: Build the Frame

Picture of Build the Frame

The frame is a bit tricky because it is not easy to perfectly align the channel with panel. You must be careful and patient.

  1. Mount a 1" clamping hub to the "middle bottom" of a 4.5" channel. Use 7/16" socket screws started "inside" the channel. See the first picture. The clamping hub will allow you to place the clock on the stand as you construct it.
  2. Mount the 4.5" channel from step on 4.5" side you want to to be the bottom of the clock frame. You will have to use single screw plates where marked (red) in the second figure (you should have enough if you order hardware pack A in the parts list). You can use nuts where marked (green) in the figure, but you can use single screw plates if you wish. Use 5/16" socket screws. DO NOT TIGHTEN THE SCREWS AT THIS TIME.
  3. Mount the second 4.5" channel on the top of the panel. The screw plate versus nut rule applies. DO NOT TIGHTEN THE SCREWS AT THIS TIME.
  4. Slide a 3" channel between the two 4.5" channel (on either side). This may be somewhat tricky, but be persistent. The screw plate versus nut rule applies. DO NOT TIGHTEN THE SCREWS AT THIS TIME.
  5. Slide a 3" channel bracket between the two 4.5" channel (on the remaining side). Again, be persistent. The screw plate versus nut rule applies. DO NOT TIGHTEN THE SCREWS AT THIS TIME.
  6. Insert bearings into the four 1/2" holes on left side of the panel, into the four 1/2" holes on the right side of the panel, and into the holes at the top middle and bottom middle 1/2" holes of the panel. A bearing flange must be flush with the panel. You may have to play with the positioning of the channel parts to allow the bearings to mount flush. Once all ten bearings are flush, very carefully tighten all of the screws holding the channel parts to the panel; ensure that the bearings remain flush as you tighten. NOTE: it may be easier to perform this step with the frame laying flat rather than mounted on the stand.
  7. Turn the frame so that you are looking at the back of the frame. Use connector plate A to join the top 4.5" channel to the left and right 3" channel and join the bottom 4.5" channel to the left and right 3" channel. Use 1/4" socket screws. The connector plates help retain good alignment for the shafts used in the the next step.

After the last bit above, you should benefit from performing further steps with the frame mounted on the stand. When you put the frame on the stand, some of the bearings might fall out. That is a good thing! It means that the panel and channel are aligned well.

Step 4: Attach the Stepper Motor

Picture of Attach the Stepper Motor

You should attach the stepper motor at this point because it will be more difficult once the shafts and gears are in place.

  1. Attach the NEMA 17 stepper motor mount to the stepper motor using the screws supplied with the mount.
  2. Mount that assembly to the bottom middle back of the frame using 1/4" truss head screws. See the first picture. You will need a small Philips head screw drive that you can insert thru the holes in the panel and front side of the channel to reach the screws going thru the back side of the channel. Truss heads screws have a lower profile and allow the flexible coupling to be mounted closer to the motor and grab more of the shaft.
  3. Maneuver the flexible coupling (ensuring the 5 mm hole is toward the stepper motor shaft) over the stepper motor shaft. This can be a bit difficult; once again, be careful and patient. You should be able to squeeze the coupling against the front side of the channel to get the hole almost over the shaft.
  4. Position the coupling so that a (or the) set screw is positioned over the flat on the shaft. Move the coupling towards the motor, but make sure the coupling will not touch the truss head screws when the motor turns. However, you should make the distance between the coupling and the screws as small as possible. Tighten the set screw (or screws if there are two) over the motor shaft. Make sure the set screws for the 1/4" shaft are "open".

Step 5: Build the Movement

Picture of Build the Movement

Now the really fun part -- adding the shafts and gears. The gear train is designed specifically to maximize the visibility of the brass pinion gears. The "inside-out" nature of the clock mandated a 3 layer gear drive train -- i.e., there are in effect 3 layers of gears. You will add one layer at a time.

General movement construction considerations

First, some general points, which may or may not be mentioned in the detailed instructions:

  • All aluminum gears are mounted, "hollow face" out, to set screw hubs that are "bump up", using four 3/8" socket screws. You will change some of the screws on the gears upon which the hands are mounted.
  • All pinion gears are mounted, "hollow face" out, directly to a shaft.
  • Any shaft must be support by two bearings. Most shaft use "outside bearings", with one on panel at the front of the frame and another on the channel at the back of the frame. Some use "inside bearings" with one on inside of the channel at the front of the frame and another on the inside of the channel at the back of the frame. The shaft driven by the stepper motor only uses one bearing on the front panel.
  • Where possible, a gear holds the front bearing in place; otherwise a set screw collar holds the bearing in place. A set screw collar holds the back bearing in place.
  • A 1/4" bore plastic shaft spacer sits between any gear or set screw collar to prevent wear.
  • An aluminum gear at the end of a shaft is mounted with the front surface of the set screw hub flush with the shaft. A pinion gear mounted at the end of a shaft is mounted with the surface of the gear flush with the shaft.
  • Any gear or hub or collar must be positioned with the set screw over the flat on the shaft before tightening the set screw.
  • Any gear with 16T, 24T or 32T is a pinion gear. Any gear with 48T, 64T, 72T or 80T is an aluminum gear on a set screw hub.
  • The shaft positioning in the instructions below is approximate. You will have to do some adjustment later to better align the gears.

Gear layer 1

You can now insert the shafts for the gears, and add gears as appropriate. The first picture shows reference numbers for the shaft locations (viewed from the front). For the shafts, and first layer of gears:

  1. Insert a 5" shaft into location 1, with "outside" bearings. The shaft should protrude about 2 13/16" past the front panel surface. Put a collar on the back and a 64T gear flush to the bearing on the front. Don't forget the plastic spacer.
  2. Insert a 4" shaft into location 2, with "outside" bearings. The shaft should protrude about 1 11/16". Put a collar on the back and a 16T gear on the front. IMPORTANT: use 2 shaft spacers between the 16T gear and the front bearing.
  3. Insert a 4" shaft into location 4 [not 3!], with "outside" bearings. The shaft should protrude about 1 13/16". Put a collar on the back and a collar on the front.
  4. Insert a 3" shaft into location 3 [not 4!], with "inside bearings" (the collars go inside the channel, with spacers between the bearing flange and the collar). The shaft should protrude about 1 1/4". Put an 80T gear on the front so that it meshes with the 16T gear on shaft 2 and does not hit the collar on shaft 4. NOTE: the gear will not be flush with a bearing or the panel surface.
  5. Insert a 4" shaft into location 5, with "outside" bearings. The shaft should protrude about 1 3/4". Put a collar on the back and a 48T gear on the front.
  6. Insert a 3" shaft into location 6, with "inside bearings". The shaft should protrude about 1 5/16". Put a 48T gear on the front so that it meshes with the 48T gear on shaft 5. IMPORTANT: I experienced a bit of difficulty meshing these two gears due to a bad production run. If the don't rotate reasonably well, you may have to get replacements. My experience suggests they will not rotate as freely as say a 32T and a 64T combination. NOTE: the gear will not be flush with a bearing or the panel surface.
  7. Insert a 3" shaft into location 7, with "inside bearings". The shaft should protrude about 1 1/16". Put a 32T gear on the front. NOTE: the gear will not be flush with a bearing or the panel surface.
  8. Insert a 4" shaft into location 8, with "outside" bearings. The shaft should protrude about 1 7/8". Put a collar on the back and a 64T gear on the front. The 64T gear should mesh with the 32T gear on shaft 7.
  9. Insert a 4" shaft into location 9, with "outside" bearings. The shaft should protrude about 1 5/8". Put a collar on the back and a collar on the front.

Gear layer 2

For the second layer of gears:

  1. Put a 32T gear at the end of shaft 3.
  2. Put a 64T gear on shaft 4 so that it meshes with the 32T gear on shaft 3.
  3. Put a 24T gear at the end of shaft 6.
  4. Put a 72T gear at the end of shaft 7 so that it meshes with the 24T gear on shaft 6.

The second layer of gearing is now complete. You can test some gear combinations by rotating them by hand. If they do not rotate with relative ease, check bearings, etc.

Gear layer 3

For the third and final layer of gears:

  1. Put a 64T gear at the end of shaft 2.
  2. Put a 32T gear on shaft 1 so that is meshes with the 64T gear on shaft 1. NOTE: At this point when you rotate shaft 1 by hand, all shafts on the left side should rotate.
  3. Put a 24T gear at the end of shaft 4.
  4. Put a 72T gear at the end of shaft 5 so that is meshes with the 24T gear on shaft 4.
  5. Put a 32T gear at the end of shaft 8.
  6. Put a 64T gear at the end of shaft 9 so that it meshes with the 32T gear on shaft 8.

This completes the entire gear train. When you rotate shaft 1 by hand, all shafts should rotate. Of course, due to the gear reduction, shaft 9 will rotate very slowly.

Final construction

Now is the time to "tweak" the gear positioning so that the teeth of the gear pairs align completely. This may not be possible for gear pairs that are flush to bearings. The second picture shows well-aligned gears.

To finish, add the driving gear to the train, and add the support for the second hand.

  1. Attach a 32T gear at one end of the 1.5" shaft. Put a spacer next to the gear and then put a bearing on the shaft with the flange toward the gear.
  2. Insert the shaft into the 0 position. This will require that you manipulate the flexible coupling and the shaft and bearing so that the bearing is flush. The 32T gear must mesh with the 64T gear on shaft 1.
  3. Rotate the shaft so that the flat is underneath a set screw and tighten the set screw(s).
  4. Attach a set screw hub flat face out to the end of shaft 1.

Congratulations! You have finished the vast majority of the mechanical build. If you have a handy means of driving the stepping motor, you can do so now. In any case, you will assemble the drive electronics in the next step.

Step 6: Build the Electronics

Picture of Build the Electronics

The first figure shows the electronics circuit you need to build. I will explain the rationale for the particular parts chosen You can of course use different parts and achieve the same results.

SilentStepStick

I explained, in the Parts step, to a large degree, the reason I chose the SilentStepStick as the stepper motor driver -- truly silent operation. You probably won't believe it unless you try it. I admit I did not try other driver, and others might work just fine for this mostly undemanding application.

The driver comes as a breakout board for the chip with all the smarts, plus some male headers. You must solder the headers into the breakout board. Be sure you read the documentation on the orientation of the board and the default configuration before doing the soldering.

Pololu A-Star 32U4 Micro

I also explained, in the Parts step, a little about the choice of the Pololu A-Star 32U4 Micro. I mentioned the relatively low cost; there are certainly cheaper Arduino controllers, but many come with questionable quality/lifetime and lots of "just get it to blink" hassle; I hate hassle. For example, an important criterion to me, but perhaps no one else, is the built-in USB, Leonardo-like, capability; it makes programming and debugging much easier. The Micro also has an on-board voltage regulator that can supply the needs of both itself and the SilentStepStick. Finally, one can use the standard Arduino IDE, and maybe others.

The controller comes as a small circuit board, plus some male headers. You must solder the headers into the board.

Circuit board

I chose the Adafruit board primarily because of its size. The breadboard-like connectivity reduces the amount of soldering needed for connections. You can get both the SilentStepStick and the A-Star on it and still have room for headers to connect the switch, stepper motor and power. It fits nicely with Actobotics parts, even the mounting holes. You can of course use a different board.

As described in the Parts step, I decided to use headers for everything. There are a couple of reasons. First, I wanted to be able to replace the major electronics parts, i.e., the SilentStepStick and the A-Star, if something happened to them. I also wanted to easily salvage them for use in other projects if needed. Headers also eliminate the possibility of burning up the expensive parts while soldering them to the board. However, the headers do result in a bit more work and result in extra space required. So, you may wish to mount those parts directly on the board. The case for the switch, stepper motor and power is a bit more straightforward; it is just a lot easier to make all the needed connections and get minimal wiring lengths and put everything together if they can be independent of the circuit board.

The second figure shows the locations on the circuit board of the SilentStepStick, the A-Star, and for headers the switch, stepper motor and power. To build the board as shown

  1. Note that the switch header is in "row 1" and spans columns 5 & 6. You must cut the copper trace on column 5 on the back of the board between "row 1" and "row 2". Column 6 is wired to system ground. Column 5 is +5V produced by the A-Star. That means without modification, pushing the switch would short +5V to ground -- not good! Cutting the copper trace ensures that does not happen.
  2. Solder female headers for the SilentStepStick and the A-Star. Note very carefully the locations of these parts on the board. I used a single contiguous piece of header on each side of the power/ground bus, but only because I got lazy. I recommend cutting headers to the correct length for each part (8 pins and 10 pins respectively), thus leaving a gap between them.
  3. Solder female headers for the switch (2 pins), stepper motor (4 pins), and power (2 pins). Once again, be careful about the locations of these headers on the board.
  4. Make the connections, shown in the first figure, between the SilentStepStick and the A-Star, and between those parts and the headers for the switch, stepper motor, and power. I soldered hookup wire on the bottom of the board, but it is reasonable to position wire on both sides of the board. NOTE: I connected the +12VDC/ground power connector to the respective positive/negative rails on the circuit board; this makes it a lot easier to make the multiple ground connections and two +12VDC connections. IMPORTANT: Be sure no wiring extends more than 1/8" above the back of the board so that (in a later step) it can be mounted on a channel bracket using 1/8" spacers.

Switch

The push-button panel-mount switch is just a reasonably inexpensive but highly available switch. I specifically chose a panel mount type because I wanted to make it easy to use. I also did not want to mount it on the circuit board, as it would be very difficult to use. I found this particular switch to be attractive with its large red button. All that said, a different switch and mounting technique could be used.

For the switch and mounting position I chose

  1. Cut two pieces of hookup wire about about 3" long and solder one end of each to the switch tabs. I used two different colors for the wire, but it really does not matter.
  2. Cut two pieces of 1/16" diameter heat shrink around 1/2" long and put one on each wire.
  3. Solder the two wires to the short side of a two pin breakaway male header strip.
  4. Slip the two pieces of heat shrink over the wire at the header pins and shrink them. I found that a hair dryer works great when shrinking heat shrink tubing.

Power

I decided to have a somewhat "modular" power supply capability. Common DC wall power supplies have 2.1 x 5.5 mm barrel connectors. My first plan was to put a female connector on the circuit board, but there is not enough space. Further, feeding the power supply I purchased thru the 1/2" hole in the channel proved impossible. I sort of stumbled onto the idea of a pig tail. It offered several advantages: allows the use of header pins, slips easily thru the 1/2" holes, is more flexible. So, I think the pig tail is a good idea. However, the one I used seems less than a stellar choice: the wire is a high gauge (at least 24 and maybe higher), but adequate; the insulation is very thick and rubbery, making it difficult to strip easily without cutting into the wire; the insulation is also very soft, and might not stand up to a lot of rubbing against metal parts (tho this should not be a problem for the clock). In any case it is certainly possible to devise a different, and even better, power supply capability.

To assemble the power pig tail

  1. Cut the pig tail to about 9" long, including the barrel connector.
  2. Solder about 2 1/4" of hookup wire to the red and black wires of the pig tail. While not necessary, I used red and black hookup wire to easily differentiate between +12V and ground.
  3. Cut two pieces of 1/16" heat shrink about 3/4" long and put one on each wire. Cover the soldered connection with the heat shrink and shrink it; note that the 1/16" will not fit over the pig tail insulation. I used red and black heat shrink.
  4. Cut two pieces of 3/32" heat shrink about 1/2" long and position one each wire so that it is half on the pig tail insulation and half on the first heat shrink; shrink it. I used red and black heat shrink.
  5. Cut two pieces of 1/16" diameter heat shrink around 1/2" long and put one on each hookup wire.
  6. Solder the two wires to the short side of a two pin breakaway right angle male header strip.
  7. Slip the two pieces of heat shrink over the wire at the header pins and shrink them.

Stepper motor

The motor I used has black, green, blue, and red wires. Based on the SilentStepStick documentation, I connected these wires to the M1B, M1A, M2A, M2B pins, respectively, on the driver. If you use a different motor, you may see different colors.

To prepare the motor for connection

  1. Cut the motor wires to about 5 1/2" long.
  2. Cut four pieces of 1/16" heat shrink about 3/8" long and slip them onto the four wires. I used heat shrink with matching colors.
  3. Solder the wires to a 4 pin breakaway male header strip. Put the black wire on one end of the strip, then in order, the green, blue, and red wires.
  4. Slip the heat shrink pieces over the wire at the header pins and shrink them.

Verification

You should verify all of the connection work above:

  • Use a meter to check all of the desired connections on the circuit board, and perhaps even more important, check for any unintended connections.
  • Use a meter to check all the cables for shorts or bad solder joints.
  • Use a meter to verify that the pig tail delivers 12VDC when plugged into the power supply.

You should verify that the A-Star works correctly:

  1. Plug its USB connection to your computer and download the ubiquitous Blink sketch. You might want to do this first with a real breadboard to ensure nothing else interferes.
  2. Install the A-Star in to the circuit board, with or without the USB connection, and plug in 12VDC to ensure that Blink still works.

You must do some initial configuration of the SilentStepStick before you actually drive the stepper motor. You must set the maximum motor current according to the instructions for the SilentStepStick. Doing so in effect verifies it works to the extent possible before actually driving the motor.

Everything else should wait until you download the clock software to the A-Star.

Step 7: Install and Align the Hands

Picture of Install and Align the Hands

Install the hands

The Parts step lists two different styles of hour and minute hands. You can even create custom hands, even for the second hand.

It might be best to browse the "align" section below before installing the hands. Sometimes you can do a bit of "pre-alignment" and save time.

Second hand

The second hand is installed on the set screw hub on the end of shaft 1. The default is a 6.16" beam. Use two 1/2" socket screws. I chose to insert one screw in the 6th hole, but you can choose another. Just make sure the beam cannot touch the surface upon which the clock sits. Note that you can install it in two orientations that are perpendicular. It does not matter which orientation you use.

Hour and minute hands, style 1

For the "fat" channel bracket hour and minute hands (see the first picture)

  1. For the minute hand, remove the four screws from the 72T gear on the front of shaft 5.
  2. Insert a 15/16" socket screw thru a hole at one end of the flat channel bracket C.
  3. Slip a 1/2" nylon spacer onto the screw.
  4. Insert the screw into one of the mounting holes on the gear. Tighten the screw only enough to engage the threads. The looser you make it, the easier it is to insert the other screws.
  5. Repeat steps 2-4 for the three remaining mounting holes on the end of the bracket. This gets harder with each screw. I found using tweezers to hold the spacer while inserting the screw helps a lot.
  6. When all four screws are engaged, tighten all of them.
  7. Repeat steps 1-6 for the hour hand (flat channel bracket D), with the 64T gear on shaft 9, using 1/4" nylon spacers, and 5/8" screws.

Hour and minute hands, style 2

  1. Remove two of the four screws from the 72T gear on the front of shaft 5; remove two "across" from each other, not next to each other. It does not matter which pair you choose.
  2. Insert a 1.25" socket screw thru a hole near one end of the 4.62" beam; which hole is your choice; I chose the second from the end.
  3. Slip a 5/8" nylon spacer onto the screw.
  4. Insert the screw into one of the two mounting holes on the gear. Tighten the screw loosely.
  5. Repeat steps 2-4 for the second screw.
  6. Tighten the two screws.
  7. Repeat steps 1-6 for the hour hand (3.08" beam), with the 64T gear on shaft 9, using 1/4" nylon spacers, and 15/16" screws.

Align the hands

One of the trickiest aspects of the clock is getting the hands to "line up" so that the clock indicates the proper hour, minute and second. The second picture shows properly aligned hands; in this case the hour hand points to the 12 position, the minute hand points to the 12 position, and the second hand points to the 12 position.

Alignment for the clock is a matter of getting the proper orientation between the gears. Unlike press-fit hands on most clocks, you can't just arbitrarily the hands independent of the gearing. You must actually remove gears to tweak the orientation.

There are a lot of ways to perform the tweaking. What has worked best for me is the following:

  1. Remove the 64T gear on shaft 2. This disengages the second hand from the minute hand.
  2. Remove the 72T gear on shaft 7. This disengages the minute hand from the hour hand.
  3. Rotate the minute hand until it is pointing straight up (the 12 position).
  4. Rotate the second hand until it is pointing straight up.
  5. While keeping the minute and second hands straight up, align the 64T gear from step 1 with the holes in the set screw hub on shaft 2 when it meshes with the 32T gear on shaft 1. Three human hands really helps with this step; borrow one if you can.
  6. Reinstall the screws in the 64T gear.
  7. Rotate the hour hand until it is straight up. All three hands should now point straight up.
  8. While keeping the second hand straight up (the second hand won't move if the minute hand doesn't), align the 72T gear from step 2 with the holes in the set screw hub on shaft 7 when it meshes with the 24T gear on shaft 6. Once again, having hands three human hands really helps.

Step 8: Download the Code and Test the Electronics

Download the code to your computer

The first thing to do is get the Arduino sketch for the A-Star.

  1. Download the code to your computer from here.
  2. Inject the code into your favorite IDE.
  3. Make sure the code compiles in your IDE.
  4. [Optional at this point] Download the code into the A-Star.

The sketch has two main files. desk_clock.ino and stepper.cpp. The latter has an associated stepper.h.

Switch handling

desk_clock.ino of course contains the setup() and loop() functions, but it is primarily responsible for dealing with the switch, debouncing it, and timing and counting presses and releases to interpret "user input" done via the switch. The switch interpretation is a bit arcane.

The clock can be in two major states: running and stopped. If the switch is pressed while stopped, the clock starts immediately.

If the switch is pressed while running, the clock stops immediately. If that press lasts less than the "delay time" (set at 2000 milliseconds), then the clock just stops. If that press lasts longer than the "delay time", the clock also goes into "set mode" sub-state. Two press/release cycles must happen to leave set mode. Note that the clock is stopped when entering set mode and remains stopped after leaving set mode.

The duration of both presses in the two press/release cycles during set mode are important. If a press lasts than the "boundary time" (set at 1000 milliseconds), it is considered a "dot". If the press lasts longer, it is considered a "dash". The four dot-dash combinations allow one to set the speed and direction of the clock movement via stepper motor, or turn off the stepper motor. The interpretations:

  1. dot/dot -- normal speed (the second hand rotates at 1 RPM) and clockwise
  2. dot/dash -- 24 X normal speed and clockwise
  3. dash/dot -- 24 X normal speed and counterclockwise
  4. dash/dash -- disable the driver, thus turn off the stepper motor

Combination 1 obviously allows the clock to keep time. Combination 2 enables setting the clock forward, for example, to move to daylight savings time from standard time. Combination 3 enables setting the clock backward, for example, to move to standard time to daylight savings time. Combination 4 allows manual setting either forward or backward; the same thing could be accomplish by unplugging the clock.

NOTE: When my clock runs in set speed (24X) in either forward or reverse, there is a bit of gear noise when the second hand is at a particular location. This is normal due to the higher speed and gears "wearing in". You should not hear any noise at all, from the motor or the gears, at normal speed. If you do, something is seriously wrong.

You could certainly implement a different interpretation of switch presses/releases. In fact, I'm certain better schemes exist. Further, you can choose a different I/O pin to read the switch; of course, the circuit would need to change to reflect a different pin.

Stepper motor control

The stepper.* files control the SilentStepStick, which drives the stepper motor. It is fortunate that the SilentStepStick default configuration is exactly what is needed. Thus, there are only three control signals needed.

  • Enable: enables or disables the driver; there is no power applied to the motor when disabled
  • Direction: determines the direction of rotation; for the clock, this means clockwise or counterclockwise
  • Step: tells the motor to step (you can read about the resulting micro-stepping in the SilentStepStick documentation)

The only interesting aspect of control is the generation of the step signal. The frequency of the signal has to be very precise, at least over reasonable periods of time, to ensure the clock's accuracy. There are likely many ways to do this correctly. I chose to generate the step signal using the ATmega32U4 Timer 3, which can output a "PWM" signal to digital pin 5. Consult the ATmega32U4 documentation, section 14.8.3, for details.

While pin 5 for the step signal is mandated by the use of Timer 3, the other two control signals could be on any other pin capable of digital I/O. You can use alternatives if desired.

Test the electronics

You can now do what is often called "integration testing". One possibility is to finish the installation of the electronics, apply power, and ... go. This often leads to disaster. I recommend a more conservative approach, i.e., testing one thing at a time, and then combinations, until everything is integrated into the whole.

For example, I'd recommend deriving "test" sketches from the original sketch:

  • One could test only the switch and state management. Debug statements in the original sketch allow you to see what is happening. You would need only to plug in the switch assembly to the circuit board and attach your computer via USB to the A-Star.
  • One could test only the ability to generate the appropriate step signal frequencies. You'd need an oscilloscope to verify the frequencies. You would need only to attach your computer via USB to the A-Star.

Obviously at some point you need to test the entire system. This reasonably easy to do before final assembly. You will have wires dangling, so it might help to have support for the circuit board and switch. To test

  1. Download the desk_clock sketch to the A-Star.
  2. Unplug the USB.
  3. Plug in the power assembly to the circuit board.
  4. Plug in the switch assembly to the circuit board.
  5. Plug in the stepper motor to the circuit board. IMPORTANT: The black wire should be the closest to the USB connector on the A-Star.
  6. Plug in the power adapter to the power assembly.

As you apply power, you may or may not hear or see anything happening to the clock movement. However, less than one second after applying power, you should hear nothing, and the hands should not be moving. To test everything

  1. Press and release the button. The hands should run at normal speed in a clockwise direction.
  2. Press and quickly release the button. The hands should stop when you press the button.
  3. Press and release the button to start the hands again.
  4. Press and hold the button for at least two seconds (if you did not change the "delay time"). The hands should stop immediately on the press, and the long press puts the clock into "set mode".
  5. Press and quickly release the button.
  6. Press and hold the button for at least one second (if you did not change the "boundary time").
  7. Press and release the button. The hands should run at 24X normal speed in a clockwise direction.
  8. Press and hold the button for at least two seconds. This stops the clock and puts it into "set mode".
  9. Press and hold the button for at least one second.
  10. Press and release the button.
  11. Press and release the button. The hands should run at 24X normal speed in a counterclockwise direction.
  12. Press and hold the button for at least two seconds. This stops the clock and puts it into "set mode".
  13. Press and release the button.
  14. Press and release the button.
  15. Press and release the button. The hands should run at normal speed in a clockwise direction.
  16. Press and hold the button for at least two seconds. This stops the clock and puts it into "set mode".
  17. Press and hold the button for at least one second.
  18. Press and hold the button for at least one second. You should be able to move the second hand freely, as there should be no power to the motor.
  19. Press and release the button. The hands should run at normal speed in a clockwise direction.

You may, if you are like me, have a bit of trouble with the hold times for the button. If at first you don't succeed, try, try again. If, however, you find that you cannot get the correct behavior, there may be something wrong with the switch, or it may be you downloaded the wrong code.

Step 9: Finish the Clock

Picture of Finish the Clock

Now that you've proven everything works, it is time for the final assembly steps. You will need to install the power pig tail, install the switch, mount the circuit board, plug in all the connections and install the circuit board assembly.

Install the power pig tail

To install the power pig tail:

  1. Remove the clock from the stand.
  2. Insert the header pin end of the pig tail thru the 1" tube in the stand, starting at the bottom.
  3. Insert the header pin end of the pig tail into the 1/2" hole inside the clamping hub on the bottom of the frame and carefully route it under the coupling to the right side (when looking at the front) of the clock.
  4. Seat the frame on the tube on the stand. Align the frame square with the frame and tighten the clamping screw.
  5. Slip the cable clamp onto the wire and position it so that the screw holes are toward the right of the frame and one side of the clamp is about 3/8" from the large heat shrink tubing on the pig tail.
  6. Position the clamp so that the wires do not touch the coupling or any shaft. WARNING: This can be difficult, but can be achieved with positioning of the clamp with respect to the pig tail and with respect to the frame.
  7. Insert a socket screw thru a hole on the bottom of the frame and thru the cable clamp screw holes and into a 6-32 nut. Tighten the screw, ensuring the cable does not touch the coupling or an shaft.

The first picture shows the end result.

Install the switch

To install the switch:

  1. Remove the nut and lock ring from the switch.
  2. Insert the switch and its attached wires into the middle 1/2" hole on the back left of the frame.
  3. Slip the lock ring onto the wires.
  4. Slip the nut onto the wires.
  5. Work the ring and nut onto the threads of the switch body.
  6. Screw the nut onto the switch. WARNING: It may be difficult to get the nut started and tighten it once started unless you have especially agile fingers. Sometimes, long tweezers can help.

Mount the circuit board

To mount the circuit board:

  1. Insert a 1/2" 4-40 screw into the bottom left hole of the dual channel bracket. See the second picture.
  2. Insert a 1/2" 4-40 screw into the second hole as shown in the second picture.
  3. Holding the two screws in place, flip the bracket over so the screws are pointing at you.
  4. Place a 1/8" 4-40 nylon spacer on each screw.
  5. Position the circuit board so that the screws go thru the upper left and lower right mounting holes in the board. The USB connector should be located about 3/4" from one end of the bracket. See the third picture.
  6. Place a 4-40 nut on each screw and tighten.
  7. Make sure there are no wires touching the bracket. NOTE: The aluminum is anodized so it is not conductive; however, it is still a good idea to keep all wires off the bracket.

Install the circuit board

To install the circuit board and complete the clock:

  1. Position the circuit board assembly so the board is toward the interior of the clock and the USB connector is towards the top of the frame.
  2. Plug in the power connector.
  3. Plug in the switch connector.
  4. Plug in the motor connector. REMEMBER: The black wire should be the closest to the USB.
  5. Position the circuit board assembly so the upper left and upper right screw holes on the bracket align with holes on the top 4.5" channel bracket. See the fourth picture.
  6. Insert a 5/16" socket screw into one of the holes in the bracket. If you bought the hardware pack A, you can screw into one side a dual screw plate; otherwise you can screw into a 6-32 nut. Do not tighten.
  7. Insert a 5/16" socket screw into the other hole and into the screw plate or a second nut.
  8. Tighten both screws.
  9. Check the wires to ensure none are touching the coupling or shafts. Move them so they permanently stay away from anything rotating.

You are done! You can now power on and enjoy your clock!

Comments

DIY Hacks and How Tos (author)2015-12-22

Great looking design. I love the steampunk look.