Introduction: 7 Segment Clock

About: come visit me!

After several year of using, my analog clock if definitively dead.

Meanwhile i was looking for a 3d clock project to print with my Prusa, so i found a 7 segment clock to be driven by ws2812 leds and Arduino.

I thought that the power of that leds is to show a large range of colours then the question was, how to combine multiple colours on a digital clock?

Then the idea to customize the clock with the following features:

- 7 different minute change transitions

- 3 pre-setted colors for time slots

- ambient light intensity auto dim

- auto shutdown/start when there is no need to show time

- auto daylight saving time adjustment


The project can be executed using a 3D printer or googling for projects of 7 segment clocks. Someone made them with cardboard also.

There's also need of:

  • Arduino nano
  • photo chell
  • momentary pushbutton
  • on/off switch
  • DC plug
  • 5V transformer
  • n°30 WS2812 leds (model 30 leds/meter)
  • pcb
  • DS3231 module
  • thin cables for leds connections
  • resistors 10K, 550
  • solder
  • glue
  • jumpers
  • headers male/female

Step 1: Printing and Wiring....

The original project on Thingverse has a little bit modified.(Thanks to user random1101)

The two dots was enlarged to fit led version used for this project. One of three back cover was also modified to fit pcb. Changed also clock base.

Main work is to solder leds. For first i've proceeded soldering leds outside the 3d print digit backcover, then inserted into it.

The 7th led of the first digit starting from left will be connected to the first led of the next digit. At the end of 4th digit, connect the two dots leds, they will be numbered 28 and 29 inside the sequence.

The led sequence can be modified changing some parameters into Arduino library as follow explained.

Once connected, most of the work has be done.

Step 2: PCB Assembling

Now it's time to assemble a pcb where solder some resistors, headers, etc. The components to connect Arduino are:

Pushbutton connected between Arduino pin 3 and GND with internal pull-up resistor.

Light sensor connected as a voltage divider, between Arduino pin A7 and GND. Add also 10K resistor between A7 and +5V .........BIG MISTAKE

light sensor between +5V and A7 pin and 10K resistor between A/ pin and GND

DS3231 module connected via i2c and SQW pin to Arduino interrupt pin 2

Leds connected to pin 5 through 550Ohm resistor.

Step 3: The Sketch

There are many customization that can be done inside the sketch.

Saving daylight time library is handled by parameters TimeChangeRule, see JChristensen library on Github for more information.

Automatic shutdown inside the loop is handled by variable int gotosleep. In my case at 0:00 Arduino goes in sleep mode, then the clock turn off.

Setting ALARM on DS3231 module through variable int gotosleep, allow Arduino to wake up from sleep mode. In my case at 7:00 in the morning.

Another feature is to change clock color during the day inside function:

void printDateTime(time_t t, const char *tz)

In my settings from h 0:00 to 12:00 the time is showed in red, from 12:00 to 17:00 green and from 17:00 to 0:00 mostly blue. This is the best color balancing found till now for a good contrast with the white wall behind.

Transitions feature allow to have an animated color transition when minute change. There are 6 different that can be choosen pressing the momentary button, the 7th option is w/o transitions. The one that i like is named newrandom() that is the presetted (int mode = 1;).

I've made some changes to library for compatibility with led sequence. Inside file segment_display.cpp, at the end , switch (i) you can modify your led sequence. Once done substitute the file inside


Libraries required:

Step 4: It's Time to Say Goodbye

I like this clock, the current time is clearly visible from far and it turns off when i don't need.

How could ask for more from a clock ?

Make it Glow Contest

Participated in the
Make it Glow Contest