Wall Clock With Atmel Microcontroller




Introduction: Wall Clock With Atmel Microcontroller

About: I got my education and initial job experience in Ukraine, but in 1998 moved to California. I work as software engineer in one of Bay Area companies. Whenever I have a time I like to program micro controlle...

It is easy to build an electronic clock nowadays. All that you need is a few inexpensive components, rudimentary soldering skills and some programming experience.

The clock above is what I made for our bedroom (thanks to my wife who allowed me to put this creature on the wall).What is special about this clock: It is a twenty four hours clock with accuracy up to one minute.
It uses a single active component: Atmega328 controller, which keeps the time and controls LEDs without help of any external microchip. Time accuracy is provided by an external oscillator while internal oscillator provides processor working frequency. Technique known as charlieplexing is used to handle the number of LEDs exceeding number of controller's I/O pins. This bedroom clock possess an important feature: it can turns light OFF and ON according to the schedule. This way it's light does not distract us during sleep time but allows easy time reading at dawn.

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: Components

Clock contains this set of components:

  • Atmel controller. I have used Atmega 328 but less powerful controller could be used as well.
  • Clock oscillator 32768 Hz.
  • Thirty LEDs (5 mm size).15 resistors 51 Ohm each (0.25 or 0.125 does not matter).
  • Radio Shack protopype board (catalog number 276-170)
  • Two three pins headers (to build ISP connection between controller and PC)
  • Capacitor 0.047 micro farad
  • Encoder to set up clock time. I have used Panasonic EVQ-WTEF2515B.
  • Hookup wire and old IDE cable.
  • Power supply 5 V. It must provide at least 300 mA of current. I have used supply from old Sharp handheld computer.

Step 2: Circuit Diagram

Components are connected according to the circuit diagram.

Step 3: Assembling the Circuit

To make soldering of four LEDs to the single resistor I prepared the board by making some cuts with a knife. Here is how the board looks after soldering of all components.I decided to use as a clock plate the wooden board from Michael's. I did not try hard to make it strictly symmetrical, having in mind the asymmetrical shape of the board.

Step 4: Programming

The clock was programmed with help of Atmel studio 6.1 in C language. Here https://bitbucket.org/jumbleview/clock30/src you can find the source code and project file.

Step 5: Setting the Time

Setting the time is not hard. For that three LEDs at the back of clock are used. To set the time there is the need to follow next steps:

  1. Push the encoder: reserved LED is turned on
  2. Rotate the encoder to choose value you want to set (hour or minute).
  3. Push the encoder again, now clock are ready to set the value.
  4. Rotate the encoder to set the proper value.
  5. Push the encoder again: the value is set.

To set the other value you may repeat steps 1-5.

Step 6: Using the Clock

This clock has two dials: inner (yellow) dial for hours and outer (green) dial for minutes. These two dials provide time reading with accuracy up to three minutes. Three correction LEDs in the middle improve accuracy up to one minute.

Rules to read the time are simple:

  • During AM hours single LED is turned ON showing current hour.
  • LED which points to XII hour is always OFF.
  • During PM hours group of LEDs are ON staring from the LED which points to XII LED and ending with the current hour.
  • Next LED is switched ON when there are two minutes left till the start of new hour.
  • Each green LED of outer dial represents 5 minutes interval.
  • LED which point to 60 minutes is always ON as well as LED next to the current minute and all LEDs in between.
  • This way the clock provides at least three minutes accuracy.
  • Three LEDs in the middle allow time correction.

Step 7: Additional Info

I described this project in my personal blog jumbleview.info. Here you can find some additional details of this and my other projects.

Be the First to Share


    • LED Strip Speed Challenge

      LED Strip Speed Challenge
    • Sculpting Challenge

      Sculpting Challenge
    • Clocks Contest

      Clocks Contest

    2 Discussions