Ceska verze

Digital LCD thermometer date clock with AVR

    Introduction:
Yet another DIY clock project. This is a clock with an LCD display and very low power consumption, intended for battery operation. In addition to time, it shows the date, day of week and temperature. The date works with leap years and the clock automatically switches to summer and winter time.
    Schematic description:
This multifunctional LCD clock is controlled by an Atmel AVR ATmega16A (or old ATmega16L) microcontroller. The program in assembly and a compiled hex file for 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. The frequency of the AC display drive is 32Hz. To save pins, digit 4 (far left) is connected in a simplified way to only 4 pins. Simplified wiring is possible, as this digit shows only numbers 1, 2 and 3. Segment 4f is unused and thus connected to the common display electrode BP. Segments 4a, 4d and 4g are all connected to one pin. To achieve low power consumption, as a source of accurate time I used a low-frequency 32 768 Hz crystal. The 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 an interrupt does not take place, the CPU is in Power Save sleep mode - thus only crystal oscillator runs, not the RC oscillator. As a temperature sensor IO2, MCP9700A integrated circuit was selected. Contrary to popular LM35, it 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 cells. You can also use three NiCd or NiMH cells (1.2 V) or one Li-Ion or Li-Pol cell (3.6 V or 3.7 V). The maximum voltage is 5.5V and minimum 2.7V. Total consumption of this LCD clock, including temperature sensor, is about 16uA at 3V and 24uA at 4.5V. Capacitors C1, C3 and C4 should be placed as close as possible to IO1. It's recommended to put a resistor (approx. 150R - 1k) or a fuse in series with the battery for case of an accidental short circuit or internal short circuit of a component.
    Control:
The timer is controlled using two buttons: Mode and "+" . The clock has four display modes, which are selected using the mode button:
• Time only
• Alternate time and temperature display (1s and 1s)
• Alternate time and date display (1s and 1s)
• Viewing all four data: time (4s), day of week (2s), date (2s) and temperature (2s).
    Setting:
Long press mode to begin setting. You can then set all data in the order: Speed correction -99 to +99 ppm, European automatic summer time (Au1 = on, Au0 = off), language for the day of the week (d:CE = Czech, d:En = English), hours, tens of minutes, ones of minutes, seconds, day of the week, date, month and year. Go through the steps of setting using mode . Values are incremented by pressing "+" .

The program for free download:
source code in assembler (ASM)
compiled HEX file (2 898 Bytes)
How to write the program into the AVR is described here.

I can send you the programmed microcontroller. For more info click here.


Schematic of the Digital LCD thermometer date clock with AVR ATmega16A (ATmega16L).


Configuration and security bits setting in PonyProg.
(Hexadecimal values are Low Fuse: E1, High Fuse: D9.)


LCD clock.


LCD clock showing the actual temperature.


The date and day of week.


Soldered AVR clock.


Clock from bottom side.


Box for clock.


Clock being built into the box.








Completed homemade LCD clock in cabinet.



Added: 6. 10. 2012
home