Clock-calendar-thermometer ATMega8

I want to introduce another clock with the thermometer on a microcontroller. At the heart device is a series of microcontrollers from ATMEL AVR – ATMega8. The microcontroller operates with a real-time chip DS1307 digital temperature sensor DS18B20.

Chip DS1307 is a cost-effective real-time clock with a serial interface, which contains a clock-calendar with the presentation of the information in the BCD and 56 bytes of nonvolatile SRAM. Address and data are transmitted on a bi-directional two-wire serial bus. of real-time information and calendar appears in seconds, minutes, hours, day, date, month and year. If the current month has less than 31 day, the chip automatically detects the number of days in the month with the current leap-year. The clock operates or in 24-hour or 12-hour format with an AM / PM indicator (pm am). DS1307 contains embedded control circuit main power source level and when an invalid value is automatically switched to the backup battery.

DS18B20 sensor - digital thermometer with programmable resolution, from 9 12-bit, which can be stored in the EEPROM memory of the device. DS18B20 communicates over 1-Wire bus, and thus may be a single device on the line, and work in a group. All processes on the bus controlled by a central microprocessor.

Measurement range from -55 ° C to + 125 ° C and an accuracy of 0.5 ° C in the range from -10 ° C to + 85 ° C. In addition, DS18B20 It can be supplied with voltage data lines (“parasite power”), in the absence of an external voltage source.

Display is realized on the seven-segment LED-display with a common anode. Schematic diagram hours thermometer shown in Figure.

clock circuit

Clock- thermometer. schematic diagram

By briefly pressing the S1 button bits blink alternately for time and date settings. To do this, use the buttons S2 and S3 (“+” and “-” respectively). By pressing a button on the display S3 lights ambient temperature.


Clock- thermometer. time display

Thus, in the normal mode, the instrument alternately displays the time and date. And by clicking on a button indicates the temperature S3. At the beginning of each hour clock fed short beep.

The clock accuracy depends mainly on the applied quartz. I have a time error of about two seconds per month (hurry).

device “Clock-calendar-thermometer ATMega8” assembled on two printed circuit boards (Cm. a photo).

3 4 5 6 7In the future, the device will be improved, They will be added to the alarm function and timer.

Fyuz microcontroller firmware:

1Archive of the project (printed circuit boards, firmware, source):
Flash and PCBs;

Attention! There is a scientific work on this project was written 25 pages (in Ukrainian). Making perfect for graduation or course work. Download content.

Contact author


  1. Prompt AMP-ta, which are two indicators to remove smotre possible time and temperature

    • Without the two indicators, Watch the temperature and time will not work. The temperature is displayed on the last two indicators. Cm. picture.

  2. Tell me please, where you can get the source code for the firmware?
    It would like to modify the functional clock.

    • Source attached to the end of the article.
      We are waiting for the firmware with the new functionality of the device. Good luck!

  3. Hello Uwe admin. and-if possible firmware common cathode. I have collected on your project but without the big thermometer on light-emitting diodes. works fine but a second for a second date arbitrarily change, this would like to start with this firmware

  4. please. Works, but the numbers are displayed in reverse video.
    ie. there, where segments should light up – they are not on, and the light ones, that light should not.
    for example, instead “1” lights “E”, instead “8” – nothing.
    How to cure?

      • indicators 1.8″ OA.
        The segments are connected to the MC through ULN2803.
        Anode transistors BC557 (PNP).

        • No ULN2803, normally displayed?
          With ULN2803 Exchanging transistors to another structure.

          • Without ULN2803 numbers are displayed properly.
            With ULN2803 transistor 2N3904 (NPN), included emitters to the anodes of indicators, ugly picture (brightness drops once a 8-10, change numbers can not be disassembled).
            Possible to change the code to work with ULN2803 and PNP-transistors?
            And further, melteshenie display (10 seconds – time, 4 seconds – date, and so on around the circle) very tiring.
            I would like to turn it off, and recall them for display date button.
            I myself in the writing and editing of code quite strong.
            The only hope for a knowledgeable and able.

  5. A bust of temperature date is only carried out by pressing the button or automatically bust ?

    • melteshenie display (10 seconds – time, 4 seconds – date) – automatic sorting.
      Temperature – the button.
      Time-date are displayed in dynamic mode, and the temperature – static.
      AT “gland” it looks wildly:
      – brightness display in deriving temperature times 3 above, than in the derivation of the time-date.
      – temperature output oddly: not the entire line at once, type 20C, and more 1 figure in the ranks of the queue, at first 2, then 0, Since then, and the degree symbol (2->0->C->degree symbol.
      Generally, impression of the firmware joyless.

  6. I gathered in Proteus. Does not work. On the button does not respond.

  7. Hello. SW. author, Could you share source code scheme for Proteus?

  8. Hello. Tell me whether you can apply to this scheme LEDs 26mm to 45mm –
    E11801-G-UR3-8-W and which have to do with changes in the scheme. thank.

    • Your indicator E11801-G-UR3-8-W with common anode, hence it can be used in the scheme. And because he single-digit, it is necessary to make the wiring circuit board according to the datasheet at E11801-G-UR3-8-W.

      • I asked you a question about this indicator is due tems that the scheme almost works. Lights
        010110. And LED illumination is very weak. I was producing a fee according to the attached diagram. And after you have explained that even with this great indicator should work. I looked up your files .lay not all looked, and I found a discrepancy. The circuit is fed to the emitters of +5 , and on .lay file is served minus food. Where is the mistake? Write please.

  9. Hello !
    A digital thermometer can be adapted to warmer aquarium ???
    At work, usual hours are collected on IK1901 , but they can only turn on and turn off the light .

  10. I made a payment on your scheme applying indicators E11801-G-UR3-8-W. Display I have not really achieved, displayed 03 01 15. possible date. And indicators barely lit. Even in the dark, poorly. What to look for the cause?

  11. Another question on the indicator E11801-G-UR3-8-W. When I gave my indicators voltage is greater than five volts brightness increased. Thus began quite noticeable glow segments that have not shone. So it should be? If not then why this can happen.

  12. I do not understand what it was about the scheme is given to the common anode .a fee under the common cathode Referring to collect all kuchi.pechatka and firmware corresponds to a scheme,,

  13. Hello. At the top of the comments you have written that This project is not designed in Proteus. Such an elementary base in Proteus has. A scheme there is virtually no driver running. What is the cause.

  14. I do your watch. Two questions:
    – there is latest firmware for OA indicators?

    – Can I program in pony prog to flash the controller using the table in the article picture with Fyuz?


  15. My first message is awaiting review. I add to the same opinion about this article. One gets the impression that the article was written to. Scheme common anode, signet is applied to the common cathode. seal sub-rule- hours worked for five minutes. Iron all regularly. Of all the comments and did not understand who has earned this scheme. Surely no one has upgraded the firmware? The archive firmware for some hours? There are two .her file and .rom. To flash controller and EEPROM? Sorry for the time spent.

  16. The clock still go. impressions mediocre. What's in the red:
    – rather dimly lit figures;
    – to display the temperature you need to press the button №3;
    – change the date of readings- clock every 10 seconds;
    – more successful firmware no.
    For everyday use is not likely to leave- no ice!

    • how to run?I shine 01.01.10 and do not want idti.podtyagivayuschie resistors replaced 4.7k result is the same .This is a cant in the firmware,without ds1307 highlight 65.65.65

Leave a Reply

Your email address will not be published.