BINARY_COLOR_CLOCK (and other watches)

Here I am with a new “clock”: someone will say that they are fixed (better: maniac) because now the electronic clocks I have made different each with different styles and characteristics.

I inziato, quasi 10 Years ago, to be interested in microcontroller for a purpose: design a timer for the management of a boiler for heating. Having a decade of experience in programming and some knowledge of electronics, I decided to try with PIC: buy the EasyPic 5 the MicroElektronica and start my new experience.

After a while’ the tests with the PIC16F887 (supplied to the board) project the first timer and after some time also the second project. Here begins my craze of digital watches just because a timer to make it takes a clock to mark time. I let myself get carried away and always with the PIC16 I designed what I see in this picture:

E’ a digital clock “analog”: uses a display (128×64) touch_screen precisely piloted by a PC16F887. L’ The time setting uses side buttons. The time is measured by the internal timer of PIC. Clear that if you turn off you need to reset all.

I continue with my projects and here's another version: It is a watch that uses a display 8 characters (Recovery from a printer) and a temperature sensor (LM35). The display makes scrolling from right to left values: a trimmer adjusts the speed and one brightness. Again using a PIC16. It looks like this(will). The side buttons served to set the values, a buzzer sounded every hour.

Not happy, after a while you start the design of a new watch stavoolta using a PIC16F84 with this result:

This watch uses a compact display 4 digit seven-segment. The LEDs that encircle the display representing the seconds and light up every 5 seconds. Again the timer is managed by internal registers. 4 buttons set laterally hours, minutes. This watch is currently working and is tempting to a friend of ours. That analog was given.

Cherry on the cake (sorry boast), This is another clock: it's a perpetual calendar that uses 31 led for days, 12 for months, 7 for the week, and an LCD display 16×2 to show the time. Here for timings I used an independent board for producing the values ​​of date and time. It worked in a serial fashion and was always serially programmed with the appropriate parameters for the date and time and to read the whole sequence of values. This card was produced by FuturaElettonica but do not think that today is still on the market.

Here’ final object:

I must say it was a difficult birth from the point of view of hardware and software to solve some timing problems. Unfortunately it was not accurate and time delayed by a few minutes, and it was necessary to re-program the timer.

I stopped to take care of the PIC since I got interested in Arduino. I'm not a course suffered, However, compared to pic (They will certainly be more powerful especially the last) but for a hobbyist amateur which the undersigned, the platform Arduino or rather the controller ATMEGA328, is more than valid and given the’ huge availability of software and hardware, well suited to my needs.

Also in this case, after extensive experiences, I designed built several prototypes for testing HW devices such as temperature sensors, light sensors, timer, display 7 segments and arrays 8×8 e 7×5 and the related management software. And where possible using only recycled components.

But remaining in “digital watches” and using specific devices after careful study, various tests, I refer to redesign new models of watches including the following:

Of network: Ugh that beard are always the same…. no this is different: ATMEGA328 and uses a compact display 4 figures. The hours change every 5 seconds with the values ​​of temperature and humidity. In addition to the transition from summer to solar and vice versa, uses an external switch so that once set it is sufficient to press the reset. As for the PIC time values ​​were managed by internal timers, Now use the DS1307 (O DS3231) while for the temperature and humidity values ​​use the DHT11 ( O DHT22). The only problem is the lack of precision DS1307. The power supply of this watch as those who subsequently will see, It is provided by a simple mobile phone chargers that provide 5V/1A more than adequate to the task. Of this watch is a version (l’ last known) making scrolling from right to left of the values ​​HOURS,MINUTES,DAY,MONTH,TEMPERATURE,HUMIDITY’ at a constant speed to allow time for data visualization.

