Casino'clock

39K31895

Intro: Casino'clock

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

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

Test

  • 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

68 Comments

My casino-clock has been running nicely for two years now. Everyone loves it! It has developed a slight lean to the left, due to the weight of the drum and cards. Its not a problem as it still runs well. However, if the sag continues I may have to rebuild the base a bit wider so the vertical posts can be made thicker for stability. Did I mention that everyone LOVES my casino'clock!

Hello! Is it possible to use standard size poker cards? Like the bicycle ones. It seems like the design would allow it, but I would like to be sure.
Thanks! I will buy a bridge sized pack, so it fits. Or I will upscale the model...
I will see. Thanks again!
In fact, it turned out to be a very good watch if you write ordinary numbers instead of cards
É possível fazer esse projeto usando servos no lugar dos motores de passo? Como ficaria isso?
Obrigado
Os servomotores para controlo de rádio não podem ser utilizados para fazer funcionar este relógio, uma vez que têm um ângulo de rotação finito.
Um servo que gira muitas vezes não pode ser utilizado porque não pode controlar com precisão a posição e só pode controlar a velocidade de rotação.
The new STLS (Taller + Triangle) works great -- ran the test for about 2 days with 0 jams, restarted it randomly here and there..

Question: triple-test works great... using the clock.ino.. hour motor staggers.. after homing.. and turns/stutters.. (triple-test does not)


If clock.ino does not work properly (even if the triple-test works good), it might fail to find and connect to WiFi. Is the SmartConfig using your smartphone successfully configured? Please check it out.
Figured it out, when I was editing it for the NODEMCU 8266ESP I mangled the MOTOR_PIN/POS variables..

I'm having drifting in my 10 mins now though .. works fine for a few loops, then starts to show 1 position earlier, then 2.. then 3.. after like 10-15 loops
I redid it a bit, looks to be working now, I'll have to run the clock for hours to see if it changes -- working great now.. I'll post a video in a bit.

Had to make the following changes for the NODEMCU v1.. (and obvious pin changes)

```
#include <Adafruit_NeoPixel.h>
#include <ESP8266WiFi.h>
#include <NTPClient.h>
#include <WiFiUdp.h>
#include "time.h"
...
bool getLocalTime(struct tm * info)
{
uint32_t start = millis();
time_t now;
while ((millis() - start) <= 5000) {
time(&now);
localtime_r(&now, info);
if (info->tm_year > (2016 - 1900)) {
return true;
}
delay(10);
}
return false;

}
...
//Serial.println(&timeinfo, "%A, %Y-%m-%d %H:%M:%S");
It starts to do this.. after about 2-3 hours.... you can see from the minute one -- it starts to not line up properly..

(It lines up 100% properly at the starts, and slowly drifts..) is there a variable ot setting for this?
Possibly slow drift is caused by not by code but hardware issue such as lost step of the stepper motor. Please try to increase the value of dt at line 62 in original code, from 20 to 30 or around, and please test it..

int dt = 30;

The acceleration of the motor becomes slower.
Made the changes to dt (from 20 to 30) running now -- I'll check it in the morning :)
Looks like changing dt to 30, has fixed the drift/missed steps.

Been running for about 14 hours with no interrupts. -- made it flashable via webpage now so i dont have to keep plugging it into the pc since i'm running nodemcu -- with ability to re-"home" it as well. :)
I'm LOVING this project!

Just an issue. When the sketch starts to by reversing to the home position, the cards jam against the base and then when it goes forward any cards sweeping forward in the base also jam and throw the calibration off. The distance from the base to the throat of the slot in the card holder is 80mm but the height of the cards is 89mm (French deck).

How can I fix this? Should I cut the vertical side of the base and extend it about 7mm so the cards are vertical and not touching the base as they swing through the lowest position? Or is there another suggestion?

I'm going to put it at my high school but the employer doesn't let me put ESP32s on the wifi. So instead, I'm using an Arduino Mega with a real time clock module and I'll use a bluetooth transceiver to update the time with my phone

This is going to be great when it's done! Thanks again for a great project!
Gord
Thanks for your feedback. I made this thing as short as possible and the problem you pointed out is avoided by the flexibility of the cards in my case -- but I am also aware of the issue that the edge of the card is stuck at the base.

It is easy for me to extend the height of the frame. How long do you need to be extended? Or I think it could be solved by adding a triangle-shaped guide, as shown in the attached picture (red part). Could you test the idea by adding such guide by cardboard or something? Then I will release either (or both) of extended frame and/or the triangle guide.
More Comments