7 Segment Clock

9,461

96

13

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

Supplies

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

/Arduino/libraries/7segment_NeoPixel-master

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

1 Person Made This Project!

Recommendations

  • Retro Tech Challenge

    Retro Tech Challenge
  • Space Contest

    Space Contest
  • Tinkercad Student Design Contest

    Tinkercad Student Design Contest

13 Comments

0
mondellinifabio
mondellinifabio

7 months ago

ciao, bel progetto che provo a replicare ..
ma lo schizzo mi fa sbagliare.
puoi gentilmente indicarmi come risolvere?


Nel file incluso da C: \ Users \ sunflower home \ Downloads \ 7_segment_clock_v2_1_5 \ 7_segment_clock_v2_1_5 \ 7_segment_clock_v2_1_5.ino: 6: 0:
C: \ Users \ sunflower home \ Documents \ Arduino \ libraries \ Seven_Segment_Pixel-master / Seven_Segment_Pixel-master: 34 71: avviso: ISO C ++ vieta la conversione di una costante di stringa in "char *" [-Wwrite-strings]
"0100000", "0010000", "0001000", "0000100", "0000010", "0000001"};
^
C: \ Users \ sunflower home \ Documents \ Arduino \ libraries \ Seven_Segment_Pixel-master / Seven_Segment_Pixel.h: 34: 71: avviso: ISO C ++ vieta la conversione di una costante di stringa in "char *" [-Wwrite-strings]
C: \ Users \ sunflower home \ Documents \ Arduino \ libraries \ Seven_Segment_Pixel-master / Seven_Segment_Pixel.h: 34: 71: avviso: ISO C ++ vieta la conversione di una costante di stringa in 'char *' [-Wwrite-strings]
C: \ Users \ sunflower home \ Documents \ Arduino \ libraries \ Seven_Segment_Pixel-master / Seven_Segment_Pixel.h: 34: 71: avviso: ISO C ++ vieta la conversione di una costante di stringa in 'char *' [-Wwrite-strings]
C: \ Users \ sunflower home \ Documents \ Arduino \ libraries \ Seven_Segment_Pixel-master / Seven_Segment_Pixel.h: 34: 71: avviso: ISO C ++ vieta la conversione di una costante di stringa in "char *" [-Wwrite-strings]
C: \ Users \ sunflower home \ Documents \ Arduino \ libraries \ Seven_Segment_Pixel-master / Seven_Segment_Pixel.h: 34: 71: avviso: ISO C ++ vieta la conversione di una costante di stringa in "char *" [-Wwrite-strings]
C: \ Users \ sunflower home \ Documents \ Arduino \ libraries \ Seven_Segment_Pixel-master / Seven_Segment_Pixel.h: 34: 71: avviso: ISO C ++ vieta la conversione di una costante di stringa in 'char *' [-Wwrite-strings]
C: \ Users \ sunflower home \ Documents \ Arduino \ libraries \ Seven_Segment_Pixel-master / Seven_Segment_Pixel.h: 34: 71: avviso: ISO C ++ vieta la conversione di una costante di stringa in 'char *' [-Wwrite-strings]
C: \ Users \ sunflower home \ Documents \ Arduino \ libraries \ Seven_Segment_Pixel-master / Seven_Segment_Pixel.h: 34: 71: avviso: ISO C ++ vieta la conversione di una costante di stringa in "char *" [-Wwrite-strings]
C: \ Users \ sunflower home \ Documents \ Arduino \ libraries \ Seven_Segment_Pixel-master / Seven_Segment_Pixel.h: 34: 71: avviso: ISO C ++ vieta la conversione di una costante di stringa in "char *" [-Wwrite-strings]
C: \ Users \ sunflower home \ Documents \ Arduino \ libraries \ Seven_Segment_Pixel-master / Seven_Segment_Pixel.h: 34: 71: avviso: ISO C ++ vieta la conversione di una costante di stringa in 'char *' [-Wwrite-strings]
C: \ Users \ sunflower home \ Documents \ Arduino \ libraries \ Seven_Segment_Pixel-master / Seven_Segment_Pixel.h: 34: 71: avviso: ISO C ++ vieta la conversione di una costante di stringa in 'char *' [-Wwrite-strings]
C: \ Users \ sunflower home \ Documents \ Arduino \ libraries \ Seven_Segment_Pixel-master / Seven_Segment_Pixel.h: 34: 71: avviso: ISO C ++ vieta la conversione di una costante di stringa in "char *" [-Wwrite-strings]
C: \ Users \ sunflower home \ Documents \ Arduino \ libraries \ Seven_Segment_Pixel-master / Seven_Segment_Pixel.h: 34: 71: avviso: ISO C ++ vieta la conversione di una costante di stringa in "char *" [-Wwrite-strings]
C: \ Users \ sunflower home \ Documents \ Arduino \ libraries \ Seven_Segment_Pixel-master / Seven_Segment_Pixel.h: 34: 71: avviso: ISO C ++ vieta la conversione di una costante di stringa in 'char *' [-Wwrite-strings]
C: \ Users \ sunflower home \ Documents \ Arduino \ libraries \ Seven_Segment_Pixel-master / Seven_Segment_Pixel.h: 34: 71: avviso: ISO C ++ vieta la conversione di una costante di stringa in 'char *' [-Wwrite-strings]
C: \ Users \ sunflower home \ Documents \ Arduino \ libraries \ Seven_Segment_Pixel-master / Seven_Segment_Pixel.h: 34: 71: avviso: ISO C ++ vieta la conversione di una costante di stringa in "char *" [-Wwrite-strings]
C: \ Users \ sunflower home \ Documents \ Arduino \ libraries \ Seven_Segment_Pixel-master / Seven_Segment_Pixel.h: 34: 71: avviso: ISO C ++ vieta la conversione di una costante di stringa in 'char *' [-Wwrite-strings]
Nel file incluso C: \ Users \ sunflower home \ Downloads \ 7_segment_clock_v2_1_5 \ 7_segment_clock_v2_1_5 \ 7_segment_clock_v2_1_5.ino: 12: 0:
C: \ Users \ sunflower home \ Documents \ Arduino \ libraries \ 7segment_NeoPixel-master / segment_display: errore 7: ridefinizione della classe "class segment_display"
class segment_display
^ ~~~~~~~~~~~~~~
Nel file incluso da C: \ Users \ sunflower home \ Downloads \ 7_segment_clock_v2_1_5 \ 7_segment_clock_v2_1_5 \ 7_segment_clock_v2_1_5.ino:
C: \ Users \ sunflower home \ Documents \ Arduino \ libraries \ 7segment_NeoPixel-master / segment_display.h: 4: 7: nota: precedente definizione di 'class segment_display'
class segment_display
^ ~~~~~~~~~~~~ ~~
exit status 1
Errore durante la compilazione per la scheda Arduino Nano.

