Introduction: 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
Supplies
- 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
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
- Android : https://play.google.com/store/apps/details?id=com.khoazero123.iot_esptouch_demo
- iOS : https://apps.apple.com/jp/app/espressif-esptouch/id1071176700
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
64 Comments
5 months ago
In fact, it turned out to be a very good watch if you write ordinary numbers instead of cards
5 months ago
This is cool! Great project.
Question 10 months ago
É possível fazer esse projeto usando servos no lugar dos motores de passo? Como ficaria isso?
Obrigado
Answer 10 months ago
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.
Reply 10 months ago
Servo 360 funcionária?
Reply 10 months ago
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.
11 months ago
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)
Reply 11 months ago
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.
Reply 11 months ago
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
Reply 11 months ago
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");
Reply 11 months ago
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?
Reply 11 months ago
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.
Reply 11 months ago
Made the changes to dt (from 20 to 30) running now -- I'll check it in the morning :)
Reply 11 months ago
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. :)
1 year ago
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
Reply 1 year ago
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.
Reply 11 months ago
Hi,
Are you able to add like 3-5mm to the height -- my cards are getting stuck, a lot, I'm using a special deck the cards are flexible, but on reversing it's getting stuck quite a lot.. making me having to manually come in and fix it.
Reply 11 months ago
I had the same issue. I am not the creator of the project so I can't adjust the .STL files. I wound up trimming my cards so they'd fit.
Reply 11 months ago
I have uploaded two additional stl files. One is just 5mm taller version. The other is also 5mm taller and wedged shape is added on the baseplate. It might avoid jam of the card as described above. Thanks for your feedbacks, and I am sorry to be late to solve the issue.
Reply 11 months ago
Nothing to be sorry for -- it works most times the way it was.. so I'll print out the two new pieces and report back.
@hausofpayne17 -- unfortunately I do not want to cut my cards :( they are a special "Marvel" Pack that have nice faces :D