As the nights gradually lengthened in autumn 2011, I discovered the joys of Arduino and thought that it would be a great way to implement something that I have wanted for a long while - a gentle way to wake up on a winter's morning.  Sadly, it has taken me over a year to find the time and understanding to put it all together, but here, in time for some of the shortest days of this winter, are the results!

The idea is that getting up when it's pitch-black is a wrench.  Equally, having a timed light that just switches on all of a sudden is a shock.  What you want is a gentle ramp of light from imperceptibly dim to ragingly bright and ideally going from a nice gentle red to blazing white so that your brain thinks it's time to start that melatonin level rising.  My solution is a full-function micro-controller, RTC alarm-clock with the following features, among others:

Arduino compatible ATMega328 controlled, open, hackable, reprogrammable.
Battery backed-up RTC
Brightness-controllable red LED display
Cool rotary encoder input
Up to 18W LED dawn light
8-channel PWM light control (2 x 3W RGB + 2 x 6 x 1W white)
Exponential brightness ramp on dawn light
7 independent dawn alarms stored permanently in EEPROM
Alarms setable for any day, for every day, for mon-fri or for sat-sun.
One-press "arm/disarm" with indicator (stored in battery-backed RTC RAM)
Each alarm has optional buzzer
Escalating buzzer tone
Snooze function on buzzer
Controllable "ramp" time (min to max brightness time)
Controllable "hold" time (time at max brightness)
Controllable "buzzer delay" (time between max brightness and buzzer)
Easily controlled "Night Light"
"Security Light" mode (mode stored in RTC battery-backed RAM so safe to blackouts etc).

A dawn clock aims to wake you up gently and you can buy them commercially, but they are expensive, generally just white, not very flexible, and just not much fun!  We'll aim to make a full-feature dawn alarm clock and add a buzzer too, just to be sure we actually get to work on time!  It's also something of a learning exercise for me so it has a whole bunch of different interface and control techniques for me (and perhaps you) to master along the way.  There's about 6 separate projects in here and I'll try to put some example code in so that you can try them separately if you wish.

Although you could do this project perfectly well on a "real" Arduino, and indeed it was prototyped with a "nano" on a breadboard, I'm making the dedicated installation on a minimal Ardu' compatible so that you don't need to commit your "real" Ardu' to the clock.  I have made this project both on bits of perf-board and on a dedicated PCB that I have designed & had fab'd.  We'll look at both ways to do it - the result is much the same but the PCB is much less time consuming.

There are several discrete "sub-projects" that I've called "modules" in this project, any of which could be made and used individually:

The Arduino clone & RTC
The Digital time display
The Rotary encoder & switch controls with de-bounce.
The "Shift PWM" LED driver board
The lamps themselves & a trivial "buzzer" alarm.
Controlling an ATX power supply for efficient powering of the device

I've tried to make this instructable modular so just skip over any modules you can handle yourself already or use just one or two parts for your own project.

Step 1: See It Working - Plus Some Shameless Groveling

