Arduino Simple 7 Segment Countdown Timer




In this Instructables guide I will show you how to make a simple - two digit - countdown timer by using the Arduino uno board and 7 segment displays.

We will be able to set the timer in our program sketch by changing the value of one variable. We will use two digit seven segment displays, so the maximum countdown time will be 99 seconds. When the timer will be equal with zero, we will hear an buzzer tone.

So, let's get started!


Step 1: About 7 Segment Displays

A Seven Segment Display, is a form of electronic display device for displaying decimal numerals that is an alternative to the more complex dot matrix displays. Seven segment displays are widely used in digital clocks, electronic meters, basic calculators, and other electronic devices that display numerical information.

The 7 segment display consists of seven LEDs (hence its name) arranged in a rectangular fashion as shown (see first image above). Each of the seven LEDs is called a segment because when illuminated the segment forms part of a numerical digit (decimal numbers and some letters) to be displayed. An additional 8th LED (right corner) is sometimes used within the same package thus allowing the indication of a decimal point, (DP) when two or more 7-segment displays are connected together to display numbers greater than ten.Each one of the seven LEDs in the display is given a positional segment with one of its connection pins being brought straight out of the rectangular plastic package.

These individually LED pins are labelled from 'A' through to 'G' (see second image above) representing each individual LED. The other LED pins are connected together and wired to form a common pin.The displays common pin is generally used to identify which type of 7-segment display it is. As each LED has two connecting pins, one called the “Anode” and the other called the “Cathode”, there are therefore two types of 7 segment display called "common cathode - cc" and "common anode - ca" (see third image above).In this tutorial we will use a common cathode 7 segment display.

Find here an Arduino tutorial for the 7 segment display

Step 2: What We Will Need

For this project we will need:

  • Arduino uno
  • breadboard
  • 2 digits 7 segment displays*
  • buzzer
  • some breadboard cables

(*you can use common cathode or common anode type)

You can buy them from, good prices and free shipping.

Step 3: The Circuit

The connections are pretty easy, see the image above with the breadboard circuit schematic.

(if you want you can connect one 220 Ohm resistor to each pin - except "CC" or "CA")

Step 4: The Code

Here's the code, embedded using Codebender!

  • numOfDigits = 2 We have two digits 7 segment display.
  • digitPins [numOfDigits] = {3,4} CC or CA pins of them connected to Arduino pin 3 and 4.
  • disp.setDutyCycle(50) Control brightness of the display - "50" is 50% of led brightness.
  • disp.write(number) Print a number from 0 to 99 (because we have two digits)

Try downloading the codebender plugin and clicking on the Run on Arduino button to program your Arduino with this sketch. And that's it, you've programmed your Arduino board!

If you want to change the timer just click the "Edit" button and change the value of "timer" variable. Value must be bigger of zero and lower (or equal) of 99.

(if you have common anode 7 seg display type just delete the line 24 "disp.setCommonCathode();")

Note: If you will not use the Codebender IDE for programming your Arduino board you will need to manual install the SevenSeg library in your Arduino IDE. Where to find it? Search the web, don't ask me... Or just use the easy and simple way of Codebender.

Step 5: Well Done!

That's it! You have successfully completed this guide and now you have your own simple Arduino countdown timer. If you want to restart the timer, just press the reset button.

You can find more Arduino tutorials and cool projects here.

I hope you liked this, let me know in the comments!



    • Party Challenge

      Party Challenge
    • Woodworking Contest

      Woodworking Contest
    • Fandom Contest

      Fandom Contest

    10 Discussions


    6 months ago

    I keep getting:
    expected '}' at end of input when trying to upload the sketch... Any thoughts?


    1 year ago

    excuse me, can i reset the number back to 9? for example if i countdown from 9-0 then i press reset button to change it to 9 again. how to make that happen? sorry for my poor english tho ^^


    1 year ago

    hi i have a problem can you help me out ? here is the problem .. if i set the time 120 seconds that would be 2 minutes how can i set the timer or Serial.pintln to print in minutes and seconds thank you


    2 years ago

    Just thought I'd add that due to Codebender having closed the library referred to can be found at the Arduino official site by searching for libraries and then choosing the officially recognised other libraries and "SevenSeg" is included there, as an updated version too.


    2 years ago

    Hi I'm trying to make this with 2 large 7segment display.

    It needs 10 V to work.

    Basically I need to change the voltage of the output


    2 years ago

    the library is simple enough to use on the fly and very intuitive, have wired up a joystick module to it and my arduino nano and works perfectly for my needs :D


    3 years ago

    hi. the code works. but how do i change the timer from in seconds to minutes. and how do i add a push button. thanks

    1 reply

    Reply 3 years ago

    hi! check this out: