132 Pixel Clock

8.1K8126

Intro: 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.

23 Comments

This clock is something I have been sort of searching for. There was a clock similar to this in the middle court in the Myrtle Square Mall in Myrtle Beach SC for years. The clock had the neon numbers in the center where the hour dots are. The second and minute lights only lit when they were active. however I like your design where they simply change color.
Awesome clock, and another great use for neopixels!
Bob D
I have a neopixel obsession :)
My hero! Keep creating new designs...they do inspire others.
Bob D
I have been working on the clock. Its coming along nicely. I want to change the start color of the 60 second position and the 12 o'clock position to blue. Can you help me identify the line of code that will do this? and - or - can I do this?
Hello again,

Sorry for the delay getting back to you.
I have gone very the code and listed all the lines that change the colours below:
Line 16 defines Red, line 17 defines Green and line 18 defines Blue
You can change the colour anywhere this line appears :
stripS.setPixelColor(i, X,X,X);
by changing the X,X,X to RGB values from 0 to 255 or changes the values on Line 16,17 and 18
during setup all the strips are set to the colurs defined on line16,17 & 18 but can be changed to anything you like (lines 54,55 &56)
Still in Setup. from line 67 through to line 83 the strips are set to show the current H,M & S. you can also change the colour values to anything you like.
in the main loop:
line 98 changes the colour the seconds change to as it goes round (0,0,20 is dim blue) but looking at it it should be "b" so its set from line 18
line 105 is the colour the seconds change back to at 59 seconds.
line 111 sets the colour for the minutes as it changes and line 118 changes it back
line 124 sets the colour for the hours and line 131 set the colour when the Hours are 11 & Minutes = 59 & seconds = 59

Hope this helps.
Hello, the awesome thing with addressable LEDs is you can make any one any colour you like.

I will go through the code later today and get back to you with a detailed answer.

next question: in the instructable you show the data connections as; seconds to pin 3 - minutes to pin 4 and hours to pin 5.

In the Fritzing schematic that you made, it shows pin 3 to hours and pin 5 to seconds.

may I guess (and or assume) that the instructable is the correct version???

I went into the IDE and read the sketch program

the instructable is correct - the error is in the Fritzing schematic

OK - I think I get it. 60 and Zero are the same position.

because the clock starts counting from zero - not 1 - yes??

In the second photo - Step 4 - you show the LED's starting at the 12:00 position, which is also the sixty second and sixty minute position. I was wondering if the LED's should start from the "1" position?

I solved the upload issue - libraries were in the wrong place - put things where they needed to be and uploaded to the pro mini - no problemo - I am now working on a 3D print file for the clock face - I'll let you know how it turns out.

That’s great news.
I think I 3D print will be awesome. Can’t wait to see it

The bottom right photo in step 5 shows a blue and a red wire from the end of the last hour LED (11 O'clock position) to the power connections. This is not shown on the schematic you included. The wires to minutes and seconds end at the end of the chain. Can you please explain?

Hi,
Sorry about that. I was a little concerned that there might be some brownout on the LED at the end of the chains from the voltage drop I thought that creating a continuous loop might help to mitigate it. However when I tested a full chain of 60 I found that it wasn’t a problem and decided not to include it on the other 2 chains.
You can safely ignore the red and blue wires you can see in the photo.

So - I managed to fix the "unterminated comment" issue

now I get "error compiling for board Arduino Pro or Pro Mini"

Sorry again for the trouble.

I have tried to reproduce this on my end but it seams to be working fine.

when I try to load the NeoPixel Ring Clock program onto my pro mini - I get an error message that says:

unterminated comment

do you know how can I fix this?

Hello, Sorry to hear about your trouble.

It looks like a couple of / got lost. My bad..

The top of the sketch should look like the screen shot.

Note the / after the last * on line 19

and the missing / on line 21

Looking at this the first time, I thought for sure it was drilled with CNC or at least a drill press. The LEDs are spaced and aligned perfectly - nice job doing this with a hand drill!

More Comments