Countdown with lcd 2x16

The circuit is based on a 16F873A microcontroller PIC.

More details

Data sheet

Supply voltage5 Volts

More info

The functioning of the countdown is as it follows: once we turn on the circuit, we shall see the first screen where we can adjust the hours and the minutes of the countdown.

The seconds cannot be adjusted. The maximum time of the countdown is 99 hours and 59 minutes.

By pressing S1, the cursor is placed below the hours, and a “SET” word appears on the display; by pressing S2 we can adjust the hours, if we press S1 once more, the cursor is placed below the minutes and they can be adjusted with S2; then, by clicking on S1 one more time we shall leave the first screen for visualizing the countdown.

The S3 switch serves to advance the hours, and the minutes as well, five by five.

The countdown starts to count, from the hours and minutes we have set, in the regressive counting until 00:00:00.

When we reach 00:00:00, the buzzer connected to the RA5 16F873A microcontroller’s pin will start to beep.
To stop this sound we should press S2 and the buzzer will stop beeping, we shall see “STOP” word next to the seconds.

When the counting reaches 00:00:00 it will not stop, it’ll start to count up, that is, it’ll start to count the seconds, the minutes and the hours in an ascending order and we are going to see the + sign next to the hours.

The buzzer won’t stop sounding until we press S2. That is to say, when we press S2 to stop the buzzer, this will also stop our count up and we shall know how much have we passed from 00:00:00.

If we stop the countdown before we reach 00:00:00, the counter will stop, but we won’t be able to reinitiate the counting from this point, we shall have to press S1 one again in order to enter the set up menu for minutes and hours, and start once again.

When we press S1, it will show us the data of our latest counting. The same thing will happen when we turn off the circuit.
When we turn the circuit on, the last countdown will remain memorized and visualized on a LCD display.

The program we have created for this countdown works with a microcontroller PIC, model 16F873A. This PIC reads the seconds, the minutes and the hours of the integrated circuit DS1307.

This integrated circuit DS1307 is a real time clock which counts the seconds, the minutes and the hours in an ascending order, not the descending one, and that is why the program we’ve made inverts the DS1307’s count. The precision in the maximum time we can program (99:59:00) is absolutely exact.

The 16F873A connection with the DS1307 integrated circuit is made by an I2c bus with the RC6 and RC7 ports from microcontrollers to the pins 5 and 6 of the integrated circuit DS1307.

It will be visualised on a LCD display 2x16 (as long as it is a display with the Hitachi controller HD44780 or compatible one, with the Datasheet of a Hitachi controller HD44780).

We have connected a resistor to the PIN 16 of PIC, and we have connected a transistor to resistor which will alert the buzzer and it works when we put a 5V voltage to its extreme ends (if you can’t find the 5V one, the 6V one will also do the trick). The 1K trimmer serves to lower the buzzer’s volume, if it’s too high.

The circuit is powered with 5 volts of direct current and its consumption is not higher than 50mA.

The wiring diagram.

Esquema cuenta atrás

In the first screen we adjust the hours and the minutes of the countdown.

Countdown set

The regressive meter working and counting until 00:00:00.


If we wish to stop the counting, we press S2, the countdown stops but we cannot reinitiate the counting at this point.

Countdown stop

One the count reaches 00:00:00, the buzzer starts beeping and the countdown becomes count up, until we stop it pressing S2, in that moment the buzzer will stop beeping.

Count up

In the non-volatile PIC memory the last countdown will be saved. If we stop the counting or disconnect the circuit, and then we turn it on again, the last countdown will show in the first “SET” screen.

The file is compressed, to extract it, you should enter a password:

If you do not know how to program microcontrollers click here.

If you don´t know how to make a printed circuit boards click here.