Clock Build

As previously-mentioned I have an abundance of RGB LED strips. I don’t intend to buy more unless I’m putting on a workshop. So I might as well figure out little projects to play with LEDs I have.

I have designed some watches in collaboration with my good friend, Scott Wilk of Wilk Watchworks and in the back of my mind is always “It would be cool to have a clock that is all ‘future-y'” (insert air quotes).

A very cool watch
Circle-packing Watch

The strip I have is paired RGB LEDs separated by a shift register in a line. I didn’t really dig on how far apart the LEDs in each pair so I thought, “Cut pairs out, solder the ends and I can tighten the lines up.”

A photo posted by Hugh Elliott (@hughqelliott) on

I decided to make two rows of 30 LEDs. My thinking was for a second counter, It could run down the length, then back up to the top. So began a fun game I call solder and test. In this game, I would solder the four wires to add to the sequence, then plug the strip in to the Arduino and test the strip to that point. Honestly, in retrospect, I could have just touched four leads to the strip pair and determined if I had a burnt LED. Live and learn, people.

A photo posted by Hugh Elliott (@hughqelliott) on

 

I needed enough wire to be able to turn the strip pairs in line with each other but not so much that I’d have excess wire. Because why make things easy?

Twist in the wind!
Twist in the wind!

 

Once I had my 30 pairs tested I moved on to the code. I started by trying the delay function in Arduino. Nice thought, of course. “I’ll just run my function once a second. Or hmm… once every 500 milliseconds. Or wow… that’s not right… 250 milliseconds.” In theory delay(numValue); seems like a great idea. What happens when whatever you need to run each second takes a millisecond or two every cycle? You lose time. If you leave a clock running that loses time gradually, you end up with a crappy clock.

So that lead me to RTClib. This is nice little library specifically for date and timekeeping. If your functions take up extra cycles to run, you don’t lose accuracy because RTClib tracks the time for you. Super handy.

 

For the clock display, I implemented a standard one-LED second, one-LED minute and a five-LED hour. Why five? 60/12 = 5. Every five LEDs is an hour. For my LEDs to run correctly I had to set up a pair of arrays, one for seconds (additionally used by minutes) and one for hours. Remember that LED strips work in sequence. So to light a typical LED strip in order, you’d target led[0], led[1], led[2]. In my case, however, my ordering winds back and forth. Check out my arrays.

int secondsPositions[] = {0 , 3 , 4 , 7 , 8 , 11 , 12 , 15 , 16 , 19 , 20 , 23 , 24 , 27 , 28 , 31 , 32 , 35 , 36 , 39 , 40 , 43 , 44 , 47 , 48 , 51 , 52 , 55 , 56 , 59 , 58 , 57 , 54 , 53 , 50 , 49 , 46 , 45 , 42 , 41 , 38 , 37 , 34 , 33 , 30 , 29 , 26 , 25 , 22 , 21 , 18 , 17 , 14 , 13 , 10 , 9 , 6 , 5 , 2 , 1};

int hoursPositions[][12] = {{0 , 3 , 4 , 7 , 8} , {11 , 12 , 15 , 16 , 19} , {20 , 23 , 24 , 27 , 28} , {31 , 32 , 35 , 36 , 39} , {40 , 43 , 44 , 47 , 48} , {51 , 52 , 55 , 56 , 59} , {58 , 57 , 54 , 53 , 50} , {49 , 46 , 45 , 42 , 41} , {38 , 37 , 34 , 33 , 30} , {29 , 26 , 25 , 22 , 21} , {18 , 17 , 14 , 13 , 10} , {9 , 6 , 5 , 2 , 1}};

LED_order
I only numbered up to 6 here but you get the idea. Whacky.

 

The point, of course is when I run my clock and you look at it, it’s linear.

  I started to have an issue with the LED control library I was using and discovered FastLED. It sort of took the place of the original LED library in my heart. It’s robust and supports a ton of different LED strips. Still messing with it but whatever. 

There’s a little left on the code front I need to do. For instance, the hours don’t show up at all at midnight. Because you should be in bed, Hugh! And the minute will remove an hour LED when they occupy the same position. Other than that, I have some manual controls to add, buttons for setting the time, for instance, might be handy.

I’ve designed the face of it and will get it laser cut. Once cut, I think I’ll apply the same mirror film I use for the infinity mirror. Ought to be a pretty cool effect. Here’s the design for the face and housing. I’ll update when I scrape together laserin’ money.

 

Anyway, that’s the clock. If you want one, let me know, and I’ll figure out a price. It’s time-consuming but it’ll look pretty amazing.

0 comments on “Clock BuildAdd yours →

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.