While time is continuous, most clocks display the time in a discrete way; even 'analogue clocks' often move their hands only once a second. In this instructable, I will show how to build a clock that shows the time continuously by smoothly cycling though the light spectrum. To allow for reading the clock with different levels of precision, we make multiple light cubes: one for which a second will have been passed after each cycle, one for a cycle of a minute, one for hour, one for day and one for a week.
Although it might take some time to learn reading this clock, it certainly is a much more colourful way of finding out the current time!
Step 1: Materials
For this light spectrum clock you'll need:
- Arduino (I used a Nano but most will work; the wiring on at least the Nano, Uno and Duemilanove will be the same)
- TLC5940 PWM 16 channel (on ebay for around 1,50 pound or sparkfun for 4 pound each)
- DS1307 Real Time Clock module (sparkfun: 15 dollars) or one with even more precision (this one will be off one minute each week)
- 5 RGB LEDs, common anode (cheap on ebay if you buy a lot; I bought diffuse LEDs, but I don't think it makes a huge difference)
- Empty PCB or breadboard, some resistors (see Electronics), dip sockets, wires, etc.
- Foamboard (white, you won't need a lot) and glue
- Matte drafting film (diffuse foil; you won't need a lot)
- Some wood and nails for the frame
- USB-charger (or power by your computer; the RTC module will keep on counting if you turn off the computer)
If you shop economically, 35 pounds / 55 dollars will certainly be enough for the materials and a beer afterwards.
Step 2: Electronics
The Arduino is the main component of the clock. It will control the LEDs by adjusting the light intensity for each of the three components (red, green, blue) in order to get a certain colour. For example, RGB values (50%, 50%, 0) will let our brain think we see yellow. For this we use the PWM technique, but unfortunately most Arduinos only have 6 PWM outputs. Luckily, you just bought a TLC5940, providing 16 PWM outputs while we need 5 x 3 = 15. The TLC5940 requires two resistors; R1 is a pull-up resistor and has to be high (10kOhm or more), R2 sets the maximum amount of current for all the LEDs (typically around 2kOhm; test with a LED and power source before you start soldering).
To keep the clock counting during powerless moments and to solve both Arduino's internal clock imprecision and (50 days) overflow, the RTC module will work on a cell battery (included by sparkfun) if the Arduino is turned off.
Build the circuit either in breadboard or PCB form, as shown in the images, or open the attached Fritzing file. Be aware that the electronics must fit inside the clock, so keep the whole tight. When you connect the LED wires (don't connect the LEDs yet) to the PCB or breadboard, keep in mind that the LEDs will be at different distances.
Step 3: LED Cubes (inner Frame)
First cut out the bottom and top of the cube row (for me the size had to be 6.5cm by 6cm * 5 cubes + 0.5cm * 6 cube walls), and the six cube walls (6.5 x 6 cm). I used a blade knife to cut alongside a straight piece of wood, which helps getting nice cuts. Glue the cube walls to the bottom. Then glue the top to the cube walls at once.
When the foamboard frame is finished, attach the RGB LEDs to the inside of the frame by pushing them through the foamboard. You can make small incisions to help getting the legs though. At the outside, connect the wires to the right LEDs. Be aware that you attach the wires to the right leg (R, G or B)! It works probably best if you used different colours of wire for the different legs (in a RGBRGB.. pattern) in the last step. Bend the legs towards the foamboard and use some (duct) tape to prevent the legs from touching the circuit later on.
Now cut out two pieces of matte foil that will fit onto the two open sides of the cube row, and glue them to the edges of the foamboard frame. It may be wise to wait with the second one until you tested the software; otherwise it will be hard to replace or adjust the LEDs if necessary.
Step 4: Wooden Frame
Assemble the frame except for the second side. Drill a hole on the spot you want the power cable to enter the clock (I made one at the back, right behind the spot where the Arduino would be, such that it is possible to connect and disconnect the USB cable from the outside even after closing the frame). Push four nails into the bottom of the foamboard frame on a distance from the front and back, equal to the thickness of the wood (see image). Now shove the foamboard frame, including the electronics underneath, in the wooden frame, make sure the electronics will not be able to move, and finish the frame.
Step 5: Software
To set the time on the RTC module, set setDateTime to true and set the current time. Do not forget to disable the boolean again and to upload that version afterwards, otherwise the time will be set each time the Arduino boots.
By default the total intensity of the Light Spectrum Clock will decrease during the evening and get back to full intensity again in the morning. You can change the intensities or disable this function in the settings.
Now connect your clock and upload the sketch.
Step 6: Finishing Up
If you feel like you haven't done enough yet, consider adding buttons to be able to set an alarm (continuous moving through the spectrum by holding the buttons down), to use the clock as a kitchen timer, or even play 1D tetris on your 1x5 LED display. You may also want to paint the wood in some exciting neutral colour.