I bring you another clock construction tutorial. This is a clock with LCD display and very low power consumption, intended for battery operation. In addition to time, however, shows the date, day of week and temperature. Date works with leap years and clock automatically switches summer and winter time.
This multifunctional LCD clock is controlled by a microprocessor Atmel AVR ATmega16A (or old ATmega16L). The AVR assembler program for free download and printscreen of bit settings are available below. A large 7-segment 4-digit LCD display with high contrast is used as a displaying device. It can be for example RDN0001-PHN-3-000, DE 119, DE 120, DE 127 or LCD3906. LCD display is controlled static way (non-multiplexed). This requires a greater number of ports. That's why I chose the 40-pin AVR ATmega16A or 16L. AC frequency of display drive is 32Hz. Digit 4 (far left) is for saving ports connected simplistic to only 4 pins. Simplified wiring is possible, as this digit shows only the 1, 2 and 3. To achieve low power consumption, as a source of accurate time I used low-frequency 32,768 Hz crystal. Output of the crystal oscillator enters the timer/counter2 which works in an asynchronous mode. CPU is clocked from the internal RC oscillator running at 1MHz. If interruption does not take place, the CPU is in sleep mode Power Save - thus runs only crystal oscillator, not the RC oscillator. As a temperature sensor IO2, MCP9700A integrated circuit was selected. Contrary to popular LM35 has the advantage of much lower power consumption. It draws only about 5uA, which is great benefit when using battery power. This clock measures temperature in the range of -9 ... +150 °C, which is I hope enough for measuring room temperature :). The resolution is 1 °C. The clock is powered by three 1.5 V cells, for example AA, AAA or button. You can also use three cells NiCd or NiMH (1.2 V) or one cell Li-Ion or Li-Pol (3.6 V or 3.7 V). The maximum voltage is 5.5V and 2.7V minimum. Total consumption of this LCD clock, including temperature sensor, is about 20uA at 3V and 30uA at 4.5V. With traditional zinc-carbon AA-size battery (disposable) with a typical capacity of 1000mAh the expected battery life is approx 4-5 years. Capacitors C1 and C3 should be placed as close as possible to IO1. During first tests of the clock or when modifying the program, put a resistor in series with the battery (approx. 150 - 560R) for case of accidental short circuit and also in series of buttons in case of accidental switching inputs to outputs. If you use the battery with a high short-circuit current, connect series fuse or keep series resistor you connected during testing.
Timer is controlled by two buttons: Mode and "+" . The clock has four display modes, which are selected using the mode button:
• Display time only
• Alternate time and temperature display
• Alternate time and date display
• Viewing all four data: time, day of week, date and temperature.
Long press mode to begin setting. You can then set all data in the order: hours, tens of minutes, ones of minutes, seconds, day of week, date, month, year and so called automatic time. Switch the set data using mode . Settings are made by pressing "+" . Automatic time switch (Au) allows you to turn on or off the automatic switch to daylight saving time and back. "Au1" means on, "Au0" means off.
The program for free download:
source code in assembler (ASM)
compiled HEX file (2054 Bytes)
How to write the program into the AVR is described here.