Star Clock: Ikea Design, Arduino technology

IKEA’s Figgjo, is designed to be a mirror, but with a little ‘electronic can becomes fascinating light equipped wall clock.

It’s a round mirror, from which twelve evenly spaced rays and this makes it perfect for a clock base.

The twelve rays with small round mirrors will be our hours, while the circumference of our mirror will be tracking seconds and minutes, thanks to colored LEDs lighted up as a continuous strip and as a single element (respectively for seconds and minutes).

Strips and LED

We will use LED strips based on HL1606 controller, with two type 5050 RGB SMDs each chip and 32 LEDs per meter. The 30 LEDs strip is less than one meter: you can “roll” it on a circumference of about 30 cm in diameter that can be hidden behind the mirror.

We will only use 30 LEDs to indicate the minutes and seconds, using points and lines to differentiate. We’ll be leaving the colours to be randomly generated.

The RTC shield

There are various ways to create an Arduino based clock: the most simple is using the RTCSHIELD. This is based on Maxim-Dallas DS1307, which is a Real Time Clock capable of freeing the CPU from keeping up with time management. Information about time and date are transferred to the Arduino microcontroller via the I²C-bus.

The bus is attachd to pins numbered 5 (SDA) and 6 (SCL) that match with Arduino’s SCL and SDA pins (UnoRev3 and MegaRev3), which acts as a master unit of the I²C bus, while the DS1307 is the slave.

In previous Arduino versions (such as UnoRev2 or Arduino2009), the SCL and SDA signals are available on pins A4 and A5, to make the shield also compatible with these versions, there’s some soldering toyou’ll need to do.

The project takes shape

Let’s summarize: we need an IKEA Figgjo mirror, one meter of a RGB LED smart strip with 30 LEDs – that will be driven thanks to three SPI data lines – a RTC shield that takes care of time to be driven thanks I²C, and a dozen LED to mark the hours by illuminating each of the twelve small mirrors.

To keep it simple, we will not do any multiplexing: hours LEDs will be connected directly to the Arduino’s pins ranging ftom D2 to D9, then we’ll be using four pins that are usually dedicated analog input (A0 to A3); those will be reconfigured as digital outputs through pinMode command.

To drive the LED strip with SPI we’ll use pins D10, D11 and D12.

The LEDs in charge of showing the hours have the cathode to ground and the anode connected to an Arduino pin as follows:

D2 = h 1

D3 = h 2

D4 = h 3

D5 = h 4

D6 = h 5

D7 = h 6

D8 = h 7

D9 = h 8

A0 = h 9

A1 = h 10

A2 = h 11

A3 = h 12

In theory we have to carry two wires for each LED, and remind also to insert a current limiting resistor, but Figgjo’s structure comes handy in this case. As the structure is conductive, we can use it as a mass and bring only one wire to the LEDs, since the cathode can be welded directly to the structure itself.

From the LED strip instead we have five wires as per the following:

L in

C in

D in

S in

Gnd

Observing the strip will also notice the presence of a sixth connection, +5V, to which, however, a supply wire is soldered to an outlet of round type, with central positive.

These strips have their own connection mode: the output from the previous LED block of two LEDs overlooks each pitch and in case the strip is cut from a longer piece, Arduino must be connected to the pins marked with the “I” (inputs) while the pins marked with “O” are the outputs.

Each chip acts as a shift register that sends the data in its memory to the following, every time it receives new. The clock signal manages the transfers timing, while the pin which is not connected with “S” shall be used as a step signal to activate the fade in and fade out modes provided by the HL 1606 chip. This is based on PWM, where for each impulse on S there is an increase or decrease of the intensity with which the PWM which enables the LED. This system allows for the synchronization of the shades over the entire strip in a definite and repeatable fashion, but makes programming of the strip itself a bit more complex.

A wiring

As we have seen thus far, apart from the RTC shield, the rest of the composition is based on wires and connections. We wanted to propose an assembly based on the direct connection of the resistors to the insulated wire that leads to each LED, while the other end can be inserted directly into the pinstrip hole corresponding to the signal to be used.

From the picture you can see how practical and fast this is. Note that to be able to solder the cathode behind each mirror you need to scratch the surface to remove anti rust powder and epoxy resin.

The current limiting resistor refers to blue LEDs; to limit the current to approximately 15 mA, given the 5V supplied from Arduino, a 82 ohms resistor is to be used. If you use LEDs of other colors, remember to recalculate it not to exceed the 15 mA current.

Now that the 12 LED for the hours are connected, we can proceed with the wiring of the LED strip, already cut to length.

The positive of the 5V supplied to the circuit, is also to be sent to the Arduino using a piece of insulated wire which starts from the round socket strip LED (central pin, which corresponds to the positive) and arrives to Arduino’s pinstrip (via the RTC SHIELD) in correspondence of the 5V pin (between GND and 3.3 V). In this case, you’re feeding the microcontroller directly, bypassing the voltage regulators, so pay attention to the power supply you choose.

From a conceptual point of view, the program that drives our watch should do very little: to acquire hours, minutes and seconds from the RTC minutes, then divide minutes and seconds by two, and go for visualization.

Visualizing hours means turning the corresponding LED on; the strip turns on gradually to show seconds, while for minutes you turn on a single LED superimposed to the latter, if necessary.

Most of the complexity is in the reading RTC via I2C and in writing data on the LED strip according to the SPI protocol.

Fortunately we are dedicated libraries that almost completely solve both the problems.

The first, called RTClib.h, is dedicated to the RTC. It can be downloaded from this link (note that this is a slightly modified version of the library originally developed by Adafruit).

Thanks to the RTClib all becomes very simple: once you create the clock instance (“RTC_DS1307 RTC”) you can obtain the data thanks to the command “DateTime now = RTC.now()”

With “now.hours”, “now.minutes” and “now.seconds” we directly obtain values for processing, while the special routine using “RTC.isrunning” is key to see if you need to adjust the time.

If the RTC has not yet been set with the “adjust” command, the “IsRunning” returns false (the library reads the “Clock Halt” / 7th bit of the 0x00 register on the DS1307): this leds to the if cycle that uses the compilation timestamp to write the corresponding numeric values – replaced by the IDE at labels compiling time – on the RTC chip as starting values.

With this arrangement, we will have a clock setting very close to that of the host computer on which runs the IDE.

Regarding the strip, we use the HL1606strip.h library, available on http://code.google.com/p /Ledstrip where you just define the pins connected to the Arduino and the number of active LEDs in the strip. The setLEDcolor(position, color) method allows you to define the color of each LED among the eight colors available (black, white, red, yellow, green, blue and purple); writing each LED color and transmitting the info to the strip are two separate functions by the way. Thanks to this, the software can be set to define the color of each LED and then displaying it in different moments.

Categories

Sponsors

http://www.open-electronics.org/contacts/

About us

Open Source Electronicsis the brainchild of a world leader in hobby electronics Futura Group srl.Open Source Electronics is devoted to support development, hacking and playing with electronics: we share exciting open projects and create amazing products!

Open Source Electronics is not just a container of ideas: it is also a web site lead by a team of engineers and geeks who will take part in the discussions and give support.

Our mission is to become a reference Open Source hacking site with ideas and feedback aimed to enrich the community.