Introduction: 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
- Basswood Trunk Box
- Arduino UNO or bare bones equivalent
- LM7805 5V Linear Regulator
- Caps, several 1uF, 10uF for LEDs.
- Real Time Clock (RTC) module
- 7 Segment LED Clock Display
- Rotary Encoder
- Knobs for pot and encoder. I used some guitar knobs I had lying around
- Momentary Pushbutton switch with LED
- Acrylic rods (6x 10mm dia. 250mm long)
- 8x WS2812B RGB LEDs
- M3 screw standoffs and nuts
- Mini magnets
- PCB or prototype board + wires
- Wood stain of desired color
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!
We have a be nice policy.
Please be positive and constructive.
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.
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.
can you plz provide me the link to the PCB that you used, I really like that design
You bet. I've updated the Instructable and include the gerbers and the DipTrace file for the board layout in the Step 3.
what can I use to make the holder if I don't have access to a 3D printer?
You don't really need the holder, just carefully drill holes in the top of the box. Use a bit slightly smaller than the acrylic rods to keep them snug. I only used it because I split the wood when drilling the mounting holes for the acrylic rods and wanted to cover it up. If you drill the holes carefully in the wood and from the outside in it should be fine.
is there a video on putting it all together?
Sorry don't have one
can you send me a link to the design software you used?
can you send me the shcamtic to import to EDA plz and thank you
Hey, yep the schematic download link is in the Instructable
and I want to put a socket for a bed viberator on there, how would I do it? would I have to hook the motor to power and how would I code it so that it activates the viberator when the alarm goes off in the morning?
can you make it without the magnet?
Absolutely. The magnet only serves to keep the lid down more securely.