You Are Here: Home » AVR ATmega Projects » Clock Projects » Retractable Alarm Clock (RAC) Using Atmel Mega32

Retractable Alarm Clock (RAC) Using Atmel Mega32

1.1  Motivation:

Alarm clocks are essential in almost everyones daily life.  For most of us, we start our day to the sweet noise of our alarms.  While some people wake up instantaneously to the first chirp of an alarm, some struggle everyday to get out of the bed. The Retractable Alarm Clock is the next generation alarm clock that combines both active alarm feature and penalty system that trains the users to wake up to the alarm over time. The clock in this projects consists of a head unit that is to be hanged on the ceiling above the bed and has a retractable snooze button which hangs to reachable height above the bed. When the user snooze the alarm, the snooze button moves up, promoting the user to physically get up and to snooze the next time.

1.2  Introduction:

By using an ATMega32 chip, the alarm clock can generate different alarm sounds. The time is displayed on LED lights.  A customized snooze button is made to accommodate the movement of the retractable cord powered by a small dc motor. The alarm gradually increases the loudness to wake up sleepers gently. To prevent the sleeper from falling asleep to the monotonic sound of alarms, our alarm varies the frequency every 12 chirps.

2     High Level Design:

2.1  Hardware Block Diagram Overview:

The following block diagram describes our basic hardware layout:


2.2  Software State Diagram:

The following block diagram describes our basic software layout:

3.    Hardware Components:

3.1      Motors:

For this project, we tried five different motors.  The fan motor used in Lab 5 does not provide the required torque.  The stepper motors that were available in the lab require too many control lines.  Because we have limited ports off the ATMEGA32, we would have to have used a multiplexer.  Also, the only function that we require the motor to do is to spin in one direction and thus using a stepper motors seems like a waste if its potential.  We then found a broken electrical toothbrush and took the motor out of it.  The electrical toothbrush runs on a 1.5V AA battery. The entire circuit that we build is based 5V so to use the motor from the toothbrush we would have had to step down the voltage before it entered the motor.  However, by doing so, we also decrease the voltage going in to the 4N35 chip that is used to control the motor.  The voltage drop across the 4N35 is about 0.7 V, when running on a 5-12V, this drop seems ignorable, but if a 1.5V is applied, the drop is almost half of the voltage and thus will not power the motor. We then ordered a 9V DC motor from All Electronics, however we did not use it because it draws 1.35 amps, and is not suitable for our circuit.  We also acquired a fourth motor from another group that was not using it.  The motor was not new and had several connection issues originally.  Once we got it working we found that it heats up the BUZ73 very fast and drains the battery dry in just a few minutes.

So after exploring all options, the motor we finally decided to use is a +5V DC motor that was ordered from Jameco (PIN231802) that came in later than we expected.  The motor requires around 0.15 amps to operate and has a reasonable battery life. This motor is brand new and has no connection problems.  The motor still heats up the 4N35 chip but it is not significant because we only run the motor for less than one second at a time, so the heating problem can be ignored.

Since it is an alarm clock, the user needs to be able to read the time at night from a reasonable distance. A lighted LCD is too hard to read even though it would be much easier to integrate. We used four seven segment displays. Under different settings, the display will show the Current time, Alarm set time, Current Date, and Current Day of the Week. Once the set button is pressed, the display settings change in order to show the current setting on the LEDs.  This means that if the set button is pressed once, the LEDs will show the month and date.  Pressing the set1 and set2 buttons will change the month and date, respectively.  Once the set button is pressed again, the current time is displayed.  Pressing the set1 and set2 buttons will change the hour and minute, respectively.  One more press of the set button will change the LEDs to display the current day of the week.  Pressing the set1 will increase the day and set2 will decrease the day.  Pressing set a final time will return the display to the current time after all settings are made.

To power all four LEDs at all times requires a considerable amount of current and drains the battery.  Also, if we wanted to code each 7-segment display individually, 36 control lines and pins would be required.  Due to the above two limitation, we could not control individual LEDs separately. To solve this problem, we wired all the LEDs in parallel to the same output pins.   This method required each LED display to have its power controlled separately.  The total configuration required 12 pins.  By precisely timing the refresh rate and on and off of the individual LEDs, we can flash the 4 LEDs in sequence and change the display between each flash. Human eyes cant detect the change as long as it flashes at a reasonable rate. We light each LED for 5ms before switching to the next LED.  To the viewer, the flash is not detectable.

Retractable Alarm Clock (RAC) Using Atmel Mega32

Speakers and Motors drain a significant amount of current from the battery; to run them all at the same time results in overheating Buz73 and significant dimming of LEDs. To solve this problem, we cycle through the 3 components the same way we flash the LEDs.  When the Alarm goes off, LED displays flash every 5 ms and cycle 40 times before the signal is sent to create a beep at the speakers.  Once the signal is sent the LEDs turn off until the speakers are silent.  Also, when the snooze button is pressed, the motor turns on and both the beeping and LEDs turn off.

3.3      Switches:

We found several very basic switches from the box of extra/used supplies.  We also bought 3 pushbuttons from All Electronics.  Some of the push buttons are defaulting high and others are defaulting low.  For the snooze button, we need a push button large enough to be pressed easily.  Vincent made a default low push pad with two metal plates.  All of the push buttons are not factory debounced, so we debounced the set button, which determines which setting state the clock is in.  For the set1 and set2 buttons, we did not debounce them.  Instead we check them every 350ms so that if you hold them, a press will be seen every 350ms and the numbers will change.  This is beneficial to the user as it makes setting the clock easier than if each change required a button press.   All push buttons are connected to a pull down resistor to ground to ensure a clean signal with no flouting charges.

Parts List:

ItemUnit Price ($)UnitTotal
ATMEGA 32 Chip8.0018.00
Custom PC Board5.0015.00
5V DC motor3.2413.24
Small Solder Board1.0011.00
9V Battery2.0012.00
Push buttons0.0540.20
7 seg LEDs free40.00
Gears 0.220.4
Total  22.64

For more detail: Retractable Alarm Clock (RAC) Using Atmel Mega32

Leave a Comment

You must be logged in to post a comment.

Read previous post:
Automatic pet feeder Using Atmel Mega32

Introduction Our project is an automated pet feeder that is controlled by a wireless infra-red remote control. As pet lovers,...

Scroll to top