A wire for a watch


Here I am after a discreet absence, riproporvi to yet another digital clock: but now everybody knows…mine is a craze… or maybe I do not do anything else.

Come is born this clock ?… even in March girovando the web looking for some device to try and experiment I found on a particular website Futura_Elettronica led: similar in all respects to an RGB LED (quattro pin R,G,B,anode / cathode) but it was not an RGB LED. While having 4 canonical legs is actually a LED WS212. It looks like this:

The feet are always 4 but with different definitions: or DATA_IN, VCC,GND,DATA_OUT. A cleat on a side of the LED identifies the pin DATA_OUT. Power 5V. the LED format: 5mm.

Curiosity killed the cat (famous saying….) and so I made a first order 20 led to experiment and test the. I said I was led WS2812: or use a specific protocol serial run by libraries ADAFRUIT_NEOPIXEL. It is not easy to describe this protocol: practically a sequence of 24 bit (8 for each color) sent serially LED lights with the color defined for the LED R, for the G and B for the LED as per this (source ws2812.pdf).

Of course there are deadlines to be met, but I did not worry too much because all the management work is entrusted to the library. The special feature of these LEDs is given by the type of connection: each LED is connected in cascade with the previous one, thus forming a virtually no specific limits chain: in fact to make this watch I used well 112 led.

Here then preview the final result:

have mercy: They are a veritable landslide in DIY and this time I also passed: It was not easy, and only these days I basically ran out of test.



Before you hit the ground I carried out a feasibility study (Today it is fashionable) to decide how to connect these LEDs, which RTC use, how to update the time values, how to assign the colors and brightness which can be acceptable for the visibility and especially as a food all considering the presence of well 112 led. This power and total absorption problem cost me a lot of time: I did not want to run the risk of being without adequate power supply: from web sources each of these LEDs should absorb well 20ma for each color. So for one led to the white color must be switched on three LEDs with a total of 60th absorption. But it then detects a false problem because this watch will never be turned on all 112 led. But precisely to avoid drawbacks have prepared some pcb with a series of LEDs connected serially with.

According to some tests carried out with a normal tester on 200ma flow is detected are the following measures: (The value of brightness = 25 and second functions of the library is a low value).

Chain with one LED: Led off: 07,7ma; Lit red: 08,6ma; green and blue idem; bianco 10,3ma; purple: 09,4; yellow: 09,4.

Chain with 2 led: Switched off: 15,3; Lit red 1: 16,1ma; green and blue idem; white 17,8ma; purple / yellow 16,9ma; Lit red 1+2: 16,9ma: ditto with green and blue. Bianco 20,3ma; purple / yellow 18,6.

Chain with 3 led: Switched off: 15,7; Lit red 1: 16,6; verde, blu go; Lit red 1+2: 17,4; verde, blu go; White 20,8; purple / yellow red 19,1ma.Acceso 1+2+3: 18,4; green and blue idem; white 23,6ma; purple / yellow 21st.

Chain with 4 led: Switched off: 16,2 ma; Lit red 1: 17,1; green and blue idem; White 18,8; 18th purple / yellow; Lit red 1+2: 17,9 ma; green and blue 18,0 ma; White 21,4; purple / yellow 19,6; red login 1+2+3: 18,8ma; green and blue idem; White 24,2; purple / yellow 21,5ma; Lit red 1+2+3+4: 19,8 m; green and blue idem; White 26,7; purple / yellow 23,3.

You may notice that the basic colors (rosso, verde, blu) always have the same values ​​as well as yellow and purple. The exception is given by the color white. From tests carried out with a sample of 12 led and taking advantage of a separate power supply (a battery charger 1A with power and then separated from the micro) you may encounter the following values: (values ​​measured with a common meter with full scale at 200ma).

Brightness Value (as Neopixel functions) = 25

All LEDs off: ~ 34,3 / 35ma,

12 Led lit red, verde, blu –> 41,9/42,0;

12 Led bright yellow / pink: –> 51/51,2;

12 bright white LED color: –> 49,8/49,9

tests with 16 led: off 40th. Red / Green / Blue 16 49 lit / 50ma;

With these values ​​and risking a hypothesis, the total absorption of a dial of 28 LEDs should be between 100 e i 150mA. And in theory, the set of 4 quadrants should be around 400/600 mA. But it remains a theory state of the art having carried out tests with only 16 led.

