LED Sunrise Alarm Clock

26K24246

Intro: LED Sunrise Alarm Clock

Trouble getting up in the morning? Hate the harsh piercing sound of an alarm? Would you rather make something on your own that you could arguably buy for less money and time? Then check out this LED Sunrise Alarm Clock!

Sunrise alarms are designed to provide a more calming wake experience by slowly increasing in brightness around your set wake time. The idea is that this appeals to our natural inclination to wake up with the sun and 'tricks' the body into a balanced circadian rhythm making getting up easier. This might not be the case for everyone but personally I've found it to be helpful and particularly find the warm colors comforting in the morning.

Many of the sunrise clocks you can purchase attempt to simulate sunlight with specials bulbs that try to match the hue and color temperature of the morning sun. However for this build we are just used RGB LEDs which can roughly approximate a sunlight feel but also allow for cool and unique color combinations and effects. This build is based around a bare bones Arduino UNO with Real Time Clock (RTC) module and 7 segment LED clock.

STEP 1: BOM

STEP 2: Design

The schematic of the build is included below. Check it out. The key element of the clock is the RTC module. This provides reliable time keeping and has a small battery that enables it to maintain time if the entire alarm clock is powered off. The RTC module and 7 segment clock display interface to the Arduino via I2C protocol.

User input to the device is achieved by a rotary encoder with tactile push button which is used to configure the clock time and alarm as well as the LED modes and brightness. The potentiometer is used to vary the 7 segment clock display brightness. In retrospec using another rotary encoder would've made interfacing a bit easier and I could've added more functionality but it gets a bit more complicated handling the two rotary encoders using the Arduino interrupts (haven't really dove into adding two rotary encoders so not entirely sure how difficult it is). A momentary push button is used to turn on the LEDs. I got a nicer metal button with LED in it but any button will do. You could use the button on the secondary rotary encoder if you add it.

I used a 9V power supply adapter with a 5.5mm x 2.5mm jack to the board. A LM7805 was used to drop this to 5V for the electronics. Mine was rated at 0.75A at 9V and I likely wouldn't want to go any lower as the WS2812B LEDs can draw quite a bit at max brightness. At about full brightness the whole device was drawing about ~450mA.

Everything fits into a Basswood trunk box that you can stain for a more finished look. The LEDs used are the 8x WS2812B digitally addressable LEDs. These are great and I like to use them in many projects as they are easily programmed to produce cool effects and can get fairly bright. The LEDs diffuse through the acrylic bubble rods mounted in the top of the box. I used a 3D printed plastic shroud to support the rods, which I touch on later. You could use whatever else you like as an LED diffuser. This article has some interesting ideas.

STEP 3: Wiring and Enclosure

See the .ZIP file for the Gerbers of the PCB. I made this using DipTrace Schematic and PCB Design Software and I've also included the DipTrace file if you are interested. If you don't want to do a PCB you can just use perf board or wire directly to an Arduino UNO. Mostly its just wiring the modules, switches and LEDs to the Arduino.

Potentiometer has one end to GND the other to 5V and the middle to your analog input pin. Rotary encoder wiring needs to be wired to GND and the two interrupt pins (2 and 3) of the Arduino. This Instructable may be helpful. The rotary encoder button and top push button are wired to GND and the respective digital input pin (these will use the internal pin pullups). Also don't forget to wire power to the LED in the top push button (mine didn't need a current limiting resistor). The display and RTC module are wired to 5V, GND and the respective SDA, SCL pins of the Arduino. I used 1uF on the input and output capacitors for the LM7805 and another 10uF on the 5V rail to support the LEDs.

You can wire most of these connectors directly to your PCB or perfboard but I prefer to use standard 100mil (2.54mm) pitch header connectors with heat shrink tubing on my wiring to attach to pins on the board as this makes any changes or fixes easier.

