# Countdown Timer Circuit Diagram with 7 Segment Display

In this post we are going to construct a proper real time countdown timer circuit using 7 segment display and Arduino.

We will see:

• What is a countdown timer?
• Stopwatch vs. Countdown Timer
• Design of the proposed circuit
• Pin configuration of IC4026
• How to decrement digits on 7 segment display using IC4026
• Full Circuit Diagram
• Description
• Program Code
• How to Operate this Countdown Timer

What is a Countdown Timer?

A countdown timer is a digital or an analogue or a software timer which counts the time in backwards to show the amount of time left, a countdown timer stops counting when the counts reaches zero.

Stopwatch vs. Countdown Timer:

We are going to compare between stopwatch and countdown timer in this section.

In a nutshell main difference between the two is:

In countdown timer we set a pre-determine time to accomplish a task, but in stopwatch we measure the time how long the task took to complete.

Stopwatch:

We use a stopwatch at numerous points of our life to measure the progression of time of many events, for example: In a party game or during a sport event or during cooking to avoid food to overcook or undercook.

Stopwatch starts from zero count and increments. The count is stopped manually when the task is completed. It shows the amount of time it took to accomplish the task from start. When you reset the stopwatch, it settles at zero.

Countdown timer:

We also use countdown timer numerous points of our life knowingly or unknowingly, for example: Timer on microwave oven.

In countdown timer the amount of time is pre-determined to accomplish a task. For example we set 2:00 min to heat some food item, once the timer counts zero it stops its operation.

By now you would have got an idea about stopwatch and countdown timer and when to use these two timers.

Design of Proposed Circuit:

Now let’s dive in to the design explanation of the countdown timer.

We will be utilizing 7-segment display to show the counts in combination with IC 4026 display driver. The proposed circuit will have two digits for minute count and two more digits for seconds count.

The minute digits can be set maximum of 99 minutes and second’s digit can be set maximum of 59 seconds. When the time is set, the timer’s digits will count in reverse.

To set time two push buttons are provided, each digit can be set individually. A buzzer is provided to beep alarm when the counts reach zero.

Now let’s see the pin diagram of IC 4026 which drives the 7 segment display.

Pin configuration of IC 4026:

• Pin #1 is clock-in where you will input the clock signal.
• Pin #2 is clock inhibit, if this pin connected to high, the IC will ignore the clock pulses and will not increment the digit. It should be connected to GND to enable the count increment.
• Pin #3 is display enable, making this pin high will light-up the 7 segment display, if this pin is low you can’t see the digits, but it will internally count the digit.
• Pin #4 is not used here.
• Pin #5 is carry out, for every 10 pulses pin #5 gets high or we can say this pin as divided by 10 output. We are utilizing this pin’s output as input to another IC4026’s clock-in.
• Pin #6, #7, #9, #10, #11, #12, #13 are output for 7 segment display.
• Pin #8 is ground supply.
• Pin #15 is reset, if this pin is connected to high the IC will reset the count to zero, it should be connected to ground while counting.
• Pin # 16 is Vcc (3 to 15V maximum)

NOTE: The IC 4026 is designed to increment the digits on 7 segment display (and don’t decrement numbers)

How to decrement digits on 7 segment display using IC4026:

We know that IC 4026 will always increase the count on the 7-segment display when we apply a clock pulse to clock pin but, how can we decrement digits using IC 4026? Well this is accomplished by using a microcontroller and programming it in a smart way. Let’s explore this now.

Usually IC4026 is used in applications where the numbers need to be incremented. To increment digit from “0” to “1” we apply one pulse, to increment from “1” to “2” we apply another pulse, to increment to next digit we apply another pulse; this is same till digit “9” and the cycle continues.

To count the digit in reverse is possible only with help of a microcontroller which should be programmed as described below.

Arduino controls the rest pin and clock pin of the all four IC 4026s, to show digit “9” on 7-segment display the arduino will apply nine pulses to clock pin quickly, to show digit “8” the Arduino will apply one pulse to reset pin that will bring the count to zero and applies 8 pulses to IC quickly, to show digit “7” the Arduino will apply one pulse to reset pin and apply 7 pulses to clock pin quickly.

The pulses are applied to reset pin and clock pin so quickly that we won’t see any transition of numbers while it counts backwards from 9 to 0.

