Introduction: LED Clock Using Neopixels

About: I love making things. I have for as long as I can remember liked to make stuff. Now days I have two kids (Thomas and Emma) and most of the things I do are safe for them! I love electronics and Microchips, I ha…

Welcome to my instructable on how to make a LED clock using 60 Neopixels.

You will find 3 PDF's attached one is for the segments of the clock, another is for the base and lastly one is a template to assist with gluing the sections together.

So to complete this you will need the following

  • Ring of 60 neopixels comes in 4 quarters. search for "ws2812 ring 60" (£12.00)
  • RTC search for "DS3231 module" (£2.50)
  • Arduino Nano (£4)
  • 3mm/1/8" plywood.
  • pieces of wire. hopefully you will have some around?
  • 5v USB power supply unit. The type your kids will have destroyed the connector on.

Below are the Lipo battery powered items but after testing, the clock consumed too much power so the battery was dropped in favour of a mains USB PSU.

  • dc-dc converter search "boost converter" (£3)
  • Charging circuit TP4056 search "tp4056" (£2)
  • LiPo 1000Mah single cell. search for "1000mah lipo 3.7" OR "503450 lipo" (£8.00)

The LiPo number is 503450 and it might be nice to know that this means 50mm long 34mm wide and 5.0 deep.

Step 1: The Wood Bits

You should be able to see in the pictures that i have printed out the design and stuck it too the plywood. What might not be obvious is i have cut out 3 sections at once and the bottom section is cut out firstly around the perimeter, then one section is removed (from the back) then the hole was cut out in the remaining two sections then another section removed leaving just the front bit remaining then the slot for the wires was cut.

When all the bits have been cut out you should firstly check how they all fit together then glue them all . i built up the 3 layers on top of a plan of the clock to make sure everything was correctly circular. Also make sure you get the bottom bits in the correct orientation and the complete middle slice is mounted upside down so you lap over the joints.

The holes in the front sections allow for the soldered joints in the quarters to sit in. and the lower section allows for the wires to pass through.

The series of pictures also show how the base is put together.

Step 2: Wiring the LED Ring.

Not a lot to say about this step, but just in case you haven't used a strip of WS2812LED's they are intelligent so each one has a data in and out. In the arcs of 15 LED's the PCB handles all the connections but when you come to join the sections you have to make the power connections and the data. You cant get the connections wrong because they are in a circle however when you have finished the circle you should have one link missing on the data IN/OUT to allow you to connect the wires to the data IN. Where the wires connect to the data IN will be the first LED or as it is correctly numbered ZERO.

I wondered how was the best way to fix the ring of LED's to the wood ring? but in the end i decided to use looming cord and loom around the circumference skipping an LED's each time.

Step 3: Wiring the Arduino Nano and Power

I initially decided to use a LiPo on this project but when i tried it out the battery drained overnight. At first i thought the battery might have been duff so i measured the current and discovered the circuit was drawing 73mA which means at the battery it was going to be more. In fact i measured the current at the battery (before the boost converter) and discovered it to be over 110mA. So it was apparent that this clock wasn't going to run on a battery.

So instead i choose to use a 5V USB charger. I tend to have loads of dead USB chargers around due to the connectors getting abuse from two small kids.

So because we are using WS2812 LED's we only have 3 connections to the Arduino Nano.

  • Power
  • Ground
  • Data IN. Orange to D2 on Nano

Next we have the RTC this only has 4 wires.

  • Power 5 Volts
  • Ground
  • SCL (I2C Clock) Blue to A5 on Nano
  • SDA (I2C Data) Yellow to A4 on Nano

Lastly we need power and this goes to the power 5 V terminal on the Nano.. the Vin is designed to have a voltage larger than 5 volts (i.e 7-12 Volts) and the ground.

Step 4: The Program

I really enjoy programming, i'm just not very good at it.

Problem 1

The seconds and minutes are correctly presented as a number from 0-59. However the first LED and hence the zero is at the bottom. So this needed to be corrected.

void correctPos(int A)
{
  if (A < 31)
  {
     A = A + 29;
  }
  else
  {
    if (A > 30)
    {
      A = A - 31;
    }
  }
  temp = A;
}

Problem 2

I tried to clear all the LED's before displaying the new position however this caused the LED's to blink. So i decided to set the next LED on and then turn off the previous. This worked just fine?? NOPE because if the new position was zero the it would try and turn off -1. so that was dealt with at the same time.

void deletePrevious(int B)
//delete the previous led, if it was zero then
//turn off 59 else just subtract 1
//and turn that one off.
{
  if (B == 0)
  {
    strip.setPixelColor(59,0,0,0);// All off
  }
  else
  {
    strip.setPixelColor(B - 1,0,0,0);//all off
  }
}

Problem 3

Doing the above worked really well until the new second position was in the place of the old minute. Which meant that the minute which was updated after the seconds turned it off! Same for the hour/minute as well

  if (secs == mins-1)
  {
    strip.setPixelColor(mins-1,0,30,0);
  }

Problem 4

Things are starting to look good so let's mix the colours when they fall in the same position?

  if (mins == secs)
  {
    strip.setPixelColor(mins,15,13,0);//green and red to make yellow.
  }

Problem 5

The hours starts as 24 hours format. so this needs correcting first

  if (hours > 12)
  {
    hours = hours -12;
  }

Problem 6

And lets not forget there are 24 hours in a day and i have 60 LED's. Easy really times it by 5

  hours = hours * 5;  

Problem 7

Having done the above we now have the hour jumping 4 LED's it would look a lot better if it used all the LED's and correctly showed fractions of an hour? Again this was an easy fix i just added the original minutes number divided by 12 to the hours.

  hours = hours + (addMin/12);

Problem 8

When the hour or minute led is at the bottom the seconds disappears for one second before.

  hours =   if (mins == 0)
  {
    if (secs == 59)
    {
      strip.setPixelColor(59,0,30,0);//green
    }
  }
  if (hours == 0)
  {
    if (secs == 59)
    {
      strip.setPixelColor(59,0,30,0);//green
    }
  }

Problem 9

Setting the time. I decided to keep this build very simple so didn't include buttons to adjust the time. So it's just a matter of connecting the clock to your computer and loading a new time. Simply uncomment the section below and set your required time then load the program. Once correct re-comment the line and resend the program, else if you lose power it will rerun the setup and load the old time again.

  // April 12, 2020 at 11:20pm you would call:
  //rtc.adjust(DateTime(2020, 4, 12, 23, 20, 0));
Clocks Contest

Participated in the
Clocks Contest