Introduction: Moiré Clock
I have some coasters at home that show a circular moiré pattern consisting of a base layer and a reveal layer that can be rotated to one another. This gave me the inspiration to create a clock using the moiré effect.
At first I researched existing moiré based clocks like those found below
- Moire Seconds Clock by Zoltan Kecskemeti B.
- Single Rotor Moiré Clock by shiura
- motion clocks by NeXtime
After some prototyping I converged toward a clock that uses four wheels to display the hours, ten-minutes, minutes and seconds using different moiré effects. The moiré patterns were designed with inkscape.
- The hours wheel is based on moiré magnification where the reveal layer stretches the shapes of the base layer along one axis.
- The ten-minutes and minute wheels are based on the circular scanimation effect which strictly speaking probably is not a moiré pattern. This is what is also used in the neXtime and moire seconds clocks
- The seconds wheel uses a spiral moiré pattern that I found during my research on this very informative website. The website explains in very detail how different types of moiré patterns can be used as indicators.
Supplies
- Arduino UNO
- Arduino Nano
- CNC shield
- 4x A4988 stepper driver
- 4x E series round Nema 14 stepper motor (bipolar, 0.9deg, 8Ncm)
- 3x TLE4905L hall sensor
- DS3231 RTC module
- WS2811 12V LED strip
- DC socket panel mount
- custom lightbox 350mm x 450mm (I had mine made here)
- custom printed acrylic panels (I had mine made here)
- 3x 4x2mm N52 magnet
- 16x M2x8mm screws, 8x M2 nuts and washers
- 3D printer (black PLA filament)
Step 1: Lightbox
To improve the visibility of the moiré pattern I decided to use backlighting and make the clock into a lightbox. I wanted to build the lightbox myself but did not manage to find a suitable frame with large enough depth to fit the electronics. Then I found out that many companies offer to build custom lightboxes. They can be ordered including back lighting and with a printed frontplate. I ordered mine from here including the printed frontface but without backlighting since I wanted to use RGB LEDs instead of plain white.
The lightbox I got is made from white translucent acrylic panels mounted to an aluminium frame. I was not super happy with the print quality of the sticker on the front plate which was a bit blurry, also they scaled down my image. So I replaced it with another sticker printed on backlight foil that I ordered from here.
The print files for the base layer can be found on my github.
Step 2: Prepare CNC Shield
I added jumpers to the CNC shield to be able to use the 4th axis. The stepper drivers of each axis were set to 1/16 microstepping which requires jumpers at M0, M1 and M2.
After adding the stepper drivers to the CNC shield I adjusted the current limit to 1A (see instructions here) in order to not damage the motors.
Finally, I soldered a wire from the positive input of screw terminal to the Vin pin of the Arduino so that everything can be powered by a 12V supply.
Step 3: Add Electronics to Frame
At first, I cut a rectangular hole in the side of the frame for the USB plug to programm the Arduino. I also drilled a hole in the backplate to mount the DC jack. Then I glued the LED strips, the Arduino and the RTC module to the back plate. Finally, I added some cable holders and extension cables for the stepper motors.
The RTC module was connected to the SDA, SCL inputs on the RTC shield.
Since there were no more spare pins left on the Arduino Uno to run the LEDs I added another Arduino Nano to run them independently.
Step 4: Picking the Right Stepper Motors
Switching between the digits of the wheels requires the following minimum rotation angles
- hour wheel: 30°
- ten-minute wheel: 1°
- minute wheel: 1.2°
- seconds wheel: 0.5° (per 5 seconds)
At first, I used geared stepper motors like the common 28BYJ-48 stepper motors which have 2048 full steps per revolution, i.e. a step angle of 0.18°. That means the accuracy is sufficient for all the wheels even without microstepping. However, the motor has several degrees of backlash. I then switched to the GM15BY stepper motors. These are available with different gear ratios and I picked the 298:1 version which has 5960 full steps per revolution. So compared to the 28BYJ it has higher accuracy and also lower power consumption. However, since it is also geared it suffers from the same backlash problem. I then looked for an ungeared stepper motor with small footprint and a small step angle and ended up with the 14RE07-1004VRN. It has a step angle of 0.9deg but reaches the required accuracy with microstepping.
Step 5: Mounting Motors to Front Plate
To mount the motos I drilled 10mm diameter holes into the front plate at the marked locations of the rotation axes. I then 3D printed some holders (stl on my github) for the motors which have a double purpose:
- They act as spacers so that the wheels sit flush on the front plate
- They allow adjustment of rotation axis w.r.t. the front plate
To fix the motor holders I added M2 tapped holes to the front plate. The motors are then mounted to the holders using M2x8mm screws and nuts.
Step 6: Reveal Layer Wheels
I tried several techniques for fabricating the reveal layer wheels including vinyl plotting, laser cutting, 3D printing and printing on transparent acrylic. Vinly plotting and laser cutting was not successfull because the structures are just too small. The 3D printed wheels worked but due to their thikcness and because they were not completely flush with the surface of the base layer there was some dependece on the viewing angle. Still the stl files for the 3D printed wheels can be found on my github. The best result was obtained with wheels made from 2mm thick transparent acrylic that were printed on the back which I ordered from this online printing service. In order to block all the light the wheels have to be printed with an additional white paint layer on the back.
A 4mm diameter hole was drilled into the wheels for the magnets that trigger the hall sensors. The orientation of the magnet has to match that of the hall sensor. I skipped the hall sensor for the seconds wheel since I do not need the clock to be accurate to the second.
Another 10mm diameter hole was drilled into the center of the wheels. In this hole I glued a 3D printed adapter to attach the wheels to the motor shafts.
To adjust the wheels relative to the base layer I loosened the screws on the motor holder a bit and shift the motor around until the optimal position is found. For the seconds wheel this was a bit tricky as it is very sensitive to misalignment.
Step 7: Mounting the Hall Sensors
Hall sensors are used to home the stepper motors after startup and also to recalibrate the position while the clock is running. At first, I tried out the KY-003 hall sensor module which uses the A3144 bipolar latching hall sensor. However, I had some troubles with this sensor as due to the latching action it can only be used for homing the motors once after startup. Also for some reason after removing the sensors from their PCBs and adding cables to them they behaved erratically, i.e. they sometimes went LOW after startup without a magnet present even though I added a 10k pullup resistor.
I then switched to the TLE4905L unipolar non-latching hall sensors which worked fine. I soldered a 10k SMD pullup resistor between the VCC and signal pins of the sensor. Then the sensors were attached to the back of the front plate using hot glue. The optimal position can be found by wiring them to the Arduino and checking the output via the serial terminal.
The steppers are connected in the following way
- hours wheel: x-motor
- ten-minute wheel: y-motor
- minute wheel: z-motor
- seconds wheel: a-motor
The hall sensors get connected to the corresponding END STOP pins on the CNC shield.
Step 8: Code
The Arduino code can be found on my github.
Before connecting the USB cable, plug in the 12V power supply so that the steppers do not get powered by USB.
When first uploading the code you have to set the RTC to the current time by uncommenting a line in Clock.cpp at RTCInit().
Also the position variables in the ClockCoordinates.h file have to be adjusted according to the position of the hall sensors. This can be done by manually moving the wheels using the KeypadControl() function and noting down the positions.
The seconds wheel does move 10x faster than supposed because having the number change more rapidly makes for a much better effect. So strictly speaking is not a "seconds wheel" but a "100 milliseconds wheel".
The Arduino Nano that is hooked up to the LED strips was programmed to do a simple rainbow cycling.
Step 9: Concluding Remarks
When I designed the clock in inkscape the moire effect did look perfectly but upon building the clock reality catches up with you quickly. The main issues were the backlash of the motors, the dependence on the viewing angle and the difficulty to align the wheels correctly (especially the seconds wheel).
While I was able to solve most of the problems the alignment of the wheels is still not perfectly but in summary I am quite happy with the project.