Ping Pong Ball LED Clock

79,795

737

125

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

8 People Made This Project!

Recommendations

  • Puzzles Speed Challenge

    Puzzles Speed Challenge
  • "Can't Touch This" Family Contest

    "Can't Touch This" Family Contest
  • CNC Contest 2020

    CNC Contest 2020

125 Discussions

0
StrazzoJ
StrazzoJ

8 weeks ago

Hi Thomas, this project is super amazing and unique and I really wanted to try this out and get a bigger understanding about arduino, as this is my first project using it. just before school ended, my Engineering teacher had us look around for a project on instructables, and I chose probably a more harder one than most others, and yea this is it! So my family's pretty skilled with woodworking and my dad's soldered a bit in the past, it's just the coding part I'm not too familiar with. I figured out how to get the code up and fix some mistakes, but the main problem i've been running into is this:

Arduino: 1.8.12 (Windows Store 1.8.33.0) (Windows 10), Board: "Arduino Nano, ATmega328P"
In file included from C:\Users\timst\Documents\Arduino\sketch_apr23a\sketch_apr23a.ino:2:0:
C:\Users\timst\Documents\Arduino\libraries\FastLED/FastLED.h:14:21: note: #pragma message: FastLED version 3.003.002
# pragma message "FastLED version 3.003.002"
^~~~~~~~~~~~~~~~~~~~~~~~~~~
Sketch uses 4506 bytes (14%) of program storage space. Maximum is 30720 bytes.
Global variables use 189 bytes (9%) of dynamic memory, leaving 1859 bytes for local variables. Maximum is 2048 bytes.
Serial port not selected.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.


So I realised I needed a serial port(??whatever that means) so I Googled some stuff about it and how i needed to update something with the arduino or serial port. it got realllly confusing, and i'm just coding on a Surface Pro btw

Could that be the reason? If you ran into this problem and fixed it it would be a huge boost to getting this project done, not that I've got much going on these days ;)

Sorry that this is really long and confusing, so ask anything to be clarified, Thanks!

0
thomasj152
thomasj152

Reply 8 weeks ago

I think this means that you did not specify to what USB port you have connected your Arduino. You should be able to specify this in the Arduino IDE. Please let me know if this helped, goodluck!

0
StrazzoJ
StrazzoJ

Reply 12 days ago

turns out i needed to use the arduino editor website, the Arduino IDE couldn't find the usb port for the arduino nano. thank you for the help!

0
steampunkrule
steampunkrule

4 weeks ago

Could I change the Arduino nano to a esp32? and how would I do this? and does it change anything with the wiring?

0
thomasj152
thomasj152

Reply 4 weeks ago

Yes, but if you use an esp you might want to remove the rtc module and make it so that it gets the current time over wifi. You will also need to add a few lines of code so that the fastled library works with the esp, but that shouldn't be to difficult. You will need some more general understanding about programming though

0
DukeOfWirefield
DukeOfWirefield

Question 3 months ago

Hi Thomas,
sorry for bothering you again, but I have one last question. Am I right with the assumption, that you connected the GND cable of the Mini USB connector with the V- line coming from the power supply? Or what does it connect to? I tried connecting V- with a normal GND pin on the Arduino and that didn´t work, so I want to make sure before doing it again with the USB cable. Thanks for helping!

1
thomasj152
thomasj152

Answer 3 months ago

You can always use a multimeter to be sure, but you should be able to connect the v- of the power supply to any ground pin on the Arduino.

0
DukeOfWirefield
DukeOfWirefield

Question 4 months ago on Step 11

Hi Thomas, thanks for sharing this project! Unfortunately, the LEDs are strongly flickering, once the code is running. It also happens with demo code, so I believe ist something with the wiring. Do you have any idea what it could be?

1
thomasj152
thomasj152

Answer 4 months ago

Are they the correct color and flickering or just flickering randomly. If it's the correct color it is likely an issue with how the power is supplied. The most likely scenario is that you power the Arduino from the PC and the LEDs from the power supply without having the ground between those two connected. Make sure to connect those, or to power everything from the power supply. If it is random colors make sure that the data wire is connected to the right pin on the Arduino.

Please tell me if this helped, good luck!

0
DukeOfWirefield
DukeOfWirefield

Reply 4 months ago

Thanks a lot! It was because of the GND not being connected. Now it works just fine.

0
retrobannerS
retrobannerS

Question 4 months ago

Hello, Thomas. Help me please with the project. When I used your sketch to set time on DS3231, Arduino IDE wrote me "DS1307 Communication Error :-{
Please check your circuitry" (photo 1). I used other sketches, all was ok, but in fact... (photo 2)

VVmwv2PBuXg.jpg0syffixdLjE.jpg
0
thomasj152
thomasj152

Answer 4 months ago

Sorry for the late reaction. Are you sure that the rtc is connected to the correct pins?

0
ItsDodyS90
ItsDodyS90

Question 6 months ago

Can you help me with this arduino? I always fail when i try upload this script to my arduino nano. Pls reply

IMG20200204005802.jpg
0
DukeOfWirefield
DukeOfWirefield

Answer 4 months ago

This happens, because you haven´t installed the program library used in the code. Under Tools -> Manage libraries search for the libraries used in the code. They are listed in the "#include" commands at the beginning. Once you have installed all of them it should compile.

0
thomasj152
thomasj152

Answer 6 months ago

you should use the code provided in the .ino files, don't copy it from the website

0
ItsDodyS90
ItsDodyS90

Reply 5 months ago

Sir, i need help. When i start this project and clock start 00:00. What should i do? Please help me

IMG20200305180612.jpg
0
thomasj152
thomasj152

Reply 5 months ago

You need to upload a different sketch first, it is provided in the instructable and it will set the correct time to the clock. alernatively you could just out the battery in the rtc once at midnight

0
Intruso87
Intruso87

Question 4 months ago on Step 1

Can you send a link for buy ping pong balls?

0
jepoypoy
jepoypoy

4 months ago

Hi sirs out there can someone give a schematic diagram or circuit for this project? Plsss i want to build like these! Thankyouu in advance

0
LCDBASKET
LCDBASKET

4 months ago

¿Cómo están? Espero que puedan ayudarme.


Aprovechando la cuarentena obligatoria aquí en España y sin aburrirme, trato de hacer el increíble proyecto de thomasj152.


y empecé mal


Tengo los LED conectados y me gustaría hacer un código con la disposición de mis LED y su formulario de número.


Gracias y protéjase de COVID-19.


Espero tus respuestas. GRACIAS

HELP.png20200311_181151.jpg