Atmega Alarmclock & Thermohumidity Meter




Introduction: Atmega Alarmclock & Thermohumidity Meter

About: Young slovak IT & electrotechnic developper.

First, let me introduce you my project. I made an Alarm clock with extended functionality & thermometer and humiditymeter. Everything started when my friend (who used to bring me some old electronic rubbish and I used to check if there's not something useful) brought me some cashing register display similar like that. When I first see them I knew that I will made from it alarm clock.
I'm programmer and I used to program in many programming languages but this year I started programming in C for Atmel microcontrolers (attiny 85, atmega 8, atmega 328, atmega329, atmega 128 etc...). When I discovered DHT11 (temperature and humidity sensor) I programmed simple clock with thermo&humidity meter. I haven't got any case for my project so I imagine that when I cut off column from cashing register display case I will have the case of my dreams for my project.

As microcontroler I used Atmega329p because I have and few of them and they got enough pins for my project.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Functionalities of My Alarmclock

My alarm clock have many functionalities and I separated them into few menus (mods) you can change actual menu by pressing second button :

1.) Big clock

-Show big clock with real time

-You can there turn on/off display backlight by pressing first button

-There you can also setup hours and minutes (everytime where are minutes or hours set up seconds are set up to zero). To setup hours third button, to setup minutes fourth button

2.) Actual temperature and humidity

-Show actual temperature (°C) and humidity (%)

-Actual temperature and humidity are refreshed every 2 seconds

-You can there turn on/off display backlight by pressing first button

3.) Maximum values of temperature and humidity

-Show maximum measured values of temperature and humidity

-You can there turn on/off display backlight by pressing first button

4.) Minimum values of temperature and humidity

-Show minimum measured values of temperature and humidity

-You can there turn on/off display backlight by pressing first button

5.) Date and day of week

-Show name of the day of week (as you can seen on picture there are the they of week "Nedela" which in slovak language means Sunday)

-Show actual date

-You can set up actual date by pressing these button: first button to set up year, third button to set up day, fourth button to set up month. (Day of week is automatically calculated and refreshed)

6.) Alarm set up menu

-You can set up one alarm per each day of week (you can have turned on 7 alarms, one for each day)

-There you can list through days of week and check if the alarm is enabled or no, check the hours and minutes of alarm

-By long pressing (more than 1 second) of first button you go to the next day, by short pressing of first button you change state of alarm (enable/disable)

-By pressing of third button you set up hours of alarm & by pressing of fourth button you set up minutes of alarm

Step 2: Features of My Alarm Clock

My alarm clock contains real time chip (PCF8563) with backup battery so if once set up right time & date you can turn off alarm clock, leave them for a month without power and when you plugged into adapter again you will have still set right time & date. Each time you change state or time of alarm - alarms are backuped into EEPROM so if you plugged my alarm clock into adapter after long time your alarms are still set right.

Step 3: Parts Which You Need

You need following parts:

1.) Heart of alarm clock - Atmega 329p (You can also use atmega128 - cheaper equivalent but than you must ask me to recompile source code to that processor)

2.) Real time clock chip PCF8563

3.) LCD display (16 chars 2 rows) with HD47780 driver

4.) Buzzer (you want alarm to beep)

5.) CR2032 backup battery for real time clock

6.) 5 switches (4 are necessary, 5th works as reset button - you don't need it)

7.) DHT11 temperature and humidity sensor

8.) 7805 linear stabilizer

9.) AVR ISP 10 pinheader (for programming, you can also buy from me preprogrammed atmel - then you don't need it)

10.) 16MHz crystal, 32768Hz real time clock crystal

11.) Power DC jack

12.) Power supply (More than 5V, less than 20V) 12V adapters are good for that

13.) Capacitors (2x100uF electrolytic,4x100nF ceramic, 2x22pF ceramic)

14.) Diodes 1n4148 2 times (to separate backup battery from adapter voltage)

15.) Resistors 4x4k7, 1x10k, one potentiometer for adjusting contrast of display

16.) Double layer PCB

17.) Chemicals and materials for PCB etching

18.) Conductive silver to connect one side of PCB with the other side

19.) Enough time and dedication

Step 4: Printing Foil for PCB

I designed PCB of my alarm clock to fit in my case from cash register display so if you want I can send you schematics and you can make your own PCB.

In case you want to etch the same PCB as I have I provide you these to files - toppcb.pdf and bottompcb.pdf in which are my PCB design.

You should print them to the transparent foil or to the very thin paper (Sorry but I really don't know how it's called in English).

