A "Counter-and-Clockwise" Clock

by JohnThinger in Circuits > Arduino

770 Views, 0 Favorites, 0 Comments

A "Counter-and-Clockwise" Clock

A „Counter-&-Clockwise“ Clock

In conventional clocks, the hour, minute, and second hands all rotate in the same sense on the same axle. Originally, I tried to build a clock like this for demonstrating the gear transmission, but I also wanted to use gears with less teeth than in "normal" clocks. So instead of the more common two-stage transmission from hours to minutes (and from minutes to seconds), I implemented a four stage transmission. Hours, minutes, and seconds are still all moving clockwise this way, but then I came across the problem that not only the three hands but also a clock face must reside on (or behind) the same axle. Although this is not really a big deal, it looked awful in my primary approach. Thus, I made it a bit more confusing by adding the digits directly to the hands, omitting a supplementary clock face.

The result might not be of much scientific value... ...but it is fun to watch as hours, minutes and seconds move in different senses of rotation now!

Supplies

For the "Drive Chain":

  • 1x Arduino Nano
  • 1x Breadboard and 13 Jumper Wires (Male-Male, ~ 10 cm)
  • 1x 100 µF Electrolytic Capacitor
  • 1x A4988 or TMC2208 Stepper Driver
  • 1x Nema 17 Stepper Motor & 4-Pin Motor Cable
  • 1x 12V Power Supply
  • 2x Microswitch
  • 1x Barrel Jack (or similar for connecting the power supply to the breadboard)
  • 3D Printer with Some Filament (or, alternatively, a 3D printing service)
  • 4x M3x8 Screw
  • 1x M4 Square Nut
  • 1x M4 Inlay Screw
  • 1x Permanent Marker (optional)

For the LEGO-Platform (Numbers in Brackets are the LEGO Article Codes):

  • 4x Brick 1x2 (3004)
  • 4x Brick 1x3 (3622)
  • 6x Brick 1x4 (3010)
  • 10x Brick 1x6 (3009)
  • 1x Brick 12x24 (30072) [Base Plate]
  • 6x Technic Brick 1x6 with Holes (3894)
  • 2x Technic Brick 1X10 with Holes (2730)
  • 3x Half Bush (32123)
  • 7x Bush (6590)
  • 1x Cross Axle 6M (3706)
  • 1x Cross Axle 8M (3707)
  • 1x Cross Axle 10M (3737)
Please note: This is just one possible set-up of LEGO bricks. You can easily use different bricks and axle lengths.

Electronics & Programming

Lego_Clock_Steckplatine.png

The electrical design follows the basic set-up for a NEMA 17 stepper as described here. Make sure to add the 100 µF capacitor between 12V and GND, and link the ground lines of both the Arduino and the 12V power supply as shown in the diagram. In the given set-up, the Arduino itself is powered via USB.

The code is very simple and does not require any libraries. Simply start the Arduino IDE, chose the Arduino (Nano) board in the Tools menu, load the code, and compile&upload it to the Arduino.

The first lines of the code contain some basic configuration:

#define __SAVE_ENERGY
#define NUM_STEPS_PER_TICK 1 
#define STD_DIRECTION  HIGH<br>
  • If __SAVE_ENERGY is defined, the Arduino will disable the motor driver after each tick. This is generally a good idea, but can cause conflicts if the motor is not resting in a full step position after moving to the text "tick". So, try to delete or comment this line if this does not work properly for you.
  • With the attached circuit diagram, the microstepping modes are not configured, i.e. the MS1, MS2, and MS3 input pins of the A4988 are not connected to anything, meaning the driver operates in full steps. If you want to go for microstepping or if you switch to another type of driver (i.e. a TMC2208), the macro NUM_STEPS_PER_TICK must define the number of microsteps needed for a full step (i.e. to a tick/second of the clock). E.g. if you replace the A4988 with a TMC2208 and leave the MS* pins unconnected, the TMC2208 will be automatically operate in 1/8 microstepping mode, i.e. the line must be changed to:
#define NUM_STEPS_PER TICK 8
  • If your clock is running in the opposite (= wrong) direction, you can A) flip the motor cable at the driver or B) modify the source code by changing STD_DIRECTION HIGH to LOW

After the configuration, the setup() method sets the modes on the relevant pins. The two microswitches use the internal pull-up resistor, so they do not require an external resistor on the board.

The loop() method firstly checks whether one of the microswittches is pressed. If so, it accelerates the motor in the according direction. The acceleration should "feel" linear, but if we only reduce the "time per step" each time the buttons are checked, this would result in an exponential acceleration. The following line compensates for that:

stepSize -= (1+40.0*pow(0.99, accelLoops));

If you are not satisfied with the acceleration curve, try to adjust the 40.0 and 0.99 factors.

If no button is pressed, the loop() method will execute one "tick" (full step) each second.

Downloads

Build the LEGO Platform

Manual.jpg

Building the LEGO is pretty straightforward. Other parts (i.e. other bricks, longer axles, ...) can be used as long as the gears can be assembled with the correct distances as described in the next steps.

Gear Design

02_Top_View_01_x.jpg
Gear_Transmissions.JPG
If you are not interested in the mathematical background, you may skip this step.

The holes in the LEGO Technic bricks have a distance of 8 mm. Hence, the distance between the gears must be a multiple of 8 mm. The module of the gears defines the size of their teeth. Between two meshing gears, the nominal module must be identical. It’s hard to print gears with a module smaller than 1 mm on most FDM/FFF printers, so I have chosen modules higher than 1.2 mm for all gears. The distance between all meshing gears is set to 32 mm, so they can be placed on three axles (at 0 mm, 32 mm and 64 mm, with three empty holes between each axle).