They persevere even with these watches and take this’ During a calendar clock malfunction (the one with the LEDs in a circle) perhaps due to the oxidation of the conductor tracks (but I did PCB “filavo” the various pin between them, to review and redesign said clock / calendar with more modern components and improved software features. Here (see photos) the result of riprogrettazione:

Compared to the previous, perhaps more flashy, This shows the days divided into two fortnights, the months in a single file as well as the week. The display shows hours,minutes,and second addition to the values ​​of temperature and humidity. For adjusting and setting the values ​​I used a “rotary encoder” whereby alternating rotation of the cursor with the embedded Pusante, change in the plus and minus values ​​of date and time that gradually appear in’ LCD. This watch does not need to be connected to a PC (via HyperTerminal) for updating values ​​in contrast to others as the previous one. (I'm thinking of a change to overcome this handicap).

And finally we come to the last project and realization (Also purpose of this article).

This is the


That the clock calendar “COMPUTER“. The photo depicts the’ still being the subject of “moglioramenti to homes“. because for “IT” ?: because the days of viewing, months, hours, minutes and seconds is provided so “BCD!“. The hours minutes day months and the second one reads summing the binary weights of each LED on !. They are divided into groups for better viewing.


First you need to choose which led to use and how to drive them, which RTC and which controller. While in the past I used’ ATMEGA328 as a single component (not intended for the board Arduino 1), in this project I used the board “ARDUINO NANO“: this board with reduced dimensions speedy spared me the circuitry (quartz, capacitors, and pin for programming) because everything ready in the same board including the USB connector (Food and / or for connection to PC) pins to the private entrance of’ supply (max 12V).

The LEDs used are of the type “cylinder” classically used in bright chains: I cannibalized one of these chains recovering 72 LED with yellow colors,verde,blu,rosso. More than enough for the project. The LEDs are driven by the classic “MAX7219” stra_abusato now in my projects. The reason is simple: alone can control up to 8 displayA seven segments (or 8 led) or a single matrix 8×8. It manages to be just the multiplex easing, not just, programming.

Ithe criterion with which the LEDs are connected (see also the circuit diagram) part by the following assumption: for the days it takes 7 led, for months 6 led, for hours 7 led, for minutes 8 led, for seconds 9 led.

Why ?: Here intervenes with its internal logic, l’ RTC Ds3121 time clock with many options compared to Ds1307 (type alarm management etc.). The internal registers that manage time and date provide the values ​​format “BCD“: then the hours “15” I am not in pure binary ( 15 in binary would be “0000 1111“) but in the format “0001 0101” which reads precisely “15” but translated in decimal would “21“. The MAX7219 has 8 registers corresponding to 8 display pilotabili. Each registry 8 bit has a correspondence 1:1 with segments ( on ice) which drive the display according to this same configuration:

If the display we put 8 led the purpose is reached: In fact it is sufficient to load the register “display” with the hours register values (as for other) dell’RTC. That is why as far as their hours are sufficient only 7 led: the days go by 1 a 31 therefore “0000 0001” a “0011 0001”. Do not forget the day 10,20,30 or turn on an LED to indicate the zero. A simple trick solves everything: just turn on the LED “DP” seen as 7 ^ led managed by the sketch in an appropriate manner and placed logically in the PCB. This gimmick is true even for the remaining values ​​of the month, hours, minutes and seconds. I put a For the second “9^” LEDs driven by an extra pin to properly display the seconds to “00” on.


The scheme has been realized with KIKAD: the pin dell'ATMEGA328 in the diagram may not correspond to those of’ Arduino Nano but the functions are the same. In the case of’ Arduino NANO the scheme is simplified further by eliminating quartz, capacitors, and reset circuit for the programming pin.

Some photos of the construction:

In the first we can see the main board with Arduino Nano, the chip MAX7219, and connectors for LED. In the second function in the board with the’ RTC DS3231.

In these two pictures instead of the board with the inserted LEDs and the same working.


They were produced: un pcb per la main board, 3 pcb led for days and months, hours and minutes, seconds. This last 3 then they were merged into a single board. The three boards were then connected to each other with small platelets suitable for the connection of the pin “A/DP” in addition to the driving pin. PCBs were produced with PCBEXPRESS absolutely manually.

As you can see from the first picture of the project each group led by a mask was superimposed as the following:

E’ the caption that covers each of the LEDs in order to assume the correct meaning: in fact it intends binary notation: “8421 8421”. The “zero” that does not exist in binary notation, lights up when the days, i mesi, The minutes were terminating zero (10,20,30).

Also this template has been produced with PCBEXPRESS taking advantage of some features. To avoid that the brightness of each LED when lit interfere with the adjacent one off, each of them has been encapsulated in a black heat shrink tubing.

The programming of the sketch:

Me too’ RTC needs programming “only one” for the assignment of the values ​​of the time and date. There are two options: one special sketch for the management to be used every time you have the need to upgrade or enter the sketch option for that programming. In the first case it should be removed from the housing and once programmed with the’ sketch special, I reinserirlo. In the second case, expected in my sketch, I inserted the beginning (the setup to speak) the management of its programming using the USB connection and the Hyper_Terminal for I / O values. If after waiting for 5 seconds will not trigger the connection sketch passes directly on initialization of the MAX7219. Part then the loop that does nothing but read the’ RTC and send the readings to the chip. To avoid any of the LEDs flicker days / months / hours / minutes, due to the continuous refresh, I inserted a control such that the updating of these values ​​will only happen if they change between readings of the other’ RTC. Exceptions are the seconds that are always updated.


Everything obviously can be improved from the point of view “visual”. I am a landslide in DIY so I come out lopsided boxes and so on. I do not think I have done something original but, as a hobbyist, I had fun and I spent a bit of time keeping alive the brain thing I got to a certain age is required. You do not think, however, that he spent, time and money, to design everything. In late August I began to lay the foundation and only a week ago have come to an end. Spending can quantify it going on EBAY or AMAZON for Arduino NANO, MAX7219, DS3231 . The biggest spending ?: 19,90 and to 72 led.

If anyone is interested in implementing one of the watches presented the material may require me to my email address:

Thank you for’ attention and….the next.

Gvsoft November 2017


1 reply
  1. Marcello
    Marcello says:

    Nice idea of ​​the binary display and how you solved the zero value. It could be a nice gaget to give to some computer buff or student.
    I look forward to the next clock.


Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Specify Instagram App ID and Instagram App Secret in Super Socializer > Social Login section in admin panel for Instagram Login to work