Next is mounting into the trunk box and cutting out appropriate regions for the pot, rotary encoder, display, power jack and top button. I used M3 screw standoffs and nuts for mounting the board. If you size your holes right you should be able to keep the connectors and stuff secure on their own, otherwise hot glue it, baby.

One thing to consider when cutting/drilling in the basswood box is that you'll want to go from outside in and use sharp drill bits and such as the wood easily chips. This is part of the reason for the plastic shroud mount for the acrylic rods as drilling the large holes for them messed up the wood a bit.

STEP 4: LEDs and Staining

Wire the 5V, GND and data line to the strip of 8x WS2812B LEDs. I also prefer to epoxy the wire connection to the strip as they tend to rip off the pads under force and its a major pain to fix. I simply taped them to the underside box.

The acrylic rods were cut, two pieces for each of the following lengths: 2.5" 3.25" 4" 4.75". I didn't have a great tool to do this and simply scored where I wanted to cut with the Dremel and snapped it off. I then used sandpaper and a Dremel polishing tip to clean the ends off. For mounting the acrylic rods it's probably easiest to properly drill the holes without ruining the wood. I failed to do this so instead 3D printed a simple shroud to hold the LEDs in. It is curved accordingly to fit flush against the top of the trunk box (an easy way to do this is to trace out the curvature of the box on paper, then measure the center of the circle the produces the curve in order to replicate the curve in CAD). Overall, the part worked quite well and securely held the rods flush against the LEDs such that I didn't even need glue. I also think the shroud adds a nice contrasting aesthetic to the look of the overall clock.

To keep the box closed I super glued a small magnet to the inside top and bottom of the enclosure.

Then all that's left on the hardware side is to stain it, making sure to mask off areas you don't want stain on (or better yet stain the whole thing before you put the electronics in...) and add some of those little felt or rubber feet pad thingys.

STEP 5: Code and Results

Included below is the code. It's fairly simple and the overall features are quite minimal. The more complicated part was handling the interface to change modes and alarm with the minimal inputs available as well doing some of the color changing LED effects. The notable added libraries used include:

  • RTClib.h - real time clock library
  • Adafruit_Neopixel.h - used for the WS2812B LEDs
  • Adafruit_GFX.h & Adafruit_LEDBackpack.h - for the 7 segment LED clock display
  • Wire.h - for I2C communication to display and RTC
  • TimerOne.h & EEPROM.h

Single press the encoder button to enable/disable and adjust the alarm using the rotary encoder. Long press the encoder button to adjust the time setting using the rotary encoder. Pressing the top button turns on the LEDs. When the LEDs are on the encoder button changes the LED modes and the rotary encoder varies the brightness. The mode and brightness are stored in EEPROM. I set it so that at the set alarm time the LEDs turn on at lowest brightness in the last used LED mode. Over a period of 20 minutes this is increased to the last brightness setting. Then after another 20 minutes the LEDs turn off (or you can turn it off by pressing the button). Note that this build doesn't have an actual audio alarm. I still use my phone alarm in addition to the sunrise clock to wake up as a fail safe. For example, I set the clock to 5am and it increases in brightness to 5:20am, and I set my phone alarm to 5:20am in case I'm not awake, then I start my morning routine and at 5:40am it shuts itself off so I don't have to remember to turn it off.

The LED modes consist of :

  • Solid color yellow/orange, set to try to approximate the color temperature of the sunrise
  • Several varying colors of yellow/orange, orange/red dual color changing sunrise effects
  • Rainbow color change. Varies through the RGB colors across the LEDs
  • Several different dual color combination LED effects. These transition slowly between two colors across the number of LEDs.

There you have it, a nifty looking LED sunrise clock to ease you awake in the morning!

41 Comments

Hi, I know this might be a really basic question, but here goes anyway...

How do you read the schematic in step 2? I am looking at it and can make neither head nor tail of it, as far as I can tell all the components are just listed separately with no indication of how to connect them up. Is this correct? If so, how would I go about connecting them up?