The final result after these tests and after the complete realization is that clock with a battery charger for mobile phones (5V,1A) everything works steadily: the power supply after 24 hours of continuous operation has remained “COLD“. However, I opted for a specific power supply from 5V,2In order to have a stable voltage to 5V (the charge regime batteries have a voltage drop of nearly 0.5V voltage) and also after 24 hours has remained “COLD“.

Another peculiarity to keep in mind: when the power system (regardless of the number of connected LED) all the LEDs light up the maximum of their brightness and then you can crare an absorption peak. It must therefore be provided for the total shutdown (via software) Immediate post system startup.

Let's start with the final design specifications:

  1. Quattro display (I will call dials), to display the hour and minute. Each quadrant is formed in the image and likeness of a display 7 segments: each segment is 4 led. Choice due to a compromise between cost and encumbrance.
  2. Two leds with alternate flashing on the basis of the second value
  3. RTC DS3231 considered more stable and accurate DS1307
  4. A trimmer Analog to handle up to 8 levels of brightness even editable hot
  5. A dip_switch a 8 positions to choose up to 4 colors for each quadrant editable hot (two switches for each the quadrant).
  6. Buttons for setting the time and minute initializing if necessary.
  7. Two buttons for system startup and reset.

Given these specifications, the hardware used is as follows:

  • Micro Arduinio Nano chosen for its size and already have everything you need: USB for connecting and loading software, Power over USB.
  • RTC DS3231 as a device for maintaining the values ​​of the time and date
  • PCF8574 8 bit exapander I2C. This device allows me to save for 8 pin Arduino. It is used to read the values ​​set in Dip_Swtich.

Now let's see some circuit diagrams of the project:

Typical connection of the LEDs:

This diagram shows (partially) how they are connected to the LEDs: each group of 4 forms a segment of the dial: then 7 segments are formed by 28 total led. Each of these LEDs is connected in series to the next. It will be the software appropriately select which group 4 led (and then a segment) turn on or off. At the entrance of the first LED is connected by a resistor 470 ohm. (how to recite the sacred texts). Each quadrant is the group in its own right: the release of LED NON It is connected with the input of the first LED of the next quadrant: there is a specific reason. During the tests I noticed that these LEDs are delicate and it happened one “phony“. E’ clear that all being in series is sufficient that one only has some problem to affect the entire subsequent chain. To avoid this kind of problems I decided to individually manage (the library permits) i 4 quadrants. The result is only a programmatic complication in choosing which to use dial.

connection devices:

In this scheme it shows how they have been associated with both the pcf8574 that’RTC Ds3231. In fact this is one exemplary scheme in that both the RTC that have been used for the PCF devices already preassembled: devices are easy to install and use the I2C protocolo. In the scheme it was also provided a further PCF8574 for displaying the seconds in binary mode using 7 bit. In order not to further complicate the system I preferred then use 2 led with alternate blinking. In the diagram the choices connections are also visible for the Arduino pin that connect buttons and trimmers.

PCB of each quadrant:

This is the final pcb valid for each quadrant. I had made a smaller but in practice with LED 5mm proved problematic connection as too close together. Unfortunately, as you can see in the first comprehensive picture of the project, accuracy does not shine.


By way of exemplification each quadrant has the following arrangement and logic numeration of every LED that composes. The notch of each LED identifies the pin DATA_OUT


the control panel PCB:

This panel houses: the trimmer for adjusting the brightness, i 2 buttons for updating NOW values ​​and MINUTES, the START button system, the RESET button, the bridge that depending on how it is set up allows updating more or less values ​​of TIME and MINUTES when they have to be updated, Finally, the housing of the dip_swtich for the change of colors to quadrants.


This is the pcb defined “MAIN” as it houses the micro Arduino_Nano, the various connectors for I2C devices and the control panel. E’ It has also been provided a separate entrance for feeding the quadrants (expected, but then not used). The Micro USB provides power to the rest of the circuit.


These last two are pcb support: BUS_QUADRI It allows connection of 4 quadrants towards the pcb MAIN with the input signal and feeding each. LED_SECONDS houses the two LEDs must flash at the rate of a second. This PCB is located three hours two of the dials and the two minute; the power supply and signal are connected via the BUS_QUADRI.



In the picture below you can see how the housing of the quadrants has been built:

