Ping Pong Ball LED Clock

110,318

871

154

Introduction: Ping Pong Ball LED Clock

About: I'm kinda addicted to LED stuff

This awesome LED clock is a quite simple project that nearly everyone can make. It can function as a Clock, can be LED decoration, or it can just be a nice piece of decoration when turned off.

Why I made this project/instructable

Last year I saw quite some great projects from people that used ping pong balls as diffusers for LEDs. This inspired me to make something with ping pong balls as well. After making some sketches and ordering parts I finally finished the project. Since some people were interested in a tutorial, I decided to improve the build and make a new improved version of the ping pong ball clock. With this instructable, I hope to get others excited and inspired to build their own projects.

Design choices

Since the ping pong balls are not oriented in a matrix, I had to come up with a nice way to display digits. The design I settled on uses 12 ping pong balls for each digit. After some sketching, I found that this allowed for the clearest digit representations. The length of the middle row is 20 balls (20*4 = 80cm). This size came to be because I wanted four digits next to each other, with a colon in the middle. I also wanted to have at least one row of balls between the digits to improve readability. Whilst doing this I found out that this way the total amount of balls and LEDs became to be 128.

Improvements over the first version

In the images, you can see the previous version and the new one (the pictures with 2 panels, the top one is the old version). The newer version:

- uses LED strips instead of separately soldered together Neo-Pixels.

- has pixels orientated in a way so it is easier to program.

- has less exposed contacts.

- has a back panel, so you can not see through gaps.

- allows for easier modifications and possible repair.

- looks cleaner, since wires and electronics cannot be seen from the front.

- Is way faster to make, since soldering 128*6 contacts, and stripping the same amount of wires takes some time

note:

For anyone building this: This project requires some repetitive work, I advise to first make a small test version of this project to see how the end result will look like. This allows you to see if the ping pong balls diffuse the light nicely. This could also prevent mistakes that otherwise might occur later on ( like having to much space between balls). I build a small piece of this display (picture) both times I build one of these, and I am glad I did.

Step 1: Materials / Tools:

Materials:

bought locally:

- Mdf plate (80*30 cm)

- Wood for a frame (has to be 5 cm wide and a total length of at least 200 centimeters )

- 128 ping pong balls (white ones preferably milky white)

- A few (4) small nails

- Old USB cable (one that can power the Arduino nano)

- Power cable from old electronics

bought online (China)

- 5V 10A power supply (lower Amperage might also work)

- Arduino nano (clone)

- ws2812b LED strip (5m 30Leds/meter IP30)

- DS3231 RTC

- Wire with 3 cores (2+ meter)

optional

- Female pin connectors

- Resistor (between 300 and 500 Ohm)

Tools:

- Saw that can cut 30-degree angles (miter-saw)

- Hand saw with fine teeth (metal-saw)

- Wire strippers

- Soldering iron

- 12mm drill

- 32mm hole-saw

- Wood-glue

- Hot-glue

- Flashlight

- Sandpaper

note:

Picking the right type of ping pong balls is very important for this project. Ping pong balls generally have a seam where two halves were added together. This in itself is not a problem, since by making a hole in the middle one of those halves the seam will not be visible in the display. However, when the ping pong balls also have a print on one side, it is important that the print on the balls is oriented to the back. This could result in a piece of the seam being visible from the front. When buying ping pong balls, also do not buy balls that shine (reflect light). They will diffuse the light less well and it will look strange (an example of ping pong balls you should not buy).

summary: preferably use seamless ping pong balls without print that are white and do not reflect light.

Step 2: Making Holes in the Ping Pong Balls.

Each ping pong ball will have its own LED behind it. To get as much light as possible to shine through, a piece of the backside of the ping pong balls needs to be removed, so the light of the LED only has to go through one side of the ball. These holes need to be quite large (approximately 30mm) since the LEDs will not be centered behind the balls.

Making these large holes in the ping pong balls was a bit of a challenge. Since the balls are quite weak on their own, they need some support before holes can be made in them. I did this by drilling some 32mm holes in a piece of MDF. When sawing the balls, I provided pressure with one hand on the ping pong balls to press them against the hole. Since the hole was approximately 8mm smaller in diameter than the balls, the balls would just be pressed against the hole. Whilst providing pressure on one side, I sawed off the top of the ping pong ball on the other side, by just sawing in a straight line against the MDF.

Before sawing them, I made sure that the logo that was printed on the balls, was on the side that I was going to saw off. I also used my flashlight to find the seam where the two halves were added together. I turned the balls a bit more, so the logo was not visible from the front and as little from the seam was visible.

tip: If you have problems with the ping pong balls rotating, adding some double-sided tape inside the hole could help keep the ping pong balls in place

note: It does not matter if not all holes are exactly the same size, the size can vary a few mm. This can not be seen from any direction when the build is finished.

Step 3: Gluing All Balls in Rows

After making large holes in all the ping pong balls they need to be glued together in rows (2 rows of (17,18 and 19) and one row of 20). These rows should be as straight as possible and there should be no space between the balls. I used the wood I bought to build the frame to do this. By having the balls supported by the 2 pieces of wood I was certain that they were in one line. After placing a few balls, whilst making sure the holes were facing up and the balls were touching each other, I glued them together. A very little bit of glue is enough to do this. If you use to much glue it will be visible from the front. I used a flashlight again this tone to make sure ping pong balls did not have ugly spots on the front side (some had those since it were cheap balls).

Step 4: Gluing the Rows Together.

To do this I used the wood for the frame to keep 2 rows pressed together. Keep in mind to use small drops of glue, if you use to much it will be visible from the front. After placing glue on around 8 connections at a time, I provided pressure with my hands to make sure the balls were glued tight together.

Step 5: Making the Frame

The frame exists out of 6 pieces. 2 long pieces and 4 short. All the edges of these pieces should have a 60-degree angle. Since the size of my ping pong balls wasn’t exactly 40 mm, but (39,5 something), I calculated the approximate length of the frame pieces (this can be done by measuring the height or width of the panel and using a^2 + b^2 = c^2). I calculated that the inside length of the 2 long pieces should be 66.3cm, and the inside of the 4 short pieces should be 14.3cm. Since my saw was not too accurate, I made sure to cut them a bit larger, so they would not be to short.

After cutting all 6, I placed them around the ping pong ball panel, to see if it fitted well. It didn't, so I sawed a few mm of some pieces. I glued everything together around the ping pong ball panel to make sure it was glued in exactly the right shape, this was necessary since the angles were not cut perfectly in 60 degrees but were more likely 59.5 mm.

Step 6: Soldering the LED Strip

The led strip needs to be cut (one piece of 1 led, one piece of 3 LEDs, one piece of 5 LEDs and 17 pieces with 7 LEDs). The pieces of LED strip need to be wired as can be seen in the image ( first a piece of one led, then the 5 LEDs, next 17 pieces with 7 LEDs and finally the piece with 3 LEDs). The wire that connects the shorter pieces of the strip should be longer than the other pieces since it needs to cover a greater distance. I taped the strip on a piece of MDF to see if each led would be behind its own ball. After soldering all the pieces together I tested if all the solder connections were good, by activating each LED one by one (checkIfLedsAreBehindBalls.ino).

Step 7: Cutting the MDF

One the frame was done I placed the frame and the ping pong ball panel over the MDF which had the LEDs taped to it. After making sure each led was after its own ball I removed the ping pong ball panel. Next, I drew along the inside of the frame on the MDF, to get the shape I needed to cut out. I did it this way because the LEDs are not centered behind the balls and this way I have the relative position of the LEDs to the frame. After removing the LEDs that were taped to the board I cut out the shape of the panel and sanded the edges, so it fitted nicely inside the frame.

note: be aware that le LEDs will not be centered behind the ping pong balls, see sketch

Step 8: Adding Holes and LEDs to MDF

As could be seen previously, the wire connecting the LEDs is kinda in the way. The way it is right now, the wire will be visible from the front. I decided to solve this by drilling holes on the end of the location of each vertical strip of LEDs, so the wire can go on the backside. I weaved the led strip through the holes and temporarily taped it down. After making sure that again, each led would be behind its own ping pong ball I removed the tape and connected the LED strip to the board with the glue strip that is already on the LED strip.