I am doing a GCSE DT project of a sunrise alarm clock, and since I'm very new to electronics (but keen to learn more) this would be a massive help. I intend to use an Arduino-type controller and a breadboard for all the connections, but if I could get to grips with what this schematic is trying to say I'm confident that I could alter the designs to fit my needs.

Thanks for any help or advice.
So, in regards to the schematic, I'm basically using an Arduino UNO, just one I've made myself. In the schematic I've labeled the pins as they are on the UNO (ie. D4, D5, A1, A2 etc.). The schematic shows how to wire the Arduino to the other modules such as the 7 Segement clock display, Real Time Clock (RTC) module, and the WS2812 LED strip (these are basically Adafruits Neopixels). Each of these modules will have pin labels to make clear what to pin goes to it. Do some reading on the pins of the Arduino and interfacing to other modules and this should be fairly evident. Lastly, there is just the push buttons, rotary encoder and potentiometer for controlling the device, just do some research on getting these setup on the Arduino. I believe I liked an article on the rotary encoder.

Overall, there are plenty of guides for beginners out there to use Arduino so I'd recommend doing some research and familiarizing yourself with generally how they work and some simple projects with them. The Arduino community is vast so if you're running into trouble just try googling the problem first someone somewhere likely has a solution.

Hope that helps, best of luck on the project!

will any led strip work( like even the

LED Rope Light Wifi Controller Waterproof RGB Color Changing 16.4ft 150leds SMD 5050 Strip Lights Kit work with Alexa?

These appear to already have a controller with them so to work with this project you would need to do some disassembly to remove the 5050 SMD LEDs and then integrate them into the project. Search 5050 SMD Arduino to find out how to do that

would i just change to 24 to 12 in this code

#define TIME_24_HOUR true

to get to a 12hr format?

will the RTClib.h library work with the DS3231 RTC module, How many ports do you need? (Like the number of each ports), would i just change to 24 to 12 in this code #define TIME_24_HOUR true to get to a 12hr format and will any led strip work ( like even the LED Rope Light Wifi Controller Waterproof RGB Color Changing 16.4ft 150leds SMD 5050 Strip Lights Kit work with Alexa?

what do the Caps, several 1uF, 10uF for LEDs look like and can you plz post a picture of the inside of the trunk so we can see how you have everything hooked up?

Yep, there are some pictures of the board and the wiring in Step 3. The caps can just be ceramic. The 10uF is just to protect any inrush of current from damaging the neopixels.

is the word CAPS just a sortrned word for capasitors?

will the RTClib.h library work with the DS3231 RTC module

How many ports do you need? (Like the number of each ports)?

and is the coding the same if you use just the Arduino?

what does the PCB do, couldn't you get the same using just a Arduino?

Yes, the PCB is Arduino. It has ATMEGA328 microcontroller with Arduino bootloader so its basically an Arduino UNO. You can see how its made here https://www.renaissancemakerlabs.com/2016/11/10/ul...

If you just want to use an Arduino UNO in your design just wire the RTC and 7SEG display to the I2C ports of the UNO.

If anyone is building one just using the Arduino, can they plz record them building it and post it to youtube?

Umm, I like the idea and very nice. I do hobby repair some small of electronics. However, I haven’t got into learning Arduino because I’m not good with programming. Now I wonder my wife and I are deaf we depend of vibration under our bed. The motor vibration runs on 120v hook to our special clock for deaf. I also have other low voltage DC vibration motor could replace it. I really hate special clock designs we have but no choice and it works fine. It has backup 9v battery, large clock push buttons to adjusted clock timer, etc.

Any suggests to add this features what you have this idea.

I like to have 3D printer to make things are very useful designed. But this can wait next year when my budget come along.

Thank-you for sharing it,

John

Deafguy

yes I would also like to find a way to attach a viberator to the back of the clock and when the alarm goes off, it viberates the bed

More Comments