Introduction: Thumbwheel Clock - Let's Guess the Time
Hello everybody, here is my first Instructables, so I hope it will be good. Moreover, my English level is quite poor so I hope I won't do too many mistakes!
The goal of this project is to re-use some "Thumbwheels" salvaged from an old lab equipment
Thumbwheels were used on control panels. With their partially exposed wheels that could be turned by moving the exposed edge with a finger, you could choose the wanted number.
Why not use them to do a clock where you manually enter the time you guess it is, and then check it by pressing a button? :-)
Step 1: Step 1 : Understand How ThumbWheels Works
Each Wheel can select a number between 0 and 9 and is electrically equivalent to four switches. Why?
When you enter a number, let's say '5', the wheel converts it to its binary-coded-decimal number, in this case ''0101", meaning "0 * 8 + 1 * 4 + 0 * 2 + 1 * 1 ", because.we want to encode it in a binary system (base 2). Human beings like you and me can count from 0 to 9, and then miss figures so we need to add a carry to count further. So, when we think about the number "125", it means "1 * 100 + 2 * 10 + 5 * 1", it's a decimal system with 10 figures. Computers and electronic stuff usually use a binary system, with only two figures, 0 and 1. So if you want to decompose a number to it's binary representation, for example the number 9, it's like an Euclidean division, 9 = 1 * 8 + 0 * 4 + 0 * 2 + 1 * 1.
Binary coded decimal is quite the same thing but you turn each digital number to a group of for binary digits. For example, 4827 will be encoded as 0100 1000 0010 0111.
The corresponding switches to each of these digital numbers are physically opened or closed on the thumbwheel, and you can then by reading them know which number was entered. With the thumbwheels I salvaged, there was a reading circuit consisting of shift registers (https://en.wikipedia.org/wiki/Shift_register) that allow me to use fewer pins on my microcontroller (µc). With suitable datasheets and a good multimeter, it's easy to understand how to wire them. But if you don't have these registers when you salvage your thumbwheels, you can wire switches directly to your µc. Here again, a piece of paper and a multimeter in continuity mode will be helpful.
More information about binary numbers : https://www.mathsisfun.com/binary-number-system.h... and https://en.wikipedia.org/wiki/Binary-coded_decimal
Step 2: Step 2 : Choose a Microcontroller and Wire Your Board
When you have understood how you will interface your thumbwheels, you can count the number of pins you will need to interface the parts you want to use in your clock (inputs from thumbwheels, outputs for RGB LEDs, inputs for push buttons, input-output to a Real Time Clock board, and any other things you may be found useful ...).
I used a "Nucleo F303K8" board, looks like an Arduino Nano. Be careful if you use them as the Pins "D4", "A4" and "D5", "A5" are bridged together (I lost a lot of time before figure it) so I needed to remove the solder bridge.
The Real Time Clock board is a commercial one based on a MCP79410 chip, using an i2c bus, but any other will do the job. The LEDs are RGB ones with a common anode, don't forget to add suitable resistors in serie.
Then you can wire all these things, there are a lot of tutorials available online specific to the parts you have and it's a quite classic thing. I used a veroboard to solder all these together.
Step 3: Step 3 : Code Your Microcontroller
Now you have to code your microcontroller in order to do the job. Here is mine, for example, but I guess you will have to write your own :-)
Step 4: Step 4 : Build a Box and Put Everything on It !
Once your setup works, to can put it in a nice box. I used a laser cutter to do the faces and a 3d printer to do the side. (And a lot of hot glue to make it hold together ! ^^ especially the LEDs and the push buttons)
Step 5: Step 5 : Enjoy !
You can now build a similar clock by inspiring yourself of this work !
I plan to improve this one in the future by doing a stronger side box, or by adding a function to the second pushbutton (for example set the time on a long push, or also "display" date by also guessing it).