Although many circuits for digital clocks have been published in Electronics For You, this circuit is a PIC microcontroller (MCU) based easy-to-construct gadget, which combines a clock with a temperature indicator in the same display. The display uses four 7-segment common-anode LEDs. It shows the clock, and in every minute for five seconds the display alternates to show the temperature in oC. An alarm facility with buzzer is provided.
Clock’s precision is due to the 20MHz high-frequency crystal that is used with PIC16F73 chip. Second display’s decimal point blinks every second. The display for temperature uses three digits from the left and the fourth digit just shows oC. For this, the fourth LED is soldered on the PCB upside-down. This places its decimal-point LED on top-left instead of bottom-right so as to show the symbol of degree (°). Hence, we use four separate common-anode LED units instead of a combo LED display component.
The MCU choice is now for the more convenient PIC chip from the low-cost 16F family. This is a 28-pin chip with ports a, b and c, as well as several internal peripherals like timer, ADC and UART. Most important advantage of PIC is the ease of downloading a program on to the chip, because it uses flash memory and can be programmed with 5V supply. PICkit2 programmer is used for downloading the hexadecimal code on to the chip. Cost of 16F73 is quite low.
Port pins in the PIC chip have greater power capability than those in the 8051 family. So driving LED segments can be made by directly connecting the segments to the port pins, without any buffer IC. Thus, component count is reduced.
There are several analogue-to-digital converter input channels. Speed of conversion is as short as 20 microseconds. So it is easy to connect any analogue signal and digitise the same for displaying with LEDs. Here, the analogue signal is that of temperature.
Texas Instruments chip LM35 is a low-cost temperature sensor and is connected to the analogue input pin of the PIC chip. It can measure temperatures in the range -50°C to 100°C, but in this unit it is mounted on the PCB only to show room temperature.
Fig. 1 shows the circuit diagram of the alarm clock-cum-temperature indicator. PIC16F73 IC has its reset on pin 1. A resistor and capacitor junction is tied to this pin to perform reset on applying power. The 5V power supply is obtained from a low-voltage transformer (X1), rectifier (BR1) and voltage regulator IC 7805 (IC1).
Pin 20 is Vcc and pins 19 and 8 are grounded. Pins 9 and 10 are for connecting a crystal for the oscillator. Any crystal frequency is alright, but it is better to use the highest 20MHz crystal for speed. Two capacitors, each of 15pF, are tied to the end of the crystal to ground. This frequency is called high speed, or HS. There is a configuration register inside the chip, which should be programmed for HS, among other choices, such as XT, RC and LP. The configuration byte we use is 52 hex.