Your (My) very own Sunrise alarm clock.

I've always wanted to build one of these:

Figure 1. Philips Wake-Up Light

There are many (claimed) benefits to having a Sunrise alarm, one of which includes a gentler wake-up as compared to the loud buzzing of an alarm in the darkness. I noticed that I often would shut off the alarm and go back to sleep, and waking up was kind of rough.

One of these things at the moment costs $49.99 (with a $20 coupon applied). A more expensive version with a colored sunrise simulation costs $139.99. That is a little more expensive than what I want to spend on a light that gradually lights up in the morning.

I don't have the capability to manufacture something like that, but I am able to mess around with LEDs, and I figured a better way to do this than having a morning light is actually simulating sunrise: make it so that my window lights up as if it was daylight outside. I can have morning at whatever time I want.

This guy beat me to it. The project is here. I swear that I had this idea before I read about this project.

Figure 2. Smart LED Window

So this proves that using LED behind blinds can actually create a nice simulation of daylight.

However, using a Raspberry Pi in my case is kind of an overkill because I want to wake up at the same time every day. So instead, I used an Arduino Pro Mini (5V) that was being sold for $4 in Microcenter. I also happen to have a 5m strip of warm LEDs that I bought off AliExpress for $4.41. I needed a IRLB8721 MOSFET ($1) to control the brightness and the current, and finally some breadboard wires, a DC female plug and a 12V DC charger ($5) to complete the package. I used a DS1307 module pictured here, and you can buy one off AliExpress for about $0.50. Batteries should cost $1 each.

WARNING: The DC plug pictured below is not the one on an Arduino UNO board. That is designed only to power the board and is not capable of withstanding the large current draw the window needs.

Figure 3. Breadboard layout

The board is powered by supplying 12V from our wall plug to Vin of the Arduino board you are using. Make sure that your board can take in 12V or you will need a step down regulator for your board.

The gate of the MOSFET goes to pin 3 of our Arduino so that we can use PWM to modulate how much current gets sunk, and in return, how bright the LEDs are. Here we are simulate a LED strip with an LED. If you have an LED strip, just connect the positive and negative leads to the strip as in the LED pictured above.

The sketch itself is pretty simple. Check the time, if it is the time, increase the light. I used 5 seconds as my time in-between increments, which works out to 20 minutes to increment the light to full brightness.

This code includes functionality for a swtich that is connected to pin 2. By using the switch you should be able to turn it off. You'll have to connect an SPDT switch to GND and VCC on both ends. The middle of the switch should go to Pin 2. I settled for unplugging it in the morning.

For now I've just sticky-taped the entire thing to my window to prototype the effect, but once it is finalised I will probably transition it to a nicer/portable design.

Total cost comes out to about $20, which is savings of about 50% if we are comparing it against the sunrise alarm clock after discount. It was a good learning experience and this alarm is programmable and extensible. So I'd say it is a pretty good deal.

Figure 4. Simulated Morning

The LEDs don't show as much as seen in the image. I turned the LEDs inwards to create a softer glow. With a longer strip I might have been able to eliminate the dark spots, but honestly it isn't that big of a deal. Note that outside was completely dark.

Putting it together took about 3 hours, 2 of which was figuring out why my RTC module didn't work (slipshod soldering on my end). Putting the next one together would probably take me about an hour.

Usage

After about 3 days I am starting to wake up at 6am, when the alarm is fully bright.

After about two weeks of use I wake up at approximately 630am, but lie in bed until my alarm goes off.

Sketch

#include <RTClib.h>
#include <Wire.h>

#define LEDPIN 3

#define HOUR 5
#define MINUTE 30

#define FADESPEED 5000

RTC_DS1307 rtc;

bool light_switch = false;

void setup()  
{
  pinMode(LEDPIN, OUTPUT);
  pinMode(2, INPUT);
  Serial.begin(57600);
  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    while (1);
  }

  if (! rtc.isrunning()) {
    Serial.println("RTC is NOT running!");
    // following line sets the RTC to the date & time this sketch was compiled
    // rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date & time, for example to set
    // January 21, 2014 at 3am you would call:
    // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
  }
}

void loop()  
{
  DateTime now = rtc.now();
  if (digitalRead(2) == HIGH) {
    analogWrite(LEDPIN, 0);
  }
  if ((now.minute() == MINUTE) & (now.hour() == HOUR)) {
    light_switch = true;
  }
  else {
    delay(1000);
  }
  if (light_switch == true & digitalRead(2) == HIGH) {
    for (int i = 0; i < 256; i++) {
      analogWrite(LEDPIN, i);
      delay(FADESPEED);
      if (i == 254) {
        light_switch = false;
      }
    }
  }
}

TO DO

The following are a series of possible additions to the alarm.

  • Use a gauze cloth to diffuse the lights. If your LEDs are right up against the blinds they don't diffuse well.
  • Use white LED lights instead of warm white. Warm white gives off the color of sunset, not a sunrise.
  • Actually use a switch
  • Ability to set time remotely
  • Move everything off a breadboard.
  • Add sound
  • Add PIR Sensor
Show Comments