Introduction: LEGO Quartz Clock

There are two common types of clocks made from LEGO: incredible fully mechanical structures that require many components and are very hard to build, or standard quartz clock modules that get a lego ‘face’.

I show here a way in between: the ‘heart’ of the clock is a stepper motor that is run with an Arduino, but the mechanics to get both hands run from the common centre of rotation is fully implemented in LEGO.

This clock is easy to build and it is very accurate since the time is based on the Arduino quartz crystal that oscillations with very high precision and stability at 16MHz. Have a look at the time-lapse video here to see how it accurately keeps the time!

Integrating Arduino, stepper motors and LEGO opens the way to great robotics projects and this clock is a very suitable stepping stone! It is designed such that the ‘mechanics’ is not overtly exposed, but easily visible from the back for the curious.

Step 1: Required Materials

An Arduino Uno

A 28BYJ-45 stepper motor with ULN2003 driver

LEGO blocks, gears and axles

Step 2: ​The Hands

It is not trivial to make the long hand and the short hand turn around the same centre with a speed ratio of 12. Luckily, we had some wheels from the Lego Ninjago ‘Cole’s earth driller’ (box 70502) that comes with three(!) wheels (part number 64712) that have 48 teeth on their inside, making a 3:1 ratio with a 16-tooth gear. Together with two 8-tooth and two 16-tooth gear wheels, we can make a contraption with two rotations in a 1:12 ratio. Follow the steps in the picture!

Step 3: ​The Stepper Motor

The 28BYJ-45 stepper motor is usually sold together (online for ~1.5EUR) with a driver that is based on the ULN2003 chip. It has reduction gears built-in, resulting in a decent strength, and a maximum speed of ~20RPM. It connects directly with an Arduino and running the 4 sub-coils in forward or backward order, its movement can be precisely controlled.

I had this stepper motor but no driver. I ordered some but it will take too long, so I looked up the functionality and made one with four 2n2222 transistors. If anyone is interested I’m happy to add more details here, but there really is no point in making the driver yourself unless you don’t have it and are in a rush!

Now we need to integrate it with LEGO. There are designs around to 3D-print LEGO-compatible mounts, but for this non-critical application, I managed without: the shaft of the stepper motor exactly fits a 16-tooth LEGO gear wheel (the one with the ‘smooth’ inside, part number 6542b). To connect the stepper motor to the lego, I superglued a 2x2 smooth tile (part 3068b) to the bottom of the stepper motor. It may not be the strongest possible mount but for this clock it is sufficient!

Step 4: The Code

An Arduino sketch is attached here to run the stepper motor at exactly the right speed of 1 turn per hour. According to the data sheet, the stepper goes though 8 cycles of 4 steps for one turn. This is then reduced though 4 gear sets by a factor (32/9)*(22/11)*(26/9)*(31/10)=25792/405=63.68395. The period of the steps should thus be 3600s/(32*63.68395)=1,766536s. The code polls the Arduino microseconds() function to perform 1 step with exactly this period. It is sufficient to activate the coils for 50ms to perform one step.

Step 5: Putting It All Together

Putting it all together

Upload the code, connect the driver to the Arduino (using pins 4,5,6,7), +5V and GND. Plug the stepper to the driver and mount the stepper on the clock. The Arduino and the stepper can now be powered with a USB power supply. If the mechanism works, it is time to make a pretty LEGO clock face.

Clocks Contest

Participated in the
Clocks Contest