note: When drilling holes in MDF, be really careful, you can break the board really easy.

Step 9: Gluing the Balls to the Frame

I placed the panel of ping pong balls upside down in the frame, then I applied glue on every point where the ping pong balls touched ( or barely touched the frame ).

Step 10: Attaching the LED Panel to the Frame

I placed the led panel on top of the backside of the balls. Next, I used 4 small nails to attach the panel to the frame. I did this by placing the nails on the inside of the frame. I chose to do it this way since it allows me to fix something if it ever breaks (It also allows me to double the number of LEDs, since to many lumens does not exist)

Step 11: Electronics

Okay, I have (almost) no experience with Arduino so this might not be perfect. But I tried to do this in an as simple way as possible.

I soldered connectors to the Arduino nano (black things in the image) (not necessary).

I decided to do it this way so everything can be taken apart easily again if I ever want to add Buttons or a Light Dependent Resistor (LDR) or other features to it.

Next, I connected the RTC to the Arduino, just make sure the SDA and SCl of the clock module are connected to the SDA and SCL of the Arduino Nano. Then connect the resistor between pin 9 and the data in of the LED strip.

Finally, wires were connected to the end of the LED strip to also provide power to the end of the LED strip, in order to prevent voltage drop.

Yes, it really is that simple.

To provide everything with power, I cut a USB cable that could connect to the Arduino nano in half and connected the 5V side of the two cables that went to the LED strip and the cut in half USB cable. I did the same with the Other side. This allows me to power the LED strip without supplying power through the Arduino.

A cable from an old lamp was used to connect the 5V 10A power supply with the clock.

I also drilled a hole in the bottom of one side of the frame for the power cable to go through. This allows the clock to be flat against a wall, whilst still being able to stand on a surface if preferred.

The only thing left to do is writing some code.

Step 12: Code

When uploading code, make sure the power supply is off!

Before the clock module knows the current time, the time has to be set on the module. Luckily there is some code available to do this. After only the addition of 4 lines of code and installing the DS1307RTC module, we can run this (SetTime_on_ds3231_nano.ino, link to original code / instructable about how to set the time on a DS3231RTC) code to set the time on the Arduino to the time of the PC.

With the time set, we can start looking at writing some code for this clock. I used 2 libraries in the programs, the FastLED library, and the DS3232RTC library. These two libraries will do almost all the work for you, and allow someone with very little programming experience to write programs.

Underneath here you can see The code that I used in the video on the top of this Instructable, and in most of the pictures. (timeWhiteBackgroundRainbow.ino)

<p>#include <FastLED.h><fastled.h><br>#include <DS3232RTC.h><ds3232rtc.h>
#define LED_PIN     9
#define NUM_LEDS    128
DS3232RTC myRTC(false);
tmElements_t tm;
CRGB leds[NUM_LEDS];
CHSV colour( 0, 255, 180);
int counter=0;
const int Digits[10][10] =
{
  {7,8,10,11,14,18,22,24},
  {14,16,18,22,24},
  {7,8,9,11,14,16,18,24},
  {7,9,11,14,16,18,22,24},
  {9,10,11,16,18,22,24},
  {7,9,10,11,14,16,18,22},
  {7,8,9,14,15,16,18,22},
  {7,11,14,16,17,24},
  {7,8,9,10,11,14,16,18,22,24},
  {7,9,10,11,14,16,17,24},
};
void setup()
{
    pinMode(17, OUTPUT); //ground and v5 for clock module
    pinMode(16, OUTPUT);
    digitalWrite(17, HIGH);
    digitalWrite(16, LOW);
    FastLED.addLeds<</ds3232rtc.h></fastled.h>WS2812, LED_PIN, GRB>(leds, NUM_LEDS);</p><p><fastled.h><ds3232rtc.h><ws2812, led_pin,="" grb="">    myRTC.begin();
}</ws2812,></ds3232rtc.h></fastled.h></p><p>//function that uses the Digit aray to display numbers between 0 and 100
void displaynumber( int place , int number){
  for (int i = 0 ; i < 10 ; i++) {
    if (Digits[number/10][i] != 0) {
      leds[(Digits[number/10][i]+place)] = CRGB(255,255,255);;
    }
    if (Digits[number%10][i] != 0) {
      leds[(Digits[number%10][i]+28+place)] = CRGB(255,255,255);;
    }
  }
}</p><p>void loop(){
  RTC.read(tm);
  
  //changes the colour of background every 10 cycles
  if (counter<10){
    counter++;
  }else{
    colour.hue = (colour.hue+1)%256;
    counter=0;
  }</p><p>  // sets background to rainbow colours
  for ( int i=0; i< 128;i++){
    colour.hue = (colour.hue+1)%256;
    leds[i]= colour;
  }
  colour.hue = (colour.hue+128)%256;
  
  displaynumber(0,tm.Hour);
  displaynumber(70,tm.Minute);</p><p>  //display colons
  if ( tm.Second%2 == 0 ){
    leds[64] = CRGB(255,255,255);
    leds[66] = CRGB(255,255,255);
  }
  FastLED.show();
}</p>