If you can you should buy PCB with UV photoresist paint. If you can't you can also buy an photoresist paint in spray and apply them to the cleaned PCB.

Then you should attach the printed foil or thin paper to the PCB with photoresistive paint and put in under UV lamp for the enough time - it really depends on UV lamp but it used to be around 1-2minutes.

After that you should put UV exposured PCB into chemical used for inducing of photoresist (again I really don't know how to say it in English) it used to be 1% water solution of NaOH (sodium hydroxide).

Step 5: Etching the PCB

After that you should etch your PCB in some of the PCB etching solution. I used to etch in FeCl3 (ferric chloride).

Step 6: Additional Treatments

You can also use green (or what colour you want) pcb soldering photoresist mask. I provide you top & bottom printing template for soldering mask.

If you want you can also use thinning solution before you apply soldering mask.

If you want to apply that chemicals and you haven't done that before, please don't worry to look for the tutorial of application process.

Step 7: Soldering the Components

The next step is soldering the components to the PCB, you can check my soldering plan (top & bottom).

Step 8: Find an Charge Adapter

You should find good power source for your alarm clock. Almost any type of charger with greater voltage than 5V is good enough.

In my case I customized old mobile charger.

Step 9: Program Atmega Microcontroler

Use AVR-ISP 10 pinheader with some type of programmer (I preffer usbasp - cheap usb atmels programmer).

I provide you main.hex if you use usbasp to burn the microcontroler use that command :

avrdude -c usbasp -p atmega329p -U flash:w:main.hex

You must also set up correct fuses - atmega should have enabled external oscillator, jtag disabled and eeprom preserve though chip erase. Apply that fuse using that command :

avrdude -c usbasp -p atmega329p -U lfuse:w:0xce:m -U hfuse:w:0xd1:m -U efuse:w:0xff:m

If you want to use other pin-compatible microcontroler please contact me and I will provide you right calculated fuses & I will recompile source code to your custom microcontroler.


Step 10: Customizing Case

You should drill holes for buttons in your case, cut off or add something to the case so the pcb will fit correctly. Before I designed my pcb I firstly measured the case to made pcb design for my own case so if you want to make your own design you're welcome.

As you can see I used old skype-phone headphone to make alarm clock stand. I also attached DC male connector to that stand which provide power to my alarm clock.

Step 11: Finalizing Steps

When you have everything done, you should join everything together.

I hope you like my tutorial, it's my first instructable, sorry for my bad English but i'm not a native English speaker.

If you want (as you can see the version of the alarm clock used slovak words like slovak day of week etc.) I can provide you English version of code. If it is interesting for you I programmed the whole alarm clock in C, it last about 2-3 weeks of work - everyday about 30-60minutes. My code have 700 lines of pure code + about 200 lines of code inside the library.

I also want to thank my father to help, extremeelectronic for softwarei2c library, sorry I really don't remember where but the big clock design (big number on 16x2 lcd) - I made my own library to show big numbers on lcd but I use 8 special characters which copied somewhere.

Please vote in Time contest for this article.

Have a nice day!

Make It Glow! Contest

Participated in the
Make It Glow! Contest

Time Contest

Participated in the
Time Contest

Be the First to Share


    • Trash to Treasure Contest

      Trash to Treasure Contest
    • Raspberry Pi Contest 2020

      Raspberry Pi Contest 2020
    • Wearables Contest

      Wearables Contest

    5 Discussions


    4 years ago

    I had no idea that you could apply a solder mask by hand like you did. That's awesome! It looks like it was professionally fabricated.


    4 years ago

    This looks awesome! It's like bought from the store. Amazing finish! Love the design!

    The big characters and the pcb design and pcb manufacturing is astonishing!

    I`m really glad that you respect your work, and don't just publish the code. Remember that you have shared the most important piece of your work: your idea(s). The code itself is not important. The whole idea behind this project is. It's really innovative, I would say, by the looks of it!

    Thank you for sharing this great and comprehensive instructable!


    4 years ago

    Hi ,

    Thank you for sharing.

    Planning to publish source code ?


    Reply 4 years ago

    You are not first who are asking it, the source code contains a lot hours of my work so I don't want to publish it as full code. Also every my function and library is written in Slovak language plus my code is a little bit complicated and when you don't know what I want to do you will really don't understand the code. But if you are insterested in how I had done something for example as someone asked me how I had done the bign numbers &special chars I could explain you how and show that part of code which are using it :) Also I'm planning to make tutorial how to make big numbers right in pure C for avrs this week. Have a nice time :)


    4 years ago

    Wow, nice job on your first Instructable! I hope we see more from you in the future. Good luck in the contests!