We will use a NEMA 17 stepper motor as a driver for the clock. These motors typically have 200 full steps per revolution. Each step of the motor is expected to move second hand by one step, and this hand should – obviously – make a full rotation in 60 steps. Hence, the first set of gears transforms the angle of a step of the motor (which is 360° / 200 steps = 1.8°) to the angle needed by the seconds (which is 360° / 60 steps = 6° per step). Consequently, the ratio is 60:200 which is equal to 9 teeth : 30 teeth. The distances between the axles of two gears is determined by the following formula:

distance = (teeth_of_gear_1 + teeth_of_gear_2) * module / 2

We know the distance which must be 32 mm, so the formula must be rearranged to:

module = 2 * distance / (teeth_of_gear_1 + teeth_of_gear_2)

Hence, we find that the module must be 1,64. Theoretically, both gears must have precisely the identical module, but as FDM/FFF printers are not very precise in this range, we lower the module of the bigger gear to 1,62. Hence, we get some backlash here. This should reduce the risk of a blocking gear chain which can result from gears coming out too big from the printer, as its resolution in X/Y direction is typically limited to 0.4 mm.

In the next stage, one full rotation of the second hand (= 60 steps) must result in only one step of the minute hand, so the total ratio of this stage is 60:1 (downscale). Doing this in one go would result in very big gears, so we split it up in four parts: 10:25 ➔ 10:30 ➔ 10:25 ➔ 10:32 (= 2.5 * 3.0 * 2.5 * 3.2 = 60).

Subsequently, we do the same again for the translation from minutes to hours, but here we split the downscale in only two parts (10:30 and 10:40), resulting in a total scale of 12:1 since a total rotation of the minute hand only rotates the hour hand by 1/12th. The overall set-up is listed in the attached table where the colors indicate the sense of rotation of each gear.

With these transmissions, seconds, minutes and hours have the same sense of rotation. If you attach a pointer to the corresponding gears, you will have a “proper” clock. However, as the digits for minutes and hours are attached to the gears, they will move instead of a pointer. Hence, the numbers on top indicate the correct time, which requires the numbers for minutes and hours to be arranged counterclockwise.

As another detail, I made the gears "curved". This way, the gears are "self-centering" and cannot move along the axle. This is typically achieve by using herringbone gears, but the curved design with no sharp apex point is easier to print on some FDM/FFF printers and has (approximately) the same effect.

Gear Printing

Lego_Clock_Gears_Eevee.jpg
P9090295k.jpg

Print all the attached files once. Make sure that the layer height is around 0.15 mm. Smaller layer heights are better as they result in more smoothly curved teeth. Depending on the filament, the digits of the minutes disc and the hours gear might need some more contrast. Hence, I simply used bright filaments here and colored the digits using a black permanent marker.

Assembly & Operations

Step_01.jpg
Step_02.jpg
Step_03.jpg
Step_04.jpg
Orientation.jpg
  1. Use the four M3x8 screws to fix the motor to the bracket. Inset the M4 square nut in the slot of Gear 1, then insert the inlay screw tighten it to the motor shaft. Finally, insert a LEGO bush in the hole on the other side of Gear 1. It will just idle here for a moment. It is not yet connected to anything.
  2. Place the motor with the bracket on the LEGO platform. Push Gear 2 and a bush on the long axle and add it to the set-up. Make sure the orientation of Gear 2 is correct to match the orientation of Gear 1 as shown in the pictures. Add a bush, a half-bush and Gear 3 on the inside of the housing, then add Gear 4 and another bush with the middle-sized axle. This axle must fix the bush inside Gear 1 now. Next, add Gear 5, a bush and two half-bushes with the short axle. Again, make sure the orientation of Gear 3 and Gear 5 matches that of Gear 4.
  3. Go on with Gear 6, Gear 7 and Gear 8 and a half-bush as shown in the pictures.
  4. Finally, add Gear 9, then Gear 10, then the minutes disc, then the seconds pointer and a terminating bush to each axle.

The minutes disc should be a press-fit to the shaft of Gear 8. If it is loose, use some glue to fix it, but make sure Gear 10 can still spin freely.

Possible Improvements

This clock is very simple and can be improved in many ways. Here are three options:

  1. Run the Arduino and the motor from the same power supply: The proposed circuit powers the Arduino from the USB port and the motor from an external 12V power supply. If you want to get rid of the USB power, you need a voltage regulator, e.g. a LM7805 or LM2940 as shown here or a buck converter as shown here.
  2. Add a Real Time Clock: The Arduino may trigger the clock with sufficient precision, but it is not aware of the local time. Hence, after each power-on, the correct time must be set manually using the micro switches and doing a "fast forward" or a "fast rewind" motion. As an improvement, a real time clock (e.g. DS1302, DS1307, or DS3231) could be added.
  3. Use a silent stepper driver: Driving a clock using a NEMA 17 stepper motor is generally a weird idea, as these steppers (and their driver chips) are not energy efficient and loud. Some of the energy can be saved by defining the __SAVE_ENERGY macro in the source code. This will disable the power lines after each tick, so at least the motor is silent and does no draw current during stand-still. Depending on the motor, however, this can be problematic if the motor is not precisely positioned on a full step before disabling it. So, if you are not going for the __SAVE_ENERGY macro, it might be best to replace the A4988 driver with a "silent step stick" such as the TMC2208. This way, it will make no noise when it rests. Without further configuration, the TMC2208 will apply microstepping with 8 micro steps per full step. So make sure that the code will contain the following line for making a full seconds tick:
#define NUM_STEPS_PER_TICK 8

Have fun!