K115 Digital clock and thermometer


In this tutorial I am going to show you how to make a digital clock with led display of 2.3 inches as well as a temperature display. The clock is one of the most usual devices at home or in the office and a DIY (Do It Yourself) construction will be useful not to mention the great pleasure you will feel since you are going to make it on your own. The clock you are going to make has big led displays and you can place it e.g. on the wall so as for you to have the indication from far away.


The heart of the circuit is an AVR microcontroller in serial communication with the digital clock DS1302 as well as the digital thermometer DS18B20. In display, the corresponding segments of the four digits are connected each other and are led through the buffer/amplifier ULN2003 from the port B of the microcontroller.

One digit lights up every time and it is controlled through Q1, Q2, Q3 and Q4 transistors from the microcontroller. The base of those transistors through zener 8.2V diode and 1.5Kohms of resistor is connected with each and every one of the four pins of port C. When the voltage of such a pin of port C is LOW (0V), the voltage developed across the contact base-transmitter and the resistor in base is equal with the difference between 12V (voltage DC) and the zener voltage 8.2V which is equal to 3.8V, therefore, this PNP transistor may be conducted. When the voltage of a pin of portC is 5V, the base of PNP cannot be biased forward because 8.2V (voltage zener) + 5V (voltage pin) + 0.5 (base-emitter voltage) = 13.7V bigger than DC power supply voltage. Thus, AVR activates one of the Q1, Q2, Q3 and Q4 consecutively and rapidly, while it appears the corresponding digit and that’s how the indication is created. In the construction we use a stabilizer of 5V, particularly 7805, for the power supply of the AVR microcontroller and the rest of the integrated circuits. The integrated circuit DS1302, which produces the time, is connected with lithium battery of 3V button type for power supply in case of interruption of power supply for the maintenance of time. Also, in the same integrated circuit a crystal of 32.768KHz is connected for the exact production of the time. DS1302 communicates serially with AVR through a bus of three lines. For measuring the temperature we use the digital sensor DS18B20, which communicates with AVR through a digital line and, specifically, through protocol 1-Wire.

circut for the back pcb

circuit for the front pcb


The construction is not difficult, which happens in two PCBs of double sided with metalized holes. In the front PCB we pay much attention in placing the buttons correctly with the appropriate orientation. We need to be very careful in placing the third display from the left upside down with the dot above. In the back PCB we need to pay extra attention in the placement of the integrated circuits of AVR microcontroller, DS1302 clock and thermometer DS18B20 according to the notch as it is shown in PCB. Also, the zener diodes must be placed in the correct orientation. The cathode is the side with the ring in the body of the diode and, finally, we do not need to jumble PNP transistor with NPN transistor as well as with DS18B20 which has the same package TO-92.    

the front pcb   

the back pcb

The project is powered by 12V from power supply type pack that can give at least 1A current. The supply voltage should not exceed 13.5V or else all display’s segments will be continuously switched on.


For the operation of the device we construct there are five buttons which function as follows: Pressing SEL button for some seconds we enter into configuration mode from which we can
1) Pressing the MODE button we can choose the function: indicating 1, display appears only the time, indicating 2, display appears only the temperature whereas indicating 3, display appears the time and the temperature alternately.
2) Pressing the IND button we choose the way the time appears: either 12h or 24h 
3) Pressing the HR button we adjust the hours  
4) Pressing the MIN button we adjust the minutes. Pressing instantly the SEL button, the clock continues its regular function.

Parts for the front PCB

R1, R2   resistors
C1  electr. capacitor  4700uF/25V
S1, S2, S3, S4, S5  pcb push buttons
DIS1, DIS2, DIS3, DIS4 Large red Led 7 segments displays
CON1  19 pin connector female

Parts for the back PCB

R1, R2,…,R7  resistors  220R  1/4W
R8, R9, R10, R11  resistors  1K5  1/4W
R12, R13, R14, R15  resistors  2K2  1/4W
R17  resistor
R18  resistor
R19 resistor  10K 1/4W
C1, C2  ceramic capacitor  100nF  or 220nF
D1, D2, D3, D4  1N4738 Zener diode 1W  8.2V
Q1, Q2, Q3, Q4  PNP transistors  BC328
Q5 NPN transistor
XTAL crystal  32.728KHz
IC1  ATmega8  AVR programmed microcontroller
IC2  integrated circuit  ULN 2003
IC3 real clock DS1302
IC4 temperature sensor  DS18B20
IC5  5V regulator  7805
CON1 19 pin connector male
BAT CR2032 Coin Batter with holder