Introduction: Wake Up to Dawn Light in Your Window All Year Long

Recently a friend mentioned that he loves summer because he's awakened by the dawn. But much of the year he misses that, because the alarm clock goes off too early. Waking at regular times to pleasant, well-timed light is one of the nicest routes to refreshing sleep, and too seldom attained.

A lot of people have trouble getting up early in the morning, and then equal difficulty falling asleep at night. This may be most frequent towards the end of daylight savings time in the US, but so-called delayed sleep phase syndrome, social jet lag, and seasonal affective disorder are common problems well into Spring. Properly-timed light on awakening can make a big difference with all of them.

A slew of gadgets already exist to provide morning and evening light, but none resemble that wonderful rising sunlight streaming in. Here is a simple, safe circuit that can put dawn (or sunset) back into your window. The light will gradually intensify through a range of 4000 to 1. You will need to use elementary Arduino; plug one electronic part onto a breadboard; and do a bit of wiring, soldering, and gluing. There are two versions:

Version (1) has the absolute minimum assembly, but uses an external AC timer to turn everything on and off. Version (2) goes full Arduino with an internal clock and allows a more compact and attractive setup, which does not have to be reset after a power failure. But it does have to be reconnected to the computer to change the start time. The total cost is about the same. [Update to Version (2), 02/03/2019. Two more parts have been added to deal with the likely cause for the early demise of my first real time clock module. A few unnecessary lines have been deleted from the V1 and V2 sketch.]

Disclaimer: It’s hard to hurt yourself or your property with commercial 12 volt power sources, LED strips, and Arduinos. But I take no responsibility whatsoever if you manage to do so.

Step 1: Version 1: Parts

-Arduino – Adafruit ItsyBitsy 32u4 5V: .............Adafruit or Digikey 1528-2501-ND $9.95

-In-line power switch for 2.1mm barrel jack: ....Adafruit or Digikey 1568-1417-ND $2.50

-Switching power MOSFET: ...................................Adafruit or Digikey IRLB8721 $1.75/$1.05

-Breadboard: any that fits. See the instructions for details.

-A bit of solid insulated hookup wire, around 22G, that fits in the breadboard. Colors may help keep things straight..

-shrink wrap or insulating tape

-Simple 120 volt timer from any hardware store

*/ Convenient Kits include a 12V DC power supply plus a 12V, 5 meter LED strip.

I used the Ustellar Dimmable 600 LED Light Strip Kit with Power Supply, SMD 2835 LEDs, Super Bright 16.4ft/5m 12V 3000K Warm White: ....................................Amazon $16.99

You can easily find other 12-volt power supplies, 12-volt LED strips, and panels in different color temperatures. \*

Optional:

------ single spare LED

------ Box of choice, preferably not metal or cardboard.

Tools: soldering iron, small nose pliers, wire stripper/cutter, drill, hot melt glue gun, electrical multimeter if available.

--wiring schematic and layout: below

--Arduino sketch: download further below

Step 2: Assembly

A. If you purchased the kit, put together your string of LEDs, power supply, and extra dimmer, and check that they all work before you do anything else.

B. Set up and test the Arduino and Arduino Dawn_LED_V1 sketch per the Adafruit instructions. You are only going to use 3 of the Arduino’s pins (9, G, and BAT), but will need to solder on more pins simply to keep everything mechanically stable on the breadboard. Once you have the introductory Blink program running per the Adafruit instructions, download the Dawn LED V1 routine into a new sketch, verify it, and run it. If you have a spare LED, plug it opposite the G and 9 pins of the Arduino, with the + lead adjacent to 9. The LED should brighten slowly. Unplug the Arduino within 10-15 seconds so the LED doesn’t burn out, and remove the LED.

C. Assemble the Dawn Circuit. If you have some experience, you can probably do this quickly on your own. Otherwise:

- Leave extra rows on the breadboard if you might possibly some day add a clock board. Side rails on the breadboard are not necessary. I left one to help anchor the power connections, as in the Figure.

- Cut the male and female barrel connectors off the switch (Not the dimmer, which you can save for another day), leaving leads attached to the connectors around 3 inches long. Strip off the last ¼ inch of insulation on the wires. The red wires should be attached to the inner part of the connectors, and the white ones to the outer shell of the connectors. Solder the wires together according to the wiring diagram. Plug the power supply into the female connector of your wiring network, and use your multimeter to make sure the proper voltages are present at the points connected to the power leads. Solder short insulated hookup wires at these junctions, to make better connection to the breadboard. Cover the solder junctions with tape or shrink wrap.

- According to the figure, plug the MOSFET into the location indicated. Make sure the MOSFET is oriented according to the outline.

