My Motivation

This winter my girlfriend had a lot of trouble waking up in the morning and seemed to be suffering from SAD (Seasonal Affective Disorder). I even notice how much harder it is to wake up in the winter since the sun hasn't come up yet. Symptoms of severe SAD can include irritability, oversleeping but still being tired, not being able to get out of bed, depression, and even some physical problems such as joint pain and lowered resistance to infection. I had heard about sunrise alarms that simulated the sunrise and figured it could be a possible solution to her problem.

The Plan

I remembered seeing an instructable (http://www.instructables.com/id/Blue-LED-dawn-simulator-for-Soleil-Sun-Alarm/) about modifying a sunrise alarm to provide blue light using LEDs since blue is supposed to be the good light to help out. I liked the idea but the way the microcontroller is used in this instructable intimidated me since I've had limited experience with programming one after the code is developed. It also did not solve the other concern of mine: spending $80 on an alarm clock and modifying it, not that my girlfriend isn't worth it :D

I first thought about developing a clock from scratch using a microcontroller. We built a binary counting clock in one of my college classes, so I was familiar with the logic. I later gave up on that idea since I wouldn't be using the same programming language and I would take a lot of time to develope the code. I then had the idea to use a cheap digital alarm clock that could, hopefully, provide a voltage when the alarm went off. I could take this voltage and use it as a switch with a microcontroller. When the alarm went off and the voltage went high, the dimming process would begin. If the snooze button was hit, or the alarm was turned off, the voltage would go low and the dimming process would stop, turning the lights off. I researched this idea and found out that it was possible to use a voltage from a clock and use it with a microcontroller! A guy had completed a similar project that opened his blinds automatically in the morning (http://hackaday.com/2008/11/18/alarm-clock-automated-blinds/).

The Microcontroller

The ideas started flowing and all I had to do was pick a microcontroller to use. I saw an article on sparkfun.com that went through the process of building a circuit to run an ATMega168. I read carefully and decided that it seemed simple enough and that it was the microcontroller I wanted to use. Upon further research, I found this Arduino thing everyone has been using for their DIY projects. It used the ATMega168, was open source, and had numerous help forums and starting examples; perfect for the beginner. I decided to use it to program my ATMega168 and transplant it into a breakout board that contained the bare essentials for the ATMega168 to run. With the last piece of the puzzle in hand, I could start.

Quick Side Note: Before I start, I just want to say thanks to all of the sources I used. I tried to make sure I linked any reference I used within the instructable. The code is just manipulations of the examples included within the Arduino environment and a bit of my own so thanks to the people who coded those! Also, this is my first microcontroller project. I'm sure I didn't do everything completely correct, such as adding filter caps to places and other various parts to my circuits. If you see something that can be improved, let me know! I'll be sure to update or make notes of it. Enjoy!

Step 1: Probing The Clock and Alarm Output Circuit

Probing the Clock

This is the clock I chose. I got it at Walmart and it was cheap so if I wasn't able to use it, I wouldn't be too upset. It also has a 9v battery backup in case the power goes out. I later found out that the alarm sequence from the ATMega168 still goes off! So it will still wake you up if there is no power! When it's running off of battery power the front display turns off and it switches to a different internal clock that is less accurate but still works fine. When power is reconnected the clock may have to be adjusted but the alarm settings will stay.

The clock comes apart fairly easily. There are four screws on the bottom and three screws that keep the button PCB board fastened to the top of the clock case. To take the top off and get better access to the LCD, you need to thread the 9v clip through the hole in the bottom half. The front LCD pops out and upon inspection, there were vary few parts. I found a transformer, a piezoelectric speaker for the alarm, some diodes for the rectifier circuit, some buttons for the inputs, and a clock display that seemed to have all of the clock circuitry underneath it. I found the ground and started probing away. BE CAREFUL WHILE DOING THIS ON YOUR CLOCK, THERE'S AN EXPOSED TRANSFORMER THAT WILL DELIVER A HEFTY SHOCK. I took note of the voltages on each pin when the alarm was off and when the alarm was on. I was hoping for a pin that provided a nice 5v logic voltage when the alarm was on and 0v when the alarm was off. I wasn't that lucky but the voltage that went to the speaker provided a voltage that varied from 9.5v-12.5v. I figured I could use this. I also found a pin labeled VCC that provided a voltage that varied from 10v-12v. This comes into play later when building the power supply for the microcontroller.

Alarm Output Circuit

I soldered a wire to ground and one to the alarm pin and started working on a circuit to steady out the voltage. I figured I could use a 5v regulator but I only had an adjustable regulator laying around. I did some math and my values provided a voltage slightly below 5v. I tinkered a bit and swapped resisters until it provided the 5v I needed. I used a 470uF capacitor on the input to smooth out the voltage. With the capacitor, the voltage only varied from 10.5v-10v. Below is the schematic of the circuit I used to condition my alarm output and a picture of the parts together on a breadboard.
<p>this is really cool, I need to tweak <a href="http://www.instructables.com/id/13W-LED-wake-up-light-my-version/" rel="nofollow">my setup</a> to something similar asap..</p>
Can you explain to me where you found the ground and the alarm pins?<br /> <br /> I was thinking i could just solder in some LEDs to them and when the alarm goes off the LEDs turn on<br />
&nbsp;Is there a way I could get the larger version of both wiring diagrams?
I&nbsp;see what you're saying now. I looked but I'm not sure where the files are. I&nbsp;built this when I&nbsp;was co-oping so the files are probably on the computer at work. The big drawing is basically all those little drawings put together though.<br />
Hi, Nice work. What would happen if i used a different speaker instead of a pezio? Ben
Not entirely sure but I think you'd need to use a amplifier because the voltage coming from the chip would be too small. If you buy an alarm clock, it'll come with one.
well...actually i use to be really obsessed with electronics....now i am more into food..muahahaha. i just advertise ur project to my electronic crazy friends. They will soon check ur project out. Looking forward to see more of ur creations.
Ha, food is another one of my favorite hobbies. Thanks for showing your friends! I got a few more projects in mind... Just gotta get around to building them and documenting them.
nice one. thumbs up
Thanks! I'm kinda confused about the lack of comments. After I post a project I usually have nice discussions about it! but not for this one :/
Nice work. In my setup, the LEDs alone aren't enough to wake us, which I why I have incandescents in the loop too.
Thanks!! Yeah, I can see how they may not be bright enough. I was worried about that too but then I thought about a nice alarm that would be more pleasant, even if the LEDs didn't fully wake you. I liked your setup, I was just afraid of breaking screwing something up and breaking the $60 clock :/

About This Instructable