I think the Code is relatively short, but it can, of course, be improved. All it does is reading the time from the RTC and displaying that time. The location of the LEDs that should be lit to form a digit is hardcoded in the matrix 'Digits'. For example, Digits[0] contains the location of the LEDs that should be lit to form a zero.

I also provided the other programs I made, they are slight alterations of the program above. The program 'CycleThroughDigits.ino' just counts up to 9999 to demonstrate how all the digits look. The program 'onlyTime.ino' just displays the time in changing colors, with no background color. Finally, 'FastledExampleCode.ino' is some code provided by the FastLED library that demonstrates some simple animations.

Step 13: Add Every Feature You Want

This project can be so much more than a basic clock, you can add buttons, make it change brightness depending on the light, have it display just some colors, make it reactive to music, connect it to wifi with an ESP. It's basically an Arduino connected to a display, everything is possible

Epilog X Contest

First Prize in the
Epilog X Contest

15 People Made This Project!

Recommendations

  • For the Home Contest

    For the Home Contest
  • Big and Small Contest

    Big and Small Contest
  • Make It Bridge

    Make It Bridge

154 Comments

0
Flowman
Flowman

9 months ago

Hi Guys,

I went all in and created a library that can do text time and a little bit of everything for this clock.

If you add a rotary encoder you can change background and set time, add a mic and the third background is a spectrum analyzer.

Think I have 2 bytes left of memory on my Arduino :D.

Cheers

0
Simplicity1
Simplicity1

11 months ago

Hi there

As mentioned above (see pictures) I did this project with a SK6812 RGB+W LED strip.

Now I made an additional code to light up the digits in a slight rainbow color with almost black background. Since the result is quite nice, I thought this might also be of interest, so here is the code. To have everything together in one place, there is also the code for normal rainbow background again. Enjoy :)

IMG20220409173229.jpgIMG20220409173433.jpgIMG20220306182943.jpgIMG20220306201651.jpg
0
Davie577
Davie577

1 year ago

Hi. I did the project with my two sons. Each of them will get one, if it is totally done. I have problems with the RTC. If i want to upload the code with arduino ide it says:

/my/folder/PPC_original/PPC_original.ino: In function 'void loop()':
PPC_original:46:3: error: 'RTC' was not declared in this scope
RTC.read(tm);
^~~
/my/folder/PPC_original/PPC_original.ino:46:3: note: suggested alternative: 'myRTC'
RTC.read(tm);
^~~
myRTC
exit status 1
'RTC' was not declared in this scope

I renamed RTC to myRTC in void loop(), then it works. But the time is set to 00:00
I set the time on the RTC with Arduino UNO and it worked. Battery works too.
Is there someone who can help me?
Thanks a lot!

##----------- Now I fixed it. ------------##
If anyone has the same problem, here is my solution:

1. - connect the RTC to Arduino Nano like discribed
- upload SetTime_on_ds3231_nano.ino
- disconnect Arduino Nano from USB-Port
- disconnect RTC from Arduino Nano !!!

2. - open for example timeWhiteBackgroundRainbow.ino in Arduino IDE
- switch in code RTC.read(tm); to myRTC.read(tm);
- upload timeWhiteBackgroundRainbow.ino to Arduino Nano