With a frame of 28cm with wooden base and side plexiglass they were glued to the 4 quadrants as photos: the two LEDs in the center for seconds and on the right the pcb BUS_QUADRI for connections to the main. Given that the LEDs also the minimum brightness are still very bright, to avoid that the brightness of the individual LEDs can cover the right and left side, each quadrant is “covered” a black mask (plasticized) to highlight the individual segments. Each segment was wrapped with a black cardboard strip. Here's how to presena “naked”.:

With this system you get a good view “separate” the entire clock without that the brightness of a dial does not interfere with the lateral. (Remember that the Red Color,Green, Blue however, they have a different brightness from each other).


In the picture below the image of the control panel which closes a plexiglass box where is housed the micro Arduino_Nano, And RTC PCF8574 and the connectors towards the dials. The panel consists of trimmer (10K) for adjusting the brightness, by buttons for HOUR update of Minutes. the START button and the RESET, finally the bridge for updating a positive or negative values ​​of the time. On the right side the DIPSWITCHES and the array of resistors pull_up.



If I do not complicate life are not satisfied: manage a watch is not hard if you really is not a beginner. I could have made a very simple sketch of limiting myself to reading’ RTC decoding values ​​and the exposure on the dials.

But since then “appetite comes with eating” I implemented a sketch involving:

  • Management 4 dials through the library ADAFRUIT_NEOPIXEL.
  • Management of’ RTC with updating of the values ​​when needed. (if compared to the DS1307 it is more accurate, occasionally be updated if only for the summer / winter time).
  • Management of the brightness to vary over a range of 8 values ​​from a minimum to a maximum limit (even if it is not the maximum bearable) by a trimmer with analogue display.
  • Color management of individual dials: each may have a different color from the previous and the subsequent: via a DIPSWITCHES you can select one of the 4 colors defined: ROSSO, VERDE, BLU, ROSA. I chose these colors because they are the ones who “consume less power”.


As I have already indicated to avoid connection problems or multiple failures, I decided to manage 4 quadrants individually (then just 28 led to dial). I then defined 4 instances of the library ADAFRUIT_NEOPIXEL to obtain the separate management of each quadrant. This resulted definitely a complication because the sketch must be taken to individually manage the switching on and off of individual dials for the hours and the minutes.

All’ place the start of the sketch after initialization of the library must be made IMMEDIATELY shutdown of the individual quadrants: these light up with random colors and maximum brightness. To turn need to send each chain color ZERO: basically black. An alternative could be to bring the brightness to zero =.

The sketch continues with the start of the Protocol WIRE for the management of I2C devices, by reading the DIP_SWITCH to determine the colors, with the trimmer for reading the brightness, then starts reading of hourly values ​​of’ RTC and performs suffered a display of the hours and minutes in their respective 4 quadrants. It then waits the reading of one of the control panel buttons. If is pressed the hour button updates the relative value more or less depending on the position of the jumper “+/-“. It now displays the changed value. The same happens for the values ​​of minutes if the corresponding button is pressed. Pressing the button “START” triggers the final cycle of the sketch: if there have been updates these are reloaded in’ RTC. The perennial loop reads the position of the trimmer to vary the brightness and colors Dip_Swtich for effecting changes in the case. They are read then the hourly values ​​of’ RTC and only if it carries out they are varied display.


The table below deifinisce as have been assigned the Arduino pin:




Input analog trimmer for brightness


DataIn dial 1


DataIn dial 2


DataIn dial 3


DataIn dial 4


HOURS button (Pull_Up)


button MINUTES (Pull_Up)

Pin 8

START (Pull_Up)

Pin 9

Switch +/- (Pull_Up)

PIN 10

Flashing LED seconds


SDA per RTC e DS3231


SCL per RTC e DS3231



Downloads eponymous site (There are two versions of an updated and another that handles NEO_PIXEL RING and Neo_Pixel matrices) this library with a few functions can handle an almost unlimited number of LEDs WS2812. The main functions can be summarized as follows:

First you need to instantiate the object with the following parameters:

Adafruit_NeoPixel pixels = Adafruit_NeoPixel (NUMPIXELS, PIN, NEO_RGB + NEO_KHZ800);

dove: pixels is the name given to the instance, NUMPIXELS the number of connected LED (the first of the chain is identified with the offset “ZERO” and in total 28 per quadrant), PIN identifies the Arduino digital pin for connecting the first DATA_IN the LED of each chain. (See table precednte). NEO_RGB + NEO_KHZ800 It indicates that the sequence of colors of the LEDs are in the R-G-B format and frequency in 800Hkz. For some examples downloaded whichever is almost standard. E’ possible to instantiate multiple objects giving each a different name (obviously). These definitions should be inserted in the variable section.

