Introduction: Digital Crazy Hours and Minutes - WiFi Sync Clock
Introducing a mechanical digital clock with numbers strangely arranged.
Technical highlights
- Usually, intermittent motion mechanism such as Geneva drive is necessary to decrease the number of the motors of mechanical digital clock. Contrary, this clock has a constant mesh (permanently engaged reduction gear) between tens and ones places of minute numbers. The ratio of the reduction gear is coprime (7 : 10) and 70 numbers can be shown by one motor.
- The order of the numbers are not random but optimized to minimize the time to update. Average angle of rotation of the central rotor is less than 360 degrees.
- To show the current time correctly when it is powered on, not only the WiFi connection capability but also origin finding mechanism are necessary. This clock has an one-way rotation blocking mechanism. The rotors for minutes are stopped at 00 when it moves backward, but pass through there when rotating forward.
- Herringbone gears are used to hold the rotors without central axes.
Note : This model needs large (30x30cm) 3D printer to make.
Supplies
- two 28BYJ-48 stepper motors and driver board (around 2USD each)
- one M5Stamp-C3 micro controller with WiFi (5.90 - 6 USD)
- cables for pin headers
- M2 tapping screws with various lengths
- short M3 tapping screws (used to attach the stepper motor)
- lubricant (silicone oil or grease)
Step 1: Print Parts
- Print parts with supplied posture.
- No supports needed.
- Print 8 copies of "holding-gear-8copies.stl" and "gear-fix-8copies.stl".
- Remove debris and blobs from the printed parts well.
Attachments
Step 2: Attach the Hook (origin Mechanism)
- Stick a small nut to hook as a weight.
- Attach the hook to the frame using "hook-pin.stl" and "hook-guide.stl".
- Please make sure that the hook moves smoothly.
Step 3: Assemble the Rotors
- Place the 1min and 10min rotors upside down.
- Align two 0s.
- Place the gears on the odd numbers. At No.5, use "idler-gear.stl" (gear without axis)
- Attach the frame upside down. Please take a look at the video clip above.
- Confirm the smooth rotation and one-way origin lock mechanism.
- Attach the gear-fix discs to the gears.
- The hour rotor can be assembled in the same way.
Step 4: Attach the Electronic Circuits
- Attach two stepper motors and driver boards using tapping screws. Use short M3 screws to attach the stepper motor, otherwise M2 screws are adequate.
- Connect micro controller and motor drivers using pin header cables.
Step 5: Rear Cover
- Fix the M5Stamp C3 micro controller to the rear cover using retainer. No screws needed.
- Attach the rear cover to the frame. Use 6 M2 screws with adequate length.
- Hang the clock on a wall. Since the origin mechanism relies on the gravity, it should be upright.
Step 6: Flash the Program
- Flash the code "clock.ino" to the M5Stamp C3 using Arduino IDE.
- To perform the test, turn on the flag named `DEMO_MODE` at line #4, as
#define DEMO_MODE true
- Turn off (set to false) the flag above, to acquire current time via WiFi. Set SSID and password in the source code or use SmartConfig feature of ESP32.
- If the motion is not smooth, use lubricants.
55 Comments
24 days ago
Another great clock.
Dear Shiura,
I hope you can help me out.
I built the hollow clock 4 and works well. Now I've printed this awesome clock and I'm wondering if I can use a Wemos D1 Mini Wifi 8266MOD. I'm getting some errors while compiling. Can you tell me if it is even possible to use the ESP8266.
thank you and keep up the good work.
Reply 15 days ago
What error message are you facing? Very common problem when you use ESP8266 is the absence of "getLocalTime" function of ESP8266 library. Please add getLocalTime in your source code. The function is written in the following article,
https://arduino.stackexchange.com/questions/85947/esp8266-error-getlocaltime-was-not-declared-in-this-scope
Reply 13 days ago
Hello Shiura, thanks for your reply. The first error is on line 269: Serial.println(&timeinfo, "%A, %Y-%m-%d %H:%M:%S");
This one i can delete. The second one is on line 295: WiFi.mode(WIFI_AP_STA);
exit status 1
'class WiFiClass' has no member named 'mode'
I think that the section with "SMARTCONFIG" has to remove in the code for the esp 8266, is that correct?
Reply 13 days ago
Yes, println is just for debugging and you can delete. Some library do not have formatting function of the time structure.
I do not know whether you can use SmartConfig on ESP8266. Most modules using ESP8266 do not have radio certificate in Japan so I can not use or test it.
Reply 11 days ago
I also had an ESP-32 kit. I can program it without any problem. Configuring with smart config went well. What i see in the serial monitor is that it goes into a loop.
Any idea why?
start
CoESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0xf (BROWNOUT_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5810,len:0x438
load:0x403cc710,len:0x91c
load:0x403ce710,len:0x25b0
entry 0x403cc710
start
Connecting to WiFi...
ESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0xf (BROWNOUT_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5810,len:0x438
load:0x403cc710,len:0x91c
load:0x403ce710,len:0x25b0
entry 0x403cc710
start
After reprogramming it works now. No idea how this is possible.
Question 24 days ago
I got the clock program into my IDE and verified.
When I try to upload I get a fatal error message:
Detected crystal freq 0.00MHz is quite different to normalized freq 26MHz. Unsupported crystal in use?
Crystal is 26MHz
MAC: 00:00:00:00:00:00
Uploading stub...
Running stub...
A fatal error occurred: Invalid head of packet (0x47)
Failed uploading: uploading error: exit status 2
The only options I get for MHz is 80 and 40.
If I am missing any settings? Any help would be appreciated.
Answer 15 days ago
Which micro controller do you use? On the IDE, you should select appropriate board from the menu. It is recommended to start from very simple sketch such as LED blinking if you start to use micro controller wit Arduino IDE.
Reply 14 days ago
I have the M5Stamp C3. All the settings I have tried - failed. If the crystal keeps returning 0MHz perhaps I have a bad chip?
(by the way - my casino'clock is still running perfectly!)
Reply 13 days ago
Oh, for the casino'clock, you also use M5Stamp C3? If so, it may be an defective chip. Once I would like to confirm -- not C3U but C3 are you using? I think you should press a button when you flash program to C3U.
Reply 13 days ago
For the crazy clock, I got the C3 (not the C3U)
(everyone who sees the casino'clock is very impressed)
Reply 13 days ago
The trouble on C3 I know so far is the driver issue. Did you install the latest driver for serial port?
https://docs.m5stack.com/en/core/stamp_c3
Question 15 days ago on Introduction
I am an absolute newbie in the Arduino world. I am struggling with wiring the stepper motor cables to the M5Stamp-C3 micro controller. My pin header cables slip on perfectly on the stepper cards but are way to large male or female to attach to the M5Stamp-C3 micro controller. Is there an adapter that convert the micro pins to the pin header size. I have a great smooth operating clock but I can get the wiring to work. I don't want to solder in case I wire something wrong. I've just not been around this kind of wiring. I believe the pin header cables I have are called dunlap connectors or breadboard connectors.
Answer 15 days ago
The pitch of pins on M5Stamp is as same as the one on stepper driver board, both 100mil (0.1inch, 2.54mm). Common dupont pin connector will fit. I use the following product,
https://www.amazon.com/dp/B01EV70C78
Reply 15 days ago
The pins on m5stamp are slightly smaller than wires with the dupont connectors. And the dupont connectors fit perfectly on the stepper motor drives. that's what giving me problems. I did buy essentially the same cables you linked to. So till I figure this out, I have your beautiful smooth running clock built but no electronics working.
Reply 13 days ago
Both 2.54mm,
https://docs.m5stack.com/en/core/stamp_c3
Please push in the connectors even if they are tight.
4 weeks ago
Im still trying to learn this Arduino world
But Im having a problem uploading it compiles fine but during uploading i get this error
Sketch uses 229210 bytes (17%) of program storage space. Maximum is 1310720 bytes.
Global variables use 14520 bytes (4%) of dynamic memory, leaving 313160 bytes for local variables. Maximum is 327680 bytes.
esptool.py v3.0-dev
Serial port COM6
Connecting...
WARNING: This chip doesn't appear to be a ESP32 (date codes 0x03700000:0x00000000). Probably it is unsupported by this version of esptool.
Chip is ESP32-D0WDQ6 (revision 0)
Features: WiFi, BT, Dual Core, Coding Scheme None
WARNING: Detected crystal freq 0.00MHz is quite different to normalized freq 26MHz. Unsupported crystal in use?
Crystal is 26MHz
MAC: 00:00:00:00:00:00
Uploading stub...
Running stub...
A fatal error occurred: Invalid head of packet (0x47)
Failed uploading: uploading error: exit status 2
Thanks in advance
Reply 4 weeks ago
Which micro controller do you use? Please start from very simple sketch such as LED blinking, etc.
Reply 27 days ago
I realize you really aren't tech support but I am having the same issue as George."WARNING: This chip doesn't appear to be a ESP32 (date codes 0x03700000:0x00000000). Probably it is unsupported by this version of esptool.
Chip is ESP32-D0WDQ6 (revision 0)" Do you have a URL to load into the Arduino IDE? I am trying to use a M5Stamp C3U. Thank you for the project am really looking forward to seeing it in operation.
Found the right board!!
Reply 26 days ago
Please uninstall the current Arduino IDE and re-install the newest one. Then follow the instruction provided by M5 at
https://docs.m5stack.com/en/core/stamp_c3u
Especially, the section named "Program download / notes" might be so important. Since I use not C3U but C3 and I do not need to press a button while flashing the program.
Reply 26 days ago
Thank you!! That seems to work