3. - disconnect Arduino Nano from USB-Port
- connect the RTC to Arduino Nano

4. - connect Arduino Nano (connected to RTC) to your clock

That works for me.
0
eurobird
eurobird

Question 1 year ago on Step 1

I'm also trying to figure out the circuit diagram, I almost asked on youtube, there are places I can't see, he didn't return to see if you could post it..... I take a picture and solve it, the pot and keys consist of 6 v 7 question mark, where does it short circuit, that is, I made a comment, but is it correct as far as I can perceive from the picture? I don't know, I would appreciate if someone with experience can clarify.

Ekran Alıntısı.PNG
0
eurobird
eurobird

1 year ago

hi my friend, i found a video on youtube, friend gave the code, it works too, uno works, if the libraries are installed in the software, I guarantee it will work..... it works for me... it works for me, 2812b led lamp, which is a straight 2.5 meter strip, the right places are on. I will bring the leds side by side. No, there is no need for another electronic circuit, I need a capacitor to prevent it from fluctuating between two keys, one potentiometer and one plus minus. ........(www.youtube.com/watch?v=Es4Qa5HRzns) watch here

0
eurobird
eurobird

Question 1 year ago on Introduction

Greetings from Turkey, friends, it's a beautiful project, I've been thinking about it for 10 days, I couldn't do it, I need your help as a beginner. i have an arduino uno and a clock ds 1302 ws2812b led can you post a code that works with them?
It should not be difficult for the master, I will be glad if you help me, I respect the knowledge and effort, I present my respects

20220310_011732_HDR.jpg20220310_011737_HDR.jpgds1302.jpg
0
JamieKitson
JamieKitson

Question 1 year ago

Has anyone tried cutting the ping-pong balls in half? Just wondering if it looks as good as it seems like it would be a lot easier. And thanks Thomas for such a great idea.

0
JosephM28
JosephM28

Answer 1 year ago

as long as you have 40mm of lateral distance between balls it will work just fine - don't use the glues as described in the tutorial instead use museum glue on the LED strip - it will look better than the tutorial - but in general cutting them using hot wire is really easy I made one in less than 30 minutes

0
Olivia Chang
Olivia Chang

Answer 1 year ago

I've tried that, but it doesn't look as good because the glue holding the balls together becomes visible.

0
kraemer3
kraemer3

Tip 3 years ago

Hi guys,

I added and changed a few lines in the code to have closed zero digits.

#include
#include
#define LED_PIN 9
#define NUM_LEDS 128
DS3232RTC myRTC(false);
tmElements_t tm;
CRGB leds[NUM_LEDS];
CHSV colour( 0, 255, 180);
int counter=0;
const int Digits[11][10] =
{
{2,7,8,10,11,14,18,22,23,24}, //LED2 and LED23 added to close the zero
{14,16,18,22,24},
{7,8,9,11,14,16,18,24},
{7,9,11,14,16,18,22,24},
{9,10,11,16,18,22,24},
{7,9,10,11,14,16,18,22},
{7,8,9,14,15,16,18,22},
{7,11,14,16,17,24},
{7,8,9,10,11,14,16,18,22,24},
{7,9,10,11,14,16,17,24},
{3,7,8,10,11,14,18,22,23,24}, //LED2 and LED23 added to close the zero, only used for first digit
};
void setup()
{
pinMode(17, OUTPUT); //ground and v5 for clock module
pinMode(16, OUTPUT);
digitalWrite(17, HIGH);
digitalWrite(16, LOW);
FastLED.addLeds(leds, NUM_LEDS);
myRTC.begin();
}

//function that uses the Digit aray to display numbers between 0 and 100
void displaynumber( int place , int number){
for (int i = 0 ; i < 10 ; i++) {
if (Digits[number/10][i] != 0) {
if (place == 0 && number/10 == 0){
leds[(Digits[10][i])] = CRGB(255,255,255);;
}
else{
leds[(Digits[number/10][i]+place)] = CRGB(255,255,255);;
}

}
if (Digits[number%10][i] != 0) {
leds[(Digits[number%10][i]+28+place)] = CRGB(255,255,255);;
}
}
}

