"What's the time, Mr Wolf?" - a remote-control Arduino clock (Patreon)
Content
Hi folks! A couple of people asked if I could demonstrate an ER puzzle that involved a clock, where the hands would move in a pattern or be triggered in some way to display a sequence of times that formed a code. So, here's a video that demonstrates one way of doing just that!
The actual mechanical setup and wiring is pretty straightforward - the key component that I'm using is a *dual-shaft* stepper motor (a BKA30D-R5, specifically) - and by fixing the hour and minute hands directly onto the two shafts you can control them independently to set any time you want.
The code is a little more complicated than in some other projects, because I've included two separate methods to pass in the desired time to the Arduino - the first is using a USB serial connection, allowing you to send a time in HH:MM format via the Arduino IDE Serial Monitor, as follows:
I've also wired an ESP-01 device to the Arduino, which enables it to run a web server and parse parameters passed in the URL of an HTTP request. That means you can also set the time from the web browser of any device on your network by going to the IP address of the Arduino and sending "h" and "m" parameters as follows:
The code explanation for both these methods is long and can be quite complicated, but it's really useful to learn different methods to pass data between devices, and to call different actions based on the value of the data received. I've tried to explain each line as best I can, but if you have any questions, please ask as always!
The wiring diagram, code download, and list of materials will be uploaded for Patreons shortly...