By now you would have understood how we able to count in backwards with an IC that is primarily designed for incrementing digits.

Circuit Diagram of Countdown Timer:

Above schematic shows how to connect a common cathode display to IC 4026’s output pins.

The circuit is self-explanatory; just connect the circuit as per the diagram.

Program Code: Verified and error free

```//-------<electronics-project-hub>com-------//
const int clk_ML = 2;
const int clk_MR = 3;
const int clk_SL = 4;
const int clk_SR = 5;
const int rst_ML = 6;
const int rst_MR = 7;
const int rst_SL = 8;
const int rst_SR = 9;
const int DE_ML = 10;
const int DE_MR = 11;
const int DE_SL = 12;
const int DE_SR = 13;
const int inc = A0;
const int ok = A1;
const int buzzer = A2;
int i = 0;
int j = 0;
int var = 0;
int var1 = 0;
int var2 = 0;
int var3 = 0;
int var4 = 0;
int secR = 0;
int secL = 0;
int MinL = 0;
int MinR = 0;
int X = 0;
int a = 0;
int b = 0;
int c = 0;
int d = 0;
int e = 0;
boolean Setup = true;
boolean Stop = false;
void setup()
{
pinMode(clk_ML, OUTPUT);
pinMode(clk_MR, OUTPUT);
pinMode(clk_SL, OUTPUT);
pinMode(clk_SR, OUTPUT);
pinMode(rst_ML, OUTPUT);
pinMode(rst_MR, OUTPUT);
pinMode(rst_SL, OUTPUT);
pinMode(rst_SR, OUTPUT);
pinMode(DE_ML, OUTPUT);
pinMode(DE_MR, OUTPUT);
pinMode(DE_SL, OUTPUT);
pinMode(DE_SR, OUTPUT);
pinMode(inc, INPUT_PULLUP);
pinMode(ok, INPUT_PULLUP);
pinMode(buzzer, OUTPUT);
all_rst();
digitalWrite(DE_ML, HIGH);
digitalWrite(DE_MR, HIGH);
digitalWrite(DE_SL, HIGH);
digitalWrite(DE_SR, HIGH);
delay(500);
Display_Test();
}
void loop()
{
if (Setup)
{
digitalWrite(DE_ML, LOW);
digitalWrite(DE_MR, LOW);
digitalWrite(DE_SL, LOW);
digitalWrite(DE_SR, HIGH);
{
{
X = clk_SR;
secR = secR + 1;
c_inc();
delay(250);
if (secR > 9)
{
secR = 0;
}
}
}
delay(250);
digitalWrite(DE_ML, LOW);
digitalWrite(DE_MR, LOW);
digitalWrite(DE_SL, HIGH);
digitalWrite(DE_SR, LOW);
{
{
X = clk_SL;
secL = secL + 1;
c_inc();
if (secL > 5)
{
secL = 0;
digitalWrite(rst_SL, HIGH);
digitalWrite(rst_SL, LOW);
}
delay(250);
}
}
delay(250);
digitalWrite(DE_ML, LOW);
digitalWrite(DE_MR, HIGH);
digitalWrite(DE_SL, LOW);
digitalWrite(DE_SR, LOW);
{
{
X = clk_MR;
MinR = MinR + 1;
c_inc();
delay(250);
if (MinR > 9)
{
MinR = 0;
}
}
}
delay(250);
digitalWrite(DE_ML, HIGH);
digitalWrite(DE_MR, LOW);
digitalWrite(DE_SL, LOW);
digitalWrite(DE_SR, LOW);
{
{
X = clk_ML;
MinL = MinL + 1;
c_inc();
delay(250);
if (MinL > 9)
{
MinL = 0;
}
}
}
digitalWrite(DE_MR, HIGH);
digitalWrite(DE_SL, HIGH);
digitalWrite(DE_SR, HIGH);
var1 = secR;
var2 = secL;
var3 = MinR;
var4 = MinL;
Setup = false;
}
var1 = var1 - 1;
if (var1 == -1 && var2 == 0 && Stop == false)
{
var1 = 9;
var2 = 5;
var3 = var3 - 1;
}
if (var1 == -1 && Stop == false)
{
var2 = var2 - 1;
var1 = 9;
}
if (var3 == -1)
{
var3 = 9;
var4 = var4 - 1;
}
if (var1 == 9   && var2 == 5 && var3 == 9 && var4 == -1)
{
Stop = true;
buzz();
}
while (Stop)
{
digitalWrite(DE_ML, LOW);
digitalWrite(DE_MR, LOW);
digitalWrite(DE_SL, LOW);
digitalWrite(DE_SR, LOW);
delay(300);
digitalWrite(DE_ML, HIGH);
digitalWrite(DE_MR, HIGH);
digitalWrite(DE_SL, HIGH);
digitalWrite(DE_SR, HIGH);
delay(300);
}
delay(1000);
digitalWrite(rst_SR, HIGH);
digitalWrite(rst_SR, LOW);
for (a = 0; a < var1; a++)
{
digitalWrite(clk_SR, HIGH);
digitalWrite(clk_SR, LOW);
}
digitalWrite(rst_SL, HIGH);
digitalWrite(rst_SL, LOW);
for (b = 0; b < var2; b++)
{
digitalWrite(clk_SL, HIGH);
digitalWrite(clk_SL, LOW);
}
digitalWrite(rst_MR, HIGH);
digitalWrite(rst_MR, LOW);
for (c = 0; c < var3; c++)
{
digitalWrite(clk_MR, HIGH);
digitalWrite(clk_MR, LOW);
}
digitalWrite(rst_ML, HIGH);
digitalWrite(rst_ML, LOW);
for (d = 0; d < var4; d++)
{
digitalWrite(clk_ML, HIGH);
digitalWrite(clk_ML, LOW);
}
}
void Display_Test()
{
all_rst();
var = 10;
for (j = 0; j < 10; j++)
{
var = var - 1;
for (i = 0; i < var; i++)
{
digitalWrite(clk_ML, HIGH);
digitalWrite(clk_MR, HIGH);
digitalWrite(clk_SL, HIGH);
digitalWrite(clk_SR, HIGH);
digitalWrite(clk_ML, LOW);
digitalWrite(clk_MR, LOW);
digitalWrite(clk_SL, LOW);
digitalWrite(clk_SR, LOW);
}
delay(250);
all_rst();
}
}
void all_rst()
{
digitalWrite(rst_ML, HIGH);
digitalWrite(rst_MR, HIGH);
digitalWrite(rst_SL, HIGH);
digitalWrite(rst_SR, HIGH);
digitalWrite(rst_ML, LOW);
digitalWrite(rst_MR, LOW);
digitalWrite(rst_SL, LOW);
digitalWrite(rst_SR, LOW);
}
void c_inc()
{
digitalWrite(X, HIGH);
digitalWrite(X, LOW);
}
void buzz()
{
for (e = 0; e < 10; e++)
{
digitalWrite(buzzer, HIGH);
delay(100);
digitalWrite(buzzer, LOW);
delay(100);
}
}
//-------<electronics-project-hub>com-------//
```

That concludes the circuit diagram and program code.

How to operate this circuit:

• Turn on the circuit, the Arduino will run a display test in which all the four displays will count from “9” to “0” simultaneously. You should look and verify that all the segments are connected properly, if not check and fix the connection(s).
• After the display test, right most digit (second’s unit place) will be illuminated and rest of the digits will be off. Now press S1 to increment the seconds and press S2 (OK).
• After pressing S2, the tens place of the seconds digit will illuminate and rest will stay off. Now press S1 to increment the seconds and press S2 (OK).
• Now, minute’s unit place will illuminate and press S1 to increment minutes and press S2 (OK).
• Now, minute’s tens place will illuminate. Press S1 to increment and press S2 (OK), now the timer starts.
• Once the timer counts all the digits zero, buzzer will beep and the display will flash.

Prototype: Video:

Related Project: How to Make a Countdown Timer Circuit Using LCD and Buzzer

If you have any questions regarding this project, feel free to comment, you will get a guaranteed reply from us.

### Blogthor My nick name is blogthor, I am a professional electronics engineer specialized in Embedded System. I am a experienced programmer and electronics hardware developer. I am the founder of this website, I am also a hobbyist, DIYer and a constant learner. I love to solve your technical queries via comment section.