0
Acmecorporation
Acmecorporation

Reply 7 months ago

che versione IDE stai usando?

0
Ezermester1996
Ezermester1996

7 months ago

Hello. how can i get out of sleep mode?
i don't want to go to sleep for hours

0
Ezermester1996
Ezermester1996

8 months ago

Hello. help please how can i set the hour and minute?

0
Acmecorporation
Acmecorporation

Reply 8 months ago

check these three lines inside the sketch:

// to set correct time uncomment these two lines
// setTime(15, 39, 0, 11, 11, 2020);
// RTC.set(now());

step 1:
set current time and date. for example this moment i’m writing is (9,45,0,13,1,2021)
step 2:
remove comments (//) from all three lines
step 3:
upload the sketch
step 4:
re-add comments (//) to all three lines
step 5:
upload the sketch

note: during the whole process, keep arduino connected to the pc

that’s all

0
Ezermester1996
Ezermester1996

Reply 8 months ago

Hello. how can i get out of sleep mode?
i don't want to go to sleep for hours

0
pallsure
pallsure

1 year ago

How to use SQW on RTC, the code you provided was successful but not on the SQW pin.

0
Acmecorporation
Acmecorporation

Reply 1 year ago

Dear. Accordingly with DS3231 specific when alarm is triggered SQW goes to 0V, then come back to +5V when RTC interrupt flag is cleared with the command "RTC.alarm(ALARM_1);".
You can test that using a multimeter. Take an Arduino and a DS3231. Load an example sketch from library used and add into Setup the lines that store alarm data:
RTC.setAlarm(ALM1_MATCH_HOURS, 0, 0, "wakeup hour", "wakeup minute");
RTC.alarm(ALARM_1);
RTC.alarmInterrupt(ALARM_1, true);
you'll note that multimeter reads +5V between SQW and GND till "wakeup hour" and "wakeup minute" are reached. At that time you'll read 0 volt.
Adding the command "RTC.alarm(ALARM_1);" into the Loop, SQW pin return back to +5V allowing to fire the alarm for the next day.

The procedure is widely tested and works.
I've used also on my previous project with Attiny 85
https://www.instructables.com/id/TEMPO-the-Handy-T...

For more info check at:
https://github.com/JChristensen/DS3232RTC/blob/mas...

If you like the project, i'm issuing a new version in few days with more features:
new colors
12/24h format
settings of: wakeup, shutdown, colors, time format, date and time directly form the clock

0
binods7
binods7

Question 1 year ago

Sir how to set 12 hours format instead of 24 hours please help

0
Acmecorporation
Acmecorporation

Reply 1 year ago

with a few simple changes the clock can show the time in 12h format.
these days i am very busy and don't know if i can help you. however I promise you that I will implement it soon.

0
gibul42
gibul42

Question 1 year ago

Firstly congratulations it's a really cool project !!! Do you have your sketch to send me I am not very good at code :(

0
Acmecorporation
Acmecorporation

Reply 1 year ago

Thanks!

First of all, you have to download two rar files included into step 3 : 7_segment_clock.rar, segment_display.rar.
The first rar file contain the sketch, the second one contains a .cpp file that must be copied and pasted inside library /Arduino/libraries/7segment_NeoPixel-master as explained into the step.
Don't worry about, i'm also not expert in coding. If you need more info, don't esitate to ask. I'll be happy to help.