In the section SETUP for each instance must initialize the library: nome_istanza.begin(). In the sketch, there are so 4 of these sentences.

The following functions perform the actual management of each instance (and its associated chain). The brightness is controlled with the function: nome_istanza.setBrightness(value) and it is applied to the entire chain of the LEDs.

The power of each LED chain (ricodiamoci are 28 chain) It occurs indicating both the position of the LED (its offset from scratch) that the color to be assigned. It follows that for each LED chain can be assigned a different color. The function has two formats:

instance_name.setPixelColor(Led_Offset,nome_istanza.Color(r,g,b)); with this library is devolved to the color coding according to the values ​​defined in r1, g1, b1 (give the 255), alternatively the second format defines the color code direclty (32 bit unsigned): nome_istanza.setPixelColor(Led_Offset,codice_colore).

In the sketch is performed a cycle of 28 iterations to assign and then turn on a segment of the chain of the LEDs of each quadrant.

All this would not lead to any result if it were not performed the function: nome_instanza.show(). This function should always be performed if we want to see the LEDs turn on or off or changing its brightness.

There is a reflection to be done about the use of the latter function: if it comes to turn on / off only one LED or vary the brightness after the specific function, just run the function show() to perform the programmed. but will (in the specific case) the LEDs to be turned on / off are more than one can be used two techniques: in the cycle to perform the specific function of switching on / off and at the end of the cycle to perform the function show() or during the same cycle run below show the function().

Here's an example (tract to the sketch). The routine that turns off the LEDs: NQ number of the chain from 1 a 4 as is the routine includes the Power Off to one quadrant or all (NQ = 0).

void shutdown(byte NQ)
{ int kl;
if (NQ == 0 || NQ == 1)
{ for (kL = 0; at < NUMPIXELS; pm ++) QDR_DEC_ORE.setPixelColor(at,0);
QDR_DEC_ORE.show(); }

In this case the function show() is performed at the end of the for loop.

In this example the lumimosità is only changed if it after the show function is executed():


Another library function detects the color assigned to LED: returns the color code in the format 32 bit unsigned: nome_istanza.getPixelColor(Led_Offset).



I hope I have sufficiently explained this project from March to now occupied what little free time. I usually do not devote more than 2 hours a day to this hobby: I have some experience in programming so it is difficult to have problems programming. I am thinking of a project upgrandig: also enter the display of the temperature seen that the DS3231 also houses the sensor and the random modification of the colors. We'll see….

I thank all anyway ElettroAmici for the time they have spent reading this article. I know I'm repeating…..this is the watch yet another. In any case, they are available to those wishing to documentation or other about this project.

Thank you

Gvsoft Gugno 2019


2 replies
  1. Amilcare
    Amilcare says:

    Excellent as now you have become accustomed.
    I've added to your article as they expand a little diagrams although much you can not view the low resolution of the images themselves, better than nothing will

    • gvsoft
      gvsoft says:

      Thank you, Amilcare, although with considerable delay, but I had some health problem that should be resolved Monday 15 cm.
      I wanted to comment, but obviously I can not comment on my article. So I take this opportunity in this response to provide some suggestions for those who may be interested in using these LEDs. Provide for a good power supply from 5V or 3V from almento 2A. Put a capacitor 1000 uf output of the PSU. Check one by one all the LEDs to use: I had a small pcb to try uina chain 8 led discovering that some LED's “phony” and those who follow him “crazy”. If you do not have a chance to make good professional PCB test tracks especially one that connects with DIN DOUT. At the end of the chain (or early) insert a ceramic consensatore (code 104). Bear in mind that at the time of powering on the system, all the LEDs are switched on at the maximum brightness usually of blue color and some white: this implies a power consumption peak. So the first thing to do after the function begin() It is off the chain with the show function() or with a loop that sends to each LED color black (Rgb: 0,0,0).
      There are no limitations to the number of LEDs in the chain, ma, as you can be seen in the article, i 112 LEDs are managed by 4 different chains. This implies a complication in programming but it can simplify and better resolve some malfunction: in this case the first quadrant (dozens of hours) after some time began to give problems and I had to make a new one: there was probably a led “phony” But when he wanted !!!!.
      Thanks again Amilcare


Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply