Introduction: LED Ring Clock With Arduino

Watching pchretien's Fibonacci clock last week, I decided to share my LED ring clock project.

As you can see the time is represented on two WS2812 LED rings.

In the outer ring there are 24 LEDs, it shows the hours from 0 to 24. The different colors don't have any meaning here, only help you to count the illuminated LEDs. 3x6+1=19 o'clock. (6 blue, 6 green, 6 yellow, 1 red)

In the inner ring there are 12 LEDs which shows the minutes from 0 to 60. Decoding the minutes is a bit more difficult than hours. The inner ring represents 60 different values using 12 LEDs. So one LED has to have 5 different state (60/12=5). This different states are represented by different colors.

  • (0, dark turned off)
  • 1, white
  • 2, blue
  • 3, green
  • 4, yellow
  • 5, red

So we are ready now to say when I took the picture. There are two red LEDs: 2x5=10.

The picture was taken at 19:10 o'clock.

Watching the video you can see a bright pixel which goes round on the outer ring. It represents the seconds. Dividing the 60 seconds by 24 LEDs equals 2.5 seconds. So if you want, you can calculate the seconds also, but they are much faster than me. I use the seconds only as visual effects.

In the center of the rings there are a light depending resistor. Its resistance depends on the luminosity of the surroundings. Reading the change of the luminosity the brightness of the LEDs can be modified.

In the next step I will show you what kind of materials you need and how to build the hardware.

Step 1: Materials You Need

I used the next things:

  1. Arduino NANO (clone)
  2. DS3231 real time clock
  3. WS2812, 12 bit LED ring
  4. WS2812, 24 bit LED ring
  5. 9V power supply
  6. Light Depending Resistor 5k-500k
  7. 10 kOhm resistor
  8. LM7805 5V power regulator
  9. prototype PCB (about 10x8 cm), or breadboard
  10. power socket, or this
  11. single row female header (if you don't want to solder your NANO or RTC)
  12. some wires

According the picture and the circuit diagram you can build the circuit.

If you only want to see the LEDs, you can build the circuit on an other PCB and connect them by some cables.

Because of the high current consumption of the two LED rings, I don't suggest to feed them by power and ground from the Arduino NANO. As you can see I connected them directly to the GND and the 5V output of the 5V power regulator.

If you want, you can skip the power regulator. This way you have to feed the circuit by 5V. Using this 5V regulator I can feed the circuit by a common 5V supply (or a USB power bank), by a 9V or a 12 V supply through the power socket. If you supply a NANO through its Vin, the recommended supply is between 7V and 12V.

As you can see I use an LDR to measure the luminosity. It changes its resistance between 5k and 500k Ohm depending on the light. It is connected in series by a 10k resistor into a voltage divider. The change of the luminosity modifies the ratio of the resistances, which varies output voltage of the voltage divider. Measuring this output voltage the luminosity of the LEDs can be adapted by the program to the luminosity of the surroundings.

As you can see in the diagram both LED rings are connected to the D9 output pin and the rings are joined together by their output and input. That way you can handle them as a 36 (24+12) long strip. Pay attention to the order. I connected the outer ring's input to the D9 of the NANO and outer ring's output to the inner ring's input. So the addresses of the outer ring's LEDs are from 0 to 23 and in the inner ring are from 24 to 35.

In the next step I will show you the Arduino sketch.

Step 2: Arduino Sketch

If you connected everything according to the shared diagram, uploading the attached sketch your clock will start and show the time which is set in your RTC.

Some explanations to the sketch

byte mem_r[36], mem_g[36], mem_b[36];

I don't write the calculated color and intensity values directly into the LEDs memory. I store calculated RGB values in this three arrays. The cause of that is the next: I can not read this info back from the LEDs so I can not change their intensity keeping the original color.

byte color_r[] = {0, 10, 0, 0, 10, 10, 5};
byte color_g[] = {0, 10, 0, 10, 10, 0, 5};
byte color_b[] = {0, 10, 10, 0, 0, 0, 5};

I use this three arrays to define the colors of my clock. If you would like to change my colors, you need only modify this values.

void readIntensity() {...

The sketch reads the luminosity of the surroundings through the A0 pin. You may have to change the measure limits and the corresponding intensity values if you use different LDR and resistor in the voltage divider.

void sw_ver(byte ver) {

After restart you can read the software version from the LEDs. It can be a useful function if you would like to identify the running version.

Setting the time and the date

If you would like to set the date and the time in your RTC, you have to remove the comment signs from this line.

// setDS3231time(00,58,18,4,31,03,16);

After that update the time and the date, upload the sketch to your Arduino, and restart at the correct time.

(Then comment this line, and upload the commented version to avoid time reset at each restart.)

Step 3: Further Possibilities

  • Add a nice frame to your clock as my daughter did.
  • Add further LEDs to your clock to show the date, month, year and the day of week.
  • Calculate and set daylight saving automatically.