Simplest Arduino Clock With 7-digit segment display

From time to time, I’m also working on less “web” related project. This time, a wanted to play a bit with Arduino platform. The task was pretty simple – to build a clock. Yes – these days, we don’t have enough time measuring devices like mobiles, microwaves, computers – I wanted to build another one, and I had my computer to help me with it and to play a little bit of videogames in my free time, although I also use it for playing games sometimes as CSGO, with the help of services as csgo boost you can find online, but I have to confess that the different available skins for lol at Proskins are probably my favorite ones.

It was my first Arduino project so the task wasn’t  as easy as I expected. In the theory, we need only pass time & data from RTC to 7-Segment Display. Simple isn’t it? I found plenty of tutorials, had so many small issues like – digits wasn’t displayed correctly (mixed cables). I could only display one digit at the time in given position or – same LoL digits everywhere (multiplexing). I couldn’t find shift register in my stock, so wanted to use whatever I already had.

I already was a proud owner of the whole set, which was:

  1. Arduino UNO R3,
  2. DS1307 Real Time Clock,
  3. 7-Segment Display,
  4. bunch of resistors, cables, and plenty of free time



Let’s cook!


SevSeg setup

From file:

The first argument (boolean) tells whether the display is common cathode (0) or common anode (1).
The next four arguments (bytes) tell the library which arduino pins are connected to the digit pins of the seven segment display. Put them in order from left to right.
The next eight arguments (bytes) tell the library which arduino pins are connected to the segment pins of the seven segment display. Put them in order a to g then the dp.

That was the hardest part of my whole build. Setting up SevSeg to work with my wiring.

sevseg.Begin(0, 4, 3, 2, 1, 12, 11, 10, 9, 8, 7, 6, 5);

Mine was pretty simple. I had a version with common cathode – the first digit is 0, then – pins connecting t a cathode (digit handling) and then segments displays – in my case digital outputs in androino 6-12 (A to G) Number 5 points to dot digit.

#include "SevSeg.h"
#include <DS1307RTC.h>
#include <Time.h>
#include <Wire.h>
//Create an instance of the object.
SevSeg sevseg;
void setup() {
//I am using a common anode display, with the digit pins connected
sevseg.Begin(0, 4, 3, 2, 1, 12, 11, 10 , 9, 8, 7, 6,5);

//Set the desired brightness (0 to 100);
void loop() {
tmElements_t tm;
int time;
int dot;
if (
time = tm.Hour * 100;
time += tm.Minute;
if ((tm.Second % 2) == 0)
dot = 4;
dot = 2;
//Produce an output on the display
sevseg.NewNum(time, dot);


3 thoughts to “Simplest Arduino Clock With 7-digit segment display”

  1. sketch_jul01a:39: error: ‘class SevSeg’ has no member named ‘PrintOutput’
    sketch_jul01a:40: error: ‘class SevSeg’ has no member named ‘NewNum’

  2. Hi !
    Like you I’ve done this kind of clock, it works great. But don’t you have the problem of the leading 0 not displaying ? Its weird to have a clock telling 1 instead of 0001. If you have any idea, I’ll be glad to hear it 🙂
    Great post by the way ! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.