Introduction: 132 Pixel Clock

I have, for as long as I can remember been obsessed by LEDs and time. In this project I have created a large wall clock that displays the current time using 132 neopixel LEDs mounted and shining through a spruce board. Its a hybrid analog digital with an Individual pixel for each hour, minute and second.

This was the largest project I have taken on to date, I started thinking about it 6 months ago and the idea slowly came together. I am really happy with the outcome and I'm looking forward to sharing it with you.

Step 1: Gathering Supplies and Tools.

Components.

This project is built on a cheep hobby board from my local DIY store. The board measure 850mm wide by 500mm high and 18mm deep.

The LEDs used in this project are 5050 WS2812b mounted on circular PCBs that are approximately 9mm in diameter with solder pads on the rear.

I am using an Arduino Pro Mini compatible micro controller. Its the 5V 16 MHZ version. I chose this one as it has a super slim design, small foot print and all the nessary ports plus some spare for future upgrades. Its also 5 volt so I can use a single power supply for the LEDs, Micro controller and RTC

The time keeping is taken care of by an RTC (Real Time Clock) module that features the DS3231 chip. This chip is very accurate so the time shouldn't drift too much.

Also used:

Wire. Solder and hot glue.

Tools:

Power drill and wood drill bits (10mm and 5mm)

Soldering iron

Hot glue gun

wire snipps

Dremel and plunge router accessories

Step 2: Marking, Drilling and Routing

Drilling

  • Using a strait edge find the centre of the board by drawing a line from opposite corners.
  • Mark 3 circles using a piece of string and a pen. The outer most circle should be about 20mm from the edge of the board with the other 2 lines moving in by 15mm from the last line.
  • I used a printed clock face to help me mark out the positions of each of the minutes and seconds on the outer 2 lines and hours on the inner line.
  • Drill 10mm holes approximately 5mm deep for every hour, minute and second.
  • Use the 5mm drill to make holes though the board for hour, minute and second.

Routing

Although this step is not necessary it will allow for the clock to be fitted flush to a wall.

  • Using a router and circle guide route wire channels in the board
  • Mark out and route a recess for the RTC and Micro Controller to live in.
  • Route a channel from the outer lines to the recess for wires

Step 3: So Much Soldiering, Cutting and Stripping.

This next part is much easer to say than to do. My advice would be note to rush it. try and find a system and get into a rhythm.

Each of the LEDs needs 5 volts in, 5 volts out, Data in, Data out, Ground in and Ground out. including power for the micro controller and RTC its over 400 wires, all stripped and soldered at both ends.

A tacky blue substance is very useful for this step.

  • I started by placing 2 LEDs in their holes next to each other to work out the length of wire needed to connect to each other.
  • Using the 1st piece of wire as a guide I then cut 60 of each colour wire.
  • Strip 2mm of sleeving from the ends of each wire and tin them with solder.
  • Solder a small blob of solder onto each of the LED pads.
  • Solder the wires to the LEDs to form two chains of 60 for the minutes and seconds and one chain of 12 for the hours. I used red wire for 5V, yellow for data and blue for ground.
  • Take care to connect each Data Out (DOUT) to the Data In (DIN) of the next LED
  • The last led in each chain dose not need a data out wire.

Once all the chains are completed its a good idea to test them before installing them. I used my Arduino UNO and the Adafruit NeoPixel Strand Test to confirm each LED was working.

Solder longer wires onto each of the chains for 5V, Ground and Data in.

At this point there should be five 5v wires, three Data wires connected to the Arduino Pro Mini and 5 Ground wires.

Strip 5mm from the ends of the 5v wires and solder them all together and repeat for the Ground wires.

After completing the three chains solder a 5V wire on to RAW pin of the Arduino Pro Mini and also onto the VCC pin for the RTC. A Ground wire to GND on the Arduino Pro Mini and RTC and then 2 more wires:

SCL from the RTC to A5 on the Pro Mini

SDA from the RTC to A4 on the Pro Mini

The data lines from the LEDs should connect to:

  • Seconds - Digital Pin 3.
  • Minutes - DigitalPin 4
  • Hours - DigitalPin 5

Step 4: Installing

Once soldered, installing the LEDs in their holes should be straight forward. The LEDs need to be installed so the data runs around anti-Clockwise when looking at it from the back as the code is setup front facing.

I used a tiny amount of hot glue to hold them down as I want to be able to replace a single LED if it fails in the future.

I also used hot glue to keep all the wires neat and tidy and to fix the barrel connector to the board.

There are a number of arduino pro mini programming guides available. I use the external USB to serial converter method to load this code onto the Arduino:

This code will also set the time on the RTC to the time that it was compiled. so its important to just hut the upload button so it complies and uploads as quickly as possible.

Much of this code was borrowed from the NeoPixel Ring Clock by Andy Doro. Some from the Adafruit NeoPixel Strand Test and some I put together.

You will need to have installed a few libraries. They are available from the Libraries Manager on the Arduino software.

The Adafruit NeoPixel for the ws2812b LEDs

Wire for talking to the RTC over I2C (this is built in as standard)

and RTClib for knowing what to ask the RTC