This is the finished and functional clock in action - the alarm is set to come on at 14:40 (if I could get up at that time I wouldn't need this clock!) and I have set it to ramp up over 1 minute (normally you would use 10-30mins but it makes a rather dull video).  You will see that every few seconds the lamp gets brighter.  The ramp-up and colours aren't very good in the video but you get the idea.  At the end of the ramp-up, the lamp stays on but the alarm sounds (you might normally have a delay but again, it makes a rather dull video).  I press to snooze the alarm, and then again to cancel the light and reset.

Shameless Groveling:

I've entered this 'ible into the "Glow" contest so if you like it or any of its modules then please consider voting for it.  I could have split it into a few entries but really it's more sensible all together and it's taken a year to get together. So if you like it, please....

Vote for me and help me get me some more fun stuff to make fun instructables with!


<p>Hi,</p><p>just found your great work and wondered where I can find the schematics download??</p><p>I would like to make one, too!!</p><p>BR,</p><p>Mike</p>
<p>Eagle Board and Schematic files are in Step 3. This is the first major project that I tried in Eagle and I'm afraid there may be some errors, but it will give you a good start. </p><p>I will look and see if I have an updated version with the errors fixed. IIRC, the white LED drivers are connected to +12v when they should go to +5v and there is an issue with the transistors (I think the datasheet I had for the NPNs didn't match their actual pinout - you need them backwards compared to the silk). I'll post updated versions if I have them.</p><p>Ugi</p>
<p>Got it! Thank you so much for this wonderful tutorial!! :-)) </p><p>BR</p><p>Mike</p>
<p>Hi, I woke this morning and had the same idea. I am an Australian Accountant so I searched for the idea on the internet and found you. I have some ideas I want to explore commercially with you. Lets discuss possible business ideas for this project. email me cvpages.buddy@gmail.com</p>
<p>Hey Ugi looks awesome! I'm looking into buying one of those commercial sunrise lamps after failing several time building my own with the arduino (I'm a total noob).</p><p>Do you sell the kit or the finished product? :)</p><p>Please let me know! </p><p>Thanks a lot</p><p>Sam</p>
<p>Sorry for slow response Sam</p><p>I might have a board or two left but they are buried in my garage while we are having work done on our house. If you are still interested, PM me your address &amp; I'll send you a board when I finally uncover them!</p><p>Ugi</p>
Do you still have any of the free pcbs and chips available? I was planning to make pretty much the same thing myself, but then thought, someone else is bound to have alreay already thought of this... and so did a quick search and found this page! Great work on this. It really looks well thought out and created. I'd love to put any spares you have to good use! If they are all already claimed, no problem. Thanks again for a great tutorial.
<p>Thanks for the comment and sorry for the slow response.</p><p>I may have a couple of boards left, and in fact I owe a couple of people some, but we have been having work on our house for several months and I can't get at stuff in my garage - it's just buried! If you are still interested, PM me your address and I'll send you one when I uncover my parts!</p><p>Ugi</p>
Fantastic Instructable, I really like the modular design and thorough detail you put into this! <br> <br>Would you happen to have any &quot;kits&quot; or at least the PCB and a pre-flashed Mega328 for sale? I have been wanting to make a gradual sunrise alarm clock (and, hopefully, accompanying gentle alarm sounds) for some time now, but I haven't had the time to design a well thought out clock like yours. I would love to modify this to maybe include an MP3 trigger (or something similar) that can play some pleasant morning sounds too.
Hi Labrie <br>If you read the very end of the very last step, there is a special offer - I offered the first two people to ask a free board and set of ICs. You are the second person to ask so I will happily send you a set for free (including pre-flashed '328). You'll have to provide the other components like the 1W LEDs, power supply and standard parts. <br> <br>I'm just back from vacation today so it will take me a few days to sort myself out but send me a pm and I'll sort something out for you asap. <br> <br>Maybe you could also let me know in your PM what issue you're having with the code and I'll see if there's been an cut/paste error or something somewhere. <br> <br>Cheers <br> <br>Ugi
HI Ugi <br>Im having issues verifying the final file in arduino 22. do u have a later version .ino file <br>Or do you have any boards and programmed atmel chips available for purchase?
could you make another of this without arduino. <br>i would like to make a nightlight with 25W CFL plus an alarmclock using LDR
This specific project culd not really be done without a microcontroller. However, there are other dawn alarm clock projects that might help you more. Search for sunrise alarm clock in the search box and pick those aspect sfrom each that are most like the project you envisage. <br> <br>Thanks for reading &amp;commenting. <br> <br>Ugi
Good job on documenting this project. I am also making a sunrise clock and it will be my first Arduino project. I selected 50W LED's, and wanted to ask how bright your setup is (9W or 18W depending on yours shipment) on the white led side. Do you wish you had more wattage?
Thank you for your comment.<br><br>I have run this on both 9W and 18W and certainly with 18W it really lights up the room. It's maybe equivalent to having three 50W halogens pointed up at the ceiling so even though it's the other side of our bedroom, the whole room is bright.<br><br>My main aim with this was for it not to feel like the middle of the night when you wake and even at 9W that works pretty well. It's perhaps not blazingly bright on 9W but it's enough to make a real difference. You might argue that 9W is not quite enough but for me, 18W is plenty.<br><br>With 50W, you are going to have stacks of light. You might want to build yourself a programmable maximum brightness in the firmware, or perhaps ramp it up over slightly longer than I have because I reckon that much light will wake you before it gets to 50% intensity!<br><br>Would love to see some pics of your project when you get it finished.<br><br>Ugi
this is genius. great work.
Thank you - it was certainly a considerable learning experience but there are lots of aspects that I have already found useful in other projects. <br> <br>Ugi
yeah I really want to do it just because of the DIY arduino. looks like fun project.
Did you read <em>right</em> to the end? ;-)&nbsp;

About This Instructable




Bio: Call me Ugi. Special offer! Make something based on one of my instructables and post a picture for a free 3-month pro membership (while stocks ... More »
More by Ugifer:Handheld Pong & Invaders on the cheap (Arduino compatible) Kid's Science Project - Reusable Hand Warmers Make a High-Altitude Balloon Tracker (Arduino) 
Add instructable to: