Probably you have seen many binary clocks, but it is not so usual a ternary digital clock.
This project introduce an original ternary digital clock running with Arduino, very simple to be assembled and unlike anything you've ever seen!
Ternary clocks represent the hour and minute in Ternary Numeral System what means the numbers are powers of 3 (or base 3).
As comparison, binary numbers the base is 2 and in decimal system, the base is 10.
Maybe it sounds a little complicated, but the reading and use of ternary clock is very simple.
Let's see the project and I hope you enjoy it!2. Numeral Systems
Numbers are everywhere in our lives and the decimal numeral system is what we use everyday.
In fact there are many different numeral base such as binary, octal or hexa. Specially for computing, binary is the primary reference.
It is easy to transform any number in different base with a minimum of simple calculations.
Note: If you want more information, I suggest you read the article Numbers in Different Bases of Oxford College.
The ternary numeral consists basically in numbers written with 0, 1 or 2.
Decimal: 15 = 1 * 10 + 5 * 1
Ternary: 0120 = 0 * 27 + 1 * 9 + 2 * 3 + 0 * 1
The following table shows the conversion from decimal (0 to 9) to ternary.
The strategy of the program applies two different colors representing the digits 1 and 2 of ternary numbers.
These colors are used on RGB LEDs to see the hours and minutes as shown on pictures below.3. Clock Setup
For the setup of hour and minute there are two push buttons to be used:
-Left push button: operation mode setting
- Mode 0: regular clock operation
- Mode 1: Tens of hour (upper left LED in red)
- Mode 2: Units of hour (upper right LED in red)
- Mode 3: Tens of minute (upper left LED in green)
- Mode 4: Units of minute (upper right LED in green)
- Right push button: time setting (hour/minute)
According to the selected mode, the LED displays numbers from 0 to 9 in blue.
Press the button until the correct number is displayed, and then press the Mode button to move to the next setting.
Note: The reference "zero" is printed as "3" marked crosswise.4. Clock Reading
The design proposal using 12 LED NeoPixels arranged in a circle remind us a traditional clock.
The clock is divided into four quadrants with 3 LEDs each.
The reading begins in the first quadrant by following clockwise based on LED color (green or red) and the its corresponding number (1, 3 or 9).
- 1st: Tens of hour
- 2nd: Units of hour
- 3rd: Tens of minute
- 4th: Units of minute
- LED colors:
- Green: the number is the printed.
- Red: the number is twice the printed.
In the following example, the time is:
- Hour (1st digit) = 1 x 2 (red) = 2
- Hour (2nd digit) = 0
- Minute (1st digit) = 1 x 1 (green) + 3 x 1 (green) = 1 + 3 = 4
- Minute (2nd digit) = 1 x 1 (green) + 3 x 2 (red) = 1 + 6 = 7
So, the time is: 20:47 hs