/**************************************************************************
* * NeoPixel Ring Clock by Andy Doro (mail@andydoro.com) http://andydoro.com/ringclock/ * * **************************************************************************

Revision History

Date By What 20140320 AFD First draft 20160105 AFD Faded arcs 20160916 AFD Trinket compatible 20170727 AFD added STARTPIXEL for 3D enclosure, variable starting point, added automatic DST support 20180424 AFD using DST library https://github.com/andydoro/DST_RTC *

/ include the library code: #include <Wire.h> #include <RTClib.h>

#include <Adafruit_NeoPixel.h>

// define pins #define SECPIN 3 #define MINPIN 4 #define HOUPIN 5

#define BRIGHTNESS 20 // set max brightness

#define r 10 #define g 10 #define b 10 RTC_DS3231 rtc; // Establish clock object

Adafruit_NeoPixel stripS = Adafruit_NeoPixel(60, SECPIN, NEO_GRB + NEO_KHZ800); // strip object Adafruit_NeoPixel stripM = Adafruit_NeoPixel(60, MINPIN, NEO_GRB + NEO_KHZ800); // strip object Adafruit_NeoPixel stripH = Adafruit_NeoPixel(24, HOUPIN, NEO_GRB + NEO_KHZ800); // strip object byte pixelColorRed, pixelColorGreen, pixelColorBlue; // holds color values

void setup () { Wire.begin(); // Begin I2C rtc.begin(); // begin clock

Serial.begin(9600); // set pinmodes pinMode(SECPIN, OUTPUT); pinMode(MINPIN, OUTPUT); pinMode(HOUPIN, OUTPUT);

if (rtc.lostPower()) { Serial.println("RTC lost power, lets set the time!"); // following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0)); }

stripS.begin(); stripM.begin(); stripH.begin(); //strip.show(); // Initialize all pixels to 'off'

// startup sequence delay(500);

colorWipeS(stripS.Color(0, g, 0), 5); // Blue colorWipeM(stripM.Color(r, 0, 0), 5); // Blue colorWipeH(stripH.Color(0, 0, b), 50); // Blue

delay(1000); DateTime theTime = rtc.now(); // takes into account DST byte secondval = theTime.second(); // get seconds byte minuteval = theTime.minute(); // get minutes int hourval = theTime.hour(); hourval = hourval % 12; // This clock is 12 hour, if 13-23, convert to 0-11`

for (uint16_t i = 0; i < secondval ; i++) { stripS.setPixelColor(i, 0,0,b); stripS.show(); delay(5); }

for (uint16_t i = 0; i < minuteval ; i++) { stripM.setPixelColor(i, 0,g,0); stripM.show(); delay(5); }

for (uint16_t i = 0; i < hourval ; i++) { stripH.setPixelColor(i, r,0,0); stripH.show(); delay(5); }

}

void loop () {

// get time DateTime theTime = rtc.now(); // takes into account DST

byte secondval = theTime.second(); // get seconds byte minuteval = theTime.minute(); // get minutes int hourval = theTime.hour(); // get hours hourval = hourval % 12; // This clock is 12 hour, if 13-23, convert to 0-11`

stripS.setPixelColor(secondval, 0,0,20); stripS.show(); delay(10); if (secondval ==59 ) { for (uint8_t i = stripS.numPixels(); i > 0; i--) { stripS.setPixelColor(i, 0,g,0); stripS.show(); delay(16);} }

stripM.setPixelColor(minuteval, 0,g,0); stripM.show(); delay(10); if (secondval ==59 && minuteval == 59) { for (uint8_t i = stripM.numPixels(); i > 0; i--) { stripM.setPixelColor(i, r,0,0); stripM.show(); delay(16);} }

stripH.setPixelColor(hourval, r,0,0); stripH.show(); delay(10); if (secondval == 59 && minuteval == 59 && hourval == 11) { for (uint8_t i = stripH.numPixels(); i > 0; i--) { stripH.setPixelColor(i, 0,0,b); stripH.show(); delay(83);} } // for serial debugging Serial.print(hourval, DEC); Serial.print(':'); Serial.print(minuteval, DEC); Serial.print(':'); Serial.println(secondval, DEC); }

// Fill the dots one after the other with a color void colorWipeS(uint32_t c, uint8_t wait) { for (uint16_t i = 0; i < stripS.numPixels(); i++) { stripS.setPixelColor(i, c); stripS.show(); delay(wait); } }

void colorWipeM(uint32_t c, uint8_t wait) { for (uint16_t i = 0; i < stripM.numPixels(); i++) { stripM.setPixelColor(i, c); stripM.show(); delay(wait); } }

void colorWipeH(uint32_t c, uint8_t wait) { for (uint16_t i = 0; i < stripH.numPixels(); i++) { stripH.setPixelColor(i, c); stripH.show(); delay(wait); } }

Step 5: Final Touches

All that should be left now is to fix down the RTC and Micro Controller down in the recess.

I have fitted the RTC battery side up so I can easily change the battery if needed.

Connect the 5v wires to the + side of the connector and the Ground to the - side

Power it UP!

I have mine connected to a USB battery bank but A USB phone charger would work just as well.

Note:

The brightness of the LEDs is set in the code. It has been set low to keep the current draw low. At full brightness with all the LEDs lit it could draw nearly 8 amps. With the current setup its less than 1.

Clocks Contest

Runner Up in the
Clocks Contest