LED Clock. NEOPIXEL used.

Well, from the other efforts I decided to make one myself.

It is not 100%, but close enough.

It uses a 1307 RTC chip. ADA FRUIT Neo Pixel ring/s. I have gone for the biggest size (60) for simplicity.
But it can be changed easily with the variable “LED_Loop”.

It should work ok with other sizes.

There is a small bug when the minute hand gets to 12 o’clock.

LED_Clock5.zip (2.56 KB)

Yes I have also knocked up a clock using the 60 LED ring but need a frame to mount the ring in/on. I'm looking for a local person with a wood lathe or CNC mill/router to make one but it's not as easy as I thought it would be so am holding out hope for the Sandringham Country Fair next week as they tend to have artisans who do this sort of thing.

Do you have pictures?

Well, not really.

At this point it is JUST the NEOPIXEL ring/loop.

About 6 inches diameter. A piece of wire going away to the Arduino. The RTC clock “hanging” on another piece of wire.

Not really something I want to “show off”.

But it looks nice if you ignore the rest of the stuff.

Same as me then with regard to pictures.

I’m at work all weekend so wont get a chance to test your code but have attached the code I’m currently working with. I use a different RTC to you though.

NEO_Clock_v3.ino (3.53 KB)

Interesting how you do the time calculations to get the position of the "hands".

Mine is maybe not as good, but the explanation is maybe a bit better on how/where the hands are.

Mine has a "bug" that the points are not all exactly the right position.
All but the 12 are right.

But from 11 to 12 is 3 LEDs between. But 12 to 1 there are 5 LEDs. The rest are all 4.

I'll try to take some piccies soon and put them up.

I’ve fixed the problem with my sketch.

Reading yours:

  h = RTC.getHours() + PixelCount - 1;// Add PixelCount so wrapping backwards does not screw mod command

WARNING!

Setpixel is 0 to “pixelcount-1”

So you may not need that really.

Not too sure, but it drove me batty for a while with a problem.

New sketch attached.

LED_Clock5.ino (8.18 KB)

I add the number of pixels in the chain (60) to all the values of hour, minute & second and use modulo to bring them into correct range for output after applying and maths needed.
For example the hour hand is 5 pixels wide (hour pixel plus 2 either side) and when it is at the top of the hour (pixel 0) the other pixels would be at -2, -1, +1 & +2 but adding pixel count first makes them 58, 59, 61 & 62 instead. now apply modulo 60 and the pixel numbers become 58, 59, 1 & 2 as is needed for the library. Sorry if you now feel like your sucking on an egg :grin:

No, you got me wrong.

I wasn't telling you how to suck eggs, rather there was a trap which had me stuck for a while.

My clock also shows where the main numbers are. 12, 3,. 6, 9.
But the 12 was in the wrong place by one LED.

Then, when I put in the rest of the numbers it was obvious that there was a problem.

Most of the numbers had 4 LEDs between them. But 11 to 12 was 3 and 12 to 1 was 5.

I realised that there are 60 LEDs but they number 0 - 59. Which is kind of good for MOD(60) functions.

But depending on HOW do you it, it can cause you grief. But you seem to have avoided the trap. Good. I didn't, initially.

OK, so you make your hour hand have two LEDs either side. What happens when the second hand or minute hand "overlap"?

I was wanting to get the RGB values and add them together. But that hasn't happened yet and there were problems with it earlier on.

I spent about 8 hours (nearly solid) writing the code and making the ring, etc. yesterday. My shoulders hurt something shocking.

Today I am going to look for something to house the clock/ring to make it look nice.

Bye for now.

lost_and_confused:
No, you got me wrong.

I wasn't telling you how to suck eggs, rather there was a trap which had me stuck for a while.
Sorry but you misread my reply, I was saying sorry if you feel like your sucking on an egg with me prattling on about mod etc. :~