-Run hookup wires from holes in the breadboard next to pins 9, G, and BAT on the Arduino, to the corresponding locations next to the MOSFET. (Note that G on the MOSFET stands for Gate, while G on the Arduino is for Ground.) Making sure you have the correct wires and locations, plug the power and LED strip wires deeply and firmly into the breadboard as shown. Once they are OK, hot melt glue is a good way to hold the leads in place. (Do not use other glues. They can flow down into the holes in the breadboard.)

When everything looks good, reinsert the spare LED as you did previously, and connect the power supply only. The LED should brighten as before. Now try it with the LED strip lights. They should start to do the same over a minute, stay on another minute, and then fade out. If anything else happens, immediately unplug and troubleshoot.

If everything works, you can now change the values of “fadeonMin” “waitMin” and “fadeoffMin” in the Dawn_LED V1 sketch to their final values. Reasonable initial dawn settings are 45-60, 30, and 5 respectively. Put the circuit in the box.

Step 3: Version 2 - With Real-Time Clock Module

Additional Parts:

- DS1307 real time clock module………………………………………………………………… Adafruit $7.50

- CR1220 3V lithium coin battery ………………………………………………………………… Adafruit $.95

- ceramic capacitor, 0.05 - 0.1 uF, any voltage ≥ 10

- electrolytic capacitor, 5 - 47 uF, any voltage ≥ 10

- more hookup wire

You should previously have assembled and tested Version (1), without the clock, because the LED system is a lot easier to test and troubleshoot without the clock section. Now wire up the clock module according to the second diagram. Run the 5V and G wires from the other side of the Arduino, as shown, to help reduce glitches from switching transients coming off the MOSFET and LEDs. To obliterate these potentially damaging transients more thoroughly, put the two decoupling capacitors up against the G and Vcc pins of the clock. The “–“ side of the electrolytic capacitor goes to the G pin. Connect the other wires from SCL to SCL and SDA to SDA. Put the battery in the clock module, making sure the battery + sign is up.

Follow the Adafruit instructions to install the Wiring and RTClib.h Libraries. Make sure the clock on your computer is correct, run the ds1307 program per the Adafruit instructions to reset the clock, and then open the serial monitor to check that your clock board now reads the correct time as well.

Now load the Dawn LED Clock sketch. Possible test settings for setHour, setMinute, fadeonMin, waitMin, and fadeoffMin are near the top of the sketch. To test the timing, set the hour (mandatory 24 hour clock) and minute to a minute or two in the future, upload the sketch, and run the program. You can use the serial monitor to see the hour and minute print out every 20 seconds, followed by a message “time to begin!” If everything works, add all your final settings to the sketch and upload it again.

The less expensive clock listed here has a possible drift of up to 2 seconds a day, or 6 minutes in 6 months. By then, wherever you live, it should be Spring.

Step 4: Final Hookup

Attach the LED strip around the inside of your window frame.
Instead of cutting and splicing the LED strip I just curved mine at the corners. Since many different LED strips and panels use the same barrel connectors and polarity, it’s easy to switch them out. As the start time may be the setting people change most often, it’s convenient to do that externally with the hardware light timer. The Arduino sketch requires that the power must go off and back on before the routine will restart. I set the external light timer to turn off after the full LED cycle is finished. Whenever you want to change the cycle timing, just reconnect it to the computer and reprogram.

May you sleep well and awaken in the light!

Step 5: Notes

1. Long before civilization, the clock in our heads that synchronizes waking and sleeping was set by the rising and setting of the sun, and anchored by high noon. But nowadays our time zones and “daylight savings time” can put clock time and solar time out of sync. The universal presence of bright artificial light (plus working on computers) long after sunset confuses our brains even more. The clock on the wall says midnight; the one in our heads may think it’s only 9 PM. No wonder we can’t fall asleep.

This problem, which is a form of jet lag you can get without leaving home, is labeled variously as “delayed sleep phase syndrome” and “social jet lag.” It especially afflicts high school and college students -- but there are many other sufferers. (Don’t even get started on the poor folks in China, a country with only one time zone.)

2. Because human perception of brightness, like many sensory systems, tends to operate on a logarithmic scale, the output current is set to increase on an elapsed time^4 rather than linear count. This will seem a lot more natural. The logarithmic sensory curve is also the reason that a PWM resolution of 4096 is needed at the low end.

Dawn tends towards a red rather than blue tinge; Thus the 3000K LED color temperature in the list of parts. But choose whatever you like.

3. Incidentally, if you happen to live in a cave, a submarine, or northern Alaska, this circuit is versatile and powerful enough to light several entire rooms through a full daytime cycle. In that case it will need sturdier wiring, soldered connections, and a heat sink for the MOSFET.