void loop(){
RTC.read(tm);

//changes the colour of background every 10 cycles
if (counter<10){
counter++;
}else{
colour.hue = (colour.hue+1)%256;
counter=0;
}

// sets background to rainbow colours
for ( int i=0; i< 128;i++){
colour.hue = (colour.hue+1)%256;
leds[i]= colour;
}
colour.hue = (colour.hue+128)%256;

displaynumber(0,0);
displaynumber(70,0);

//displaynumber(0,tm.Hour);
//displaynumber(70,tm.Minute);

//display colons
if ( tm.Second%2 == 0 ){
leds[64] = CRGB(255,255,255);
leds[66] = CRGB(255,255,255);
}
FastLED.show();
}


In my opinion this is looking better.

20191025_225817.jpg20191025_230041.jpg20191025_230204.jpg
0
MDLefevere
MDLefevere

Reply 1 year ago

That's nice!.
Can you give me you're exact code?. Tried compiling the code above but that give's errors.

Also adding the bold marked parts to the original code gives an error.

0
BA_WE
BA_WE

2 years ago

Hi Thomas,

This is a great idea, thanks for sharing and inspiring! I made some changes so I wouldn't need ping pong balls but use a piece of cloth as diffuser instead. I also managed to adapt the software to make some additional effects possible, anyone interested please have a look at:

https://www.instructables.com/Animated-LED-Clock/

It's definitely a work in progress and not as tidy as yours, but it works and might give people ideas on how to make even nicer variants.

0
AirMR
AirMR

Question 2 years ago on Step 13

Hi Thomas, im looking for a Sports countdown clock programming. Ia can do a lot of things but programming and getting the LED stripes at the right pins that everything works as expected is nothing i can do, is tehre a chance that you could program suxh a Countdown timer with one start, one stop and one reset button for me. If possible a function to set the countdown time in between 1-20 minutes.
Thx in advance for your answer

0
steampunkrule
steampunkrule

Question 2 years ago on Step 6

Hello again! I'm up to this stage and I'm trying to test whether my first leds soldered work and I've set in the check if balls behind file to 1 led but it doesn't work... I've got it wired to my arduino like this (See attachment) am I missing anything? Thanks!

IMG_20210126_201424.jpg
1
FrancesDK
FrancesDK

Question 2 years ago

Great Instructable Thomas, Congratulations for your work
Thank you.
Does anyone here found a way to have temperature to it? Let's say a few seconds every minute...
I've been struggeling with that for a while...
Any help would be really appreciated

I already figured out how to have manual set time switches and a LDR
Also included 7 more balls to change number font.
Here's the messy, bur working code if someone is looking for it:
(only thing missing now is temperature :) )


#include <FastLED.h>
#include <DS3232RTC.h>
#define LED_PIN 12
#define NUM_LEDS 135
#define MAX_BRIGHTNESS 240 // Thats almost full on, watch the power!
#define MIN_BRIGHTNESS 1 // set to a minimum
#define MIN_PIN 4 // Define Minutes adjust button pin -- other switch pin connected to ground
#define HUR_PIN 3 // Define Hours adjust button pin -- other switch pin connected to ground
DS3232RTC myRTC(false);
tmElements_t tm;
CRGB leds[NUM_LEDS];
CHSV colour( 0, 255, 180);
const int brightnessInPin = A0; // LDR and 10Kohm resistence in series to form voltage diviser... 5V, GND. A0 is connected in the middle
int counter = 0;

const int Digits[12][13] = // 12 numbers // 13 pixels
{
{4, 7, 8, 9, 14, 15, 18, 22, 23, 25, 28, 29}, //0
{18, 22, 23, 28, 29}, //1
{4, 7, 8, 9, 14, 16, 18, 23, 25, 28, 29}, //2
{4, 7, 14, 16, 18, 22, 23, 25, 28, 29}, //3
{9, 14, 15, 16, 18, 22, 23, 28, 29}, //4
{4, 7, 9, 14, 15, 16, 18, 22, 23, 25, 28}, //5
{4, 7, 8, 9, 14, 15, 16, 18, 22, 23, 25, 28}, //6
{14, 18, 22, 23, 25, 28, 29}, //7
{4, 7, 8, 9, 14, 15, 16, 18, 22, 23, 25, 28, 29}, //8
{4, 7, 9, 14, 15, 16, 18, 22, 23, 25, 28, 29}, //9
{5, 7, 8, 9, 14, 15, 18, 22, 23, 25, 28, 29}, //0a, only used for first digit
{5, 7, 8, 9, 14, 16, 18, 23, 25, 28, 29}, //2a, only used for first digit
};

void setup()
{
FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
FastLED.setBrightness(MAX_BRIGHTNESS);
pinMode(MIN_PIN, INPUT_PULLUP); // Define Minutes adjust button pin
pinMode(HUR_PIN, INPUT_PULLUP); // Define Hours adjust button pin
myRTC.begin();
}

void TimeAdjust() {
int buttonH = digitalRead(HUR_PIN);
int buttonM = digitalRead(MIN_PIN);
if (buttonH == LOW || buttonM == LOW) {
delay(500);
tmElements_t Now;
RTC.read(Now);
int hour = Now.Hour;
int minutes = Now.Minute;
int second = Now.Second;
if (buttonH == LOW) {
if (Now.Hour == 23) {
Now.Hour = 0;
}
else {
Now.Hour += 1;
};
} else {
if (Now.Minute == 59) {
Now.Minute = 0;
}
else {
Now.Minute += 1;
};
};
myRTC.write(Now);
}
}

//function that uses the Digit aray to display numbers between 0 and 100
void displaynumber( int place , int number) {
for (int i = 0 ; i < 13 ; i++) {
if (Digits[number / 10][i] != 0) {
if (place == 0 && number / 10 == 2) { //used only for 1st digit - number 2
leds[(Digits[11][i])] = CRGB(255, 255, 255);; //Digits[11] porque esta em 11º na lista
}
else if
(place == 0 && number / 10 == 0) { //used only for 1st digit - number 0
leds[(Digits[10][i])] = CRGB(255, 255, 255);; //Digits[10] porque esta em 10º na lista
}
else {
leds[(Digits[number / 10][i] + place)] = CRGB(255, 255, 255);;
}
}
if (Digits[number % 10][i] != 0) {
leds[(Digits[number % 10][i] + 28 + place)] = CRGB(255, 255, 255);;
}
}
}

void loop() {
RTC.read(tm);
TimeAdjust(); // Check to se if time is geting modified
// map it to the range of the FastLED brightness:
int mappedValue = map(analogRead(brightnessInPin), 0, 1023, 0, 255);
FastLED.setBrightness(constrain(mappedValue, MIN_BRIGHTNESS, MAX_BRIGHTNESS));


//changes the colour of background every 10 cycles
if (counter < 10) {
counter++;
} else {
colour.hue = (colour.hue + 1) % 256;
counter = 0;
}

// sets background to rainbow colours
for ( int i = 0; i < 135; i++) {
colour.hue = (colour.hue + 1) % 256;
leds[i] = colour;
}
colour.hue = (colour.hue + 121) % 256;

displaynumber(0, tm.Hour);
displaynumber(70, tm.Minute);

//display colons
if ( tm.Second % 2 == 0 ) {
leds[64] = CRGB(255, 255, 255); //sec blink
leds[71] = CRGB(255, 255, 255); //sec bink

}
FastLED.show();
}

20201126_132036.jpg
0
Mar911
Mar911

Question 2 years ago on Step 1

Could you possibly provide a link to the right type of ping pong balls in bulk. The original link isnt working, and i was about to buy the bulk bag until I saw its the type you dont recommend.

0
Mar911
Mar911

Reply 2 years ago

Thank you very much! Hopefully the shipping time isnt too long.

1
kunibert cool
kunibert cool

Question 2 years ago

Hey Thomas
I have got a problem with my led strips as well: The first 3 leds are working but after the connection to the second strip, nothing works anymore. I tested the connection itself, but it should be okay, I couldnt spot the mistake. Maybe you have got an idea why it doesnt work?
Thank you so much for your answer!
Lg

Snapchat-742180542.jpg
0
thomasj152
thomasj152

Answer 2 years ago

Wacht section of led strip has a beginning and an end, each ending schools be connected to a beginning, as you can see you solderd two ends together, which could explain why it doesn't work