OK, so you make your hour hand have two LEDs either side. What happens when the second hand or minute hand "overlap"?
The hour hand is 5 leds wide in total, the minutes hand is 3 leds and the seconds 1 led. The minutes overlap the hours and the seconds is mixed over both with cross fading between pixels as it moves.
I just realized I may have posted a newer test version than the one I'm describing. I will have to load it up and test when I'm next at home (5 days).

Today I am going to look for something to house the clock/ring to make it look nice.
Good luck with that, the code I posted was written on 2nd July 2014 and I still don't have a case.

I used a DS3231RTC (more accurate I've found than the 1307's) and a 1 meter strip of WS2812B's, and wrapped itaround a 12" foam board I cut in a circle. Then used two more pieces of foam board to sandwich the LEDs so you can't see them from the front.

The reason I tried foam board is one, cost and secondly, easy stuff to work with, last, I wanted to see what the LED reflection off the foam board would be like. So that's the direction I went first. A white backplane for the LED's to reflect off works very nicely.

I use green for seconds, blue for hours and magenta for minutes. I also mounted an LDR behind the lower hole in the surf sign so that when the room lights dim, the clock drops to a "night time" brightness.

I'm going to make a proper wood frame out of dowels to finish it off.

Mel

Firstly this is my first post and I apologise for reactivating this thread but I must say I do like this sketch but I have a small issue and as I am a noob with Arduino coding I wanted to ask for some help.

I recently got a cheap 60 WS2812 LED ring but I have found the DIN goes the opposite direction compared to Adafruit's Neopixel 60 LED ring. Is there anyway of getting this code to work in reverse so instead of the code going clockwise it could go counter-clockwise so that I could get to use this sketch with my ring?

You’re sending out 180 bytes of data to load the WS2812s, yes? So flip the order you send them out.
They are likely stored in an array. Go thru the array from 179 to 0 vs 0 to 179.

CrossRoads:
You're sending out 180 bytes of data to load the WS2812s, yes? So flip the order you send them out.
They are likely stored in an array. Go thru the array from 179 to 0 vs 0 to 179.

I understand but I really have not got a clue on where to make those adjustments in this sketch

Gavincol78:
I recently got a cheap 60 WS2812 LED ring but I have found the DIN goes the opposite direction compared to Adafruit's Neopixel 60 LED ring. Is there anyway of getting this code to work in reverse so instead of the code going clockwise it could go counter-clockwise so that I could get to use this sketch with my ring?

Wow, I must be getting old as I had completely forgotten about this thread. I never did post the finished clock code and pictures.
When you say 'the code' whose code are you referring to. If it's my code then maybe just altering three lines

 int h = RTC.getHours() + TDC + PixelCount - 1;      // Add PixelCount and TDC so wrapping backwards does not screw mod command
  int m = RTC.getMinutes() + TDC + PixelCount;
  int s = RTC.getSeconds() + TDC + PixelCount + 1;    // +1 so minute hand does not move until second == 1 instead of normal second == zero

to

 int h = TDC + PixelCount - RTC.getHours() - 1;      // Add PixelCount and TDC so wrapping backwards does not screw mod command
  int m = TDC + PixelCount - RTC.getMinutes();
  int s = TDC + PixelCount - RTC.getSeconds() - 1;    // -1 so minute hand does not move until second == 1 instead of normal second == zero

will do the job. I say maybe because I don't have the clock here to test it.

I was talking about the OP’s LED_Clock5 sketch.

But last night on a thread that I started someone advised me to change the following code

(minute_led,MN_R,MN_G,MN_B);

to

(59 -minute_led,MN_R,MN_G,MN_B);

and to also make the same change to the seconds and hours. Which worked for Hours and Minutes but screws around with the Seconds

If it works for hours and minutes, it works for seconds :wink:

You must be doing something different with seconds or you have not modified the code at the proper location.

BTW that approach does work for h m and s as I said in the other posting.
.

LarryD:
If it works for hours and minutes, it works for seconds :wink:

You must be doing something different with seconds or you have not modified the code at the proper location.

BTW that approach does work for h m and s as I said in the other posting.
.

I didn't say it didn't work as it does work but other parts of the code conflicts with adjustment and causes unwanted effects.