loading

I'm a big fan of RGB leds and Arduino, and after using them in several other projects, I decided to make a Wakeup Light for the bedroom of my two youngest children. Because my children are awake (waaaay too) early every morning, they are allowed to get up only if the Wakeup Lights are on.

I used an RGB led strip, which I sticked behind my children's bunk bed. The led strip is controlled by an Arduino Mega, which has enough pins and memory to control an LCD shield with buttons and an RTC (real time clock) as well. I 3D printed a nice enclosure for all the hardware and used thin cable trays to safely tuck away all the cables.

The LCD shield displays the current time and the alarm time, if set. With the buttons on the LCD shield, I can set the current time, set the alarm, set the color of the led lights (an 'animated' rainbow effect or just one static color) and set the LCD's backlight "always-on" or "auto-off after 10 seconds".

When the alarm goes off, the led strip slowly fades in with my (everyone's?) daughter's favorite color: pink!

Step 1: Parts and Tools You Need

Parts

  • Arduino Mega (I bought this cheap clone)
  • Arduino LCD / keypad shield
  • DS3231 RTC (real time clock)
  • RGB led strip pack, including power adapter. I recommend an Adafruit NeoPixel strip, which has is own Arduino library, so it's fully supported. I bought this one at a German Aldi store, which uses a different Arduino library.
  • Jumper wires (female - female and male - female)
  • Long strands of wire, depending on how far apart the enclosure and the led strip are going to be.
  • Pin headers
  • Optional: cable tray to tuck away the cables between the Arduino and the led strip.

Tools

  • Soldering iron
  • Wire stripper
  • Optional: 3D printer to print the enclosure

Step 2: 3D Print the Enclosure (optional)

Of course, an enclosure isn't necessary to make the Wakeup Light work.
But since it's going te be attached to the side of my children's bed, it's safer to have something which protects the electronics.

I searched Thingiverse for an enclosure that would fit and Arduino Mega with an LCD shield on top and I found the perfect object: the "Mmintbox". It also leaves room for the RTC!

The buttons need to be flexible, so I that part was printed in biorubber - thanks again, André :-). For the rest of the case I used black PETG.

Step 3: Add the RTC

You only have to use the following 4 pins of the DS3231 RTC: SDA, SCL, VCC and GND.

  • The SDA and SCL pins connect to the same pins on the Arduino. On an Arduino Mega, SDA is pin #20 and SCL is pin #21.
  • VCC connects to the 5V pin on the Arduino and GND connects to GND, obviously. The Arduino Mega has multiple GND pins, but it's the most convenient to use the pin next to the 5V pin.

In my case, I had to solder pin headers to SCL and SDA on the RTC and pin headers to 5V and GND on the LCD shield. Because the Vout pin and the second GND pin next to Vout are used for the leds (I'll get to that in step 4), I soldered a strip of 4 headers to 5V-GND-GND-Vout on the LCD shield. I connected the pins with female jumper wires.

Note that the 4 pin headers I soldered on the LCD shield are pointing downwards. If you point the upwards (to connect the cables on the top of the shield), the cable will not fit in the enclosure!

Step 4: Connect the LED Strip

Like I said before in the introduction of this Instructable, I used a slight uncommon led strip. It's a bit different from the widely used Neopixel strips, but it had the same 4 connections: DI, GND, GND and VCC.

VCC and the two GND connections are for powering the strip, DI is for the signal that sets the color.

Important: if your led strip connections are marked VCC, R, G and B, you have a fundamental different strip and the Arduino code I provide in step 6 will not work. Unfortunately, I'll have to let you work out for yourself how to use these kinds of led strips.

Because I didn't know the exact distance between the enclosure and the led strip when they were mounted on the side of the bed, I used 4 long (~ 1 meter) strands of wire to connect the led strip to the Arduino.

  • VCC and the GND connection next to it are connected to the Vout and GND pins I soldered on the LCD shield.
  • DI is connected to pin #36 on the Arduino Mega.
  • GND (next to DI) is connected to GND on the lower right side of the Arduino.

I had to solder some pins (male and female) to the end of the 4 wires to be able to connect everything.

Step 5: Power

The Arduino only "delivers" 5 volts. Exacly the right amount for the RTC, but not for the led strip. The led strip needs 12 volts to operate...

Luckily for three things:

  • My led strip came with a 12 volt adapter which has a connection that fits perfectly into the power connector of the Arduino Mega.
  • The Arduino Mega has a voltage regulator, which limits the incoming voltage to all pins to 5 volts...
  • ...except the Vout pin, which has the same amount of volts as the power source connected to the power connector.

I guess it's just a coincidence I own the right power adapter. If you're not that lucky, you have to buy one which fits.

Step 6: The Code for the Arduino

You can download the code right here.

Before uploading the code for the first time, make sure you uncomment lines 67-69 and set the right values for the date and time. After that, comment out these lines again and upload the sketch a second time. This is to prevent that the hardcoded time is set every time the Arduino restarts.

Out of the box, the text on the LCD screen is in Dutch. For English speaking people, you can find a translation at the end of every line with dutch text.

Step 7: A Short User's Manual

When you power on the Wakeup Light, the led strip starts swirling colors, while you can read the current time on the display.

To toggle the led lights and LCD backlight on/off: press up, down, left or right on the key pad.

To enter the menu, press select. Now you can use up/down to select one of the following menu items:

  • Set alarm
  • Set time
  • Set color
  • Set backlight
  • Back to time display

Press select to enter a submenu.

When you set the alarm, the backlight of the LCD and the lights of the ledstrip are turned off automatically. When the alarm goes off, the backlight turns on and the strip slowly lights up in pink. The led strip starts swirling rainbow colors again when the pink color is at it's full brightness,

In this version of the Arduino sketch, this color can only be changed by changing the code; there's no menu option (yet).

Step 8: Final Words

This is not the first time I used an Arduino and led lights to create something, but it's the first time I created an Instructable. I hope you enjoyed it.

You're welcome to ask questions or give advice!

<p>Hi, great tutorial and my first ever off instructables.</p><p>I seem to have a small problem though. When I press SELECT to enter the menu, it just turns my LCD backlight off (as do all the other buttons).</p><p>Any ideas?</p><p>I seem to have a small problem though. When I press SELECT </p>
<p>Hi, thanks!</p><p>For the up, down, left and right buttons, it's normal to turn the lcd backlight (and the leds) off. It's a feature, actually :-) Because the backlight is quite bright, I built that in so it stays dark in the room when the kids are sleeping.</p><p>It's strange, though, that the select button does the same. Normally, when pushing select, it should enter the menu </p><p>One thing I can think of: you might have a different lcd/button shield, which sends different values to the Arduino when pushing a button. You can find the values of my shield in the readLCDButtons() function (line 522) in the sketch. Maybe you can write a sketch which reads these values from your shield.</p><p>Another idea: the buttons I 3D printed are not *exactly* above the LCD shield buttons. Maybe your 3D printed Select button touches the shield's Left button?</p>
Thanks for the reply.<br><br>I am using the same shield as you did in the tutorial.<br><br>I don't yet have it in a 3D printed case as i wanted to check it worked properly first. I think it maybe the shield :( as I used a different sketch to read the values and the only key that registered returned a value of 5. This in itself i find strange though as when your sketch is run, it is picking up the button presses by turning the backlight off and on.<br><br>I will have a look at it again, I may well be missing something.<br><br>Still a great Instructable though :D
<p>Maybe you can try the alternative values in the sample code found here:</p><p><a>https://www.dfrobot.com/wiki/index.php/Arduino_LCD...</a></p><p>(That's where I got the button code from)</p>
<p>Cool job Ralph. </p><p>Another Project done good. </p><p>BTW your welcome for the bio rubber parts :)</p>
Ha! You found yourself! :-)
<p>Great Ralph!</p>
<p>Thanks Arjan!</p>

About This Instructable

6,390views

85favorites

License:

Bio: Wiskunde- en Informaticadocent, knopjesfreak, bevlogen gebruiker van Linux, Arduino en Hela Curry Gew&uuml;rz Kruidenketchup. Bezig met MakerKlas.nl
More by RalphCrutzen:Arduino Wakeup Lights 
Add instructable to: