Introduction: Casino'clock

About: I am interested in designing something curious but functional. Please take a look at my summary page,

Casino'clock - Playing card flap display / clock

One of the main difficulty to make a split flap display with 3D printer is the fabrication of flaps. Therefore I used off-the-shelf playing cards for flaps, and made a funny and crazy clock with minimum number of parts.

  • Simple design : each display unit consists of only 3 types of parts. No sensor is used to find the origin.
  • Funny motion : by arranging cards randomly, you can enjoy busy motion of flaps
  • WiFi time acquisition : current time is acquired via WiFi using ntp


  • A deck of French-suited playing card (bridge size : around 57 x 89mm)
  • Three 28BYJ-48 stepper motors with driver boards
  • ESP32 micro controller with WiFi and 12 or more IO ports. I used M5stamp C3
  • Double sided adhesive tape
  • Some tapping screws
  • zip ties

Step 1: 3D Print

3D-print of parts for a single unit.

  • Print them with supplied posture.
  • Support structure is not necessary to print.
  • Print 14 copies of hinge.stl.
  • Parts for a single unit can be printed out with common 200mm x 200mm 3D printer.
  • Remove debris and blobs around the printed parts.

If your card is a bit long and tends to jam, please try to use "axis-5mm-taller.stl". The other "axis-5mm-taller-antijam.stl" has wedge shape on the base plate that might avoid jam of the cards.

Step 2: Assemble the Rotor

The process of assembly is also illustrated in the video above.

  • Before attaching the card holder (hinge), please make sure that the card can be inserted smoothly.
  • Attach the hinge to the rotor by snap-fit manner.
  • Please note that each hinge has front and back. Please check the figure above.
  • After attaching the hinge, confirm the smoothness of rotation. Rubbing (frequent motion of hinge with some strong force) might make it smooth.

Step 3: Attach the Motor

  • Attach the motor with two tapping screws.
  • Cables should be drawn to backward.
  • Fix cables with zip ties.

Step 4: Attach the Rotor to the Motor

  • Insert the axis of the stepper motor to the hole of the rotor.
  • if they are loose, one drop of superglue from the outer hole will fix it.

Step 5: Attach Cards

  • Stick double-sided adhesive tape to the short edge of the card.
  • Slide-in the card to the channel of the card holder (hinge).
  • 1-2mm gap between the card and the the pillar is ideal.
  • You can arrange the cards either randomly (for fun) or ordered (less noise). Please note that it rotates clockwise.

Step 6: Make 3 Units Getting Together

  • Print base.stl, and attach the units to the base with tapping screws.
  • Attach motor driver to the base.
  • (optional : cover.stl can be used to hide the driver boards in the final step. If you use Dupont connectors, the cover.stl is too small to cover them. To use this cover, direct soldering of the wires are necessary. M5stack can be attached with a M2 screw.)

Step 7: Connect Microcontroller

Selection of microcontrollers

  • The clock code with WiFi time acquisition assumes ESP8266 / ESP32 type modules.
  • You can use any micro controller with 12 or more GPIO ports to control three stepper motors.
  • I used M5stamp-C3 for this clock.

Connection example of M5stamp-C3

  • Connect four pins of first (1minute) motor to G4, G5, G6, G7.
  • Connect four pins of second (10minute) motor to G0, G1, G8, G10.
  • Connect four pins of third (hour) motor to G9, G18, G19, G21.
  • Connect 5V and GND to the microcontroller. (M5stamp-C3 has three 5V and GND pairs)

Step 8: Edit Source Code and Flash


  • Two types of test codes are provided : for a single unit, or three units driven simultaneously.
  • Register the order of the cards into the source code.
  • If you use microcontrollers other than M5stamp, edit the ports assignment.
  • Flash the code using Arduino IDE.
  • Confirm the correctness of card order by using single-unit-test.ino before using clock.ino because the clock code is too slow to check all cards.

Use it as a clock

  • Copy the card order definition from the test code to clock.ino.
  • Flash clock.ino to the microcontroller with Arduino IDE.

SSID / password configuration using SmartConfig

You can set SSID and password of your WiFi station using smartphone app.This function is named SmartConfig. The apps for setting are at

Please not that your smartphone should be connected to 2.4GHz WiFi.

LED colors on M5stamp (clock.ino)

  • green : initializing the rotors (counter clockwise rotation)
  • blue : connecting WiFi previously stored in non-volatile memory
  • red : smartConfig mode. If WiFi connection fails, it enters to this mode. Please set SSID and password using smartConfig app.
  • LED is turned off : clock operation mode