Introduction: Personal Shot Clock

One thing that is common with every one of my projects is the theme of basketball. Well here's another one. This project is one that I have always wanted to work on improving my mindset during a real life timed situation in a basketball match. One of the most important factors of basketball that most people ignore is the shot clock as this piece of technology is what makes every game intense and what gives every player their adrenaline throughout the game. This instructable will give a step by step guide on how to make your own personal shot clock that will count down from 24 to 0 and create a buzzing sound with just the press of a button.

Step 1: Gather Materials

To make your own personal shot clock, one will need the following:

- Arduino x1

- Breadboard x1

- Jumper Wires

- 10K ohm resistors x2

- Seven segment displays (SSD) x2

- Button x1

Step 2: Understanding How to Use the SSD

Before starting to build the shot clock, you should understand how to use the SSD first (skip this step if you already know how to use it). Look at the diagram above. Each of the sides of the number above requires a different pin number. There is also a decimal point on each SSD, we will ignore this as we are only counting down from 24 to 1 in integers. Assign each side with a variable (I used letters and you should too) and assign these variables to the correct corresponding pin number. I've done this for you below:

Pin 2 = a

Pin 3 = b

Pin 4 = c

Pin 5 = d

Pin 6 = g

Pin 7 = f

Pin 8 = e

For example: If you wanted to make the number 5, you should figure out the sides needed to be on to display the number five. In this case, these would be sides a, f, g, c, and d. After figuring out the sides, find the pins associated with each side and write the code to turn those pins on. In this case, it would be pins 2, 7, 6, 4, and 5.

For the other seven segment display, it works the exact same way. Assign different pins to the each of the sides of the SSD. If you want to copy my code, I have used the pins shown below meaning that you will have to use these pins as well. I have also made use of the Analog In Pins as Digital Pins due to how there weren't enough of these to use for all components. This is not what it is used for normally but I have done this to avoid making use of a shift register. The following pins are:

Pin 13 = a2

Pin 12 = b2

Pin 11 = c2

Pin A0 = d2

Pin A1 = e2

Pin A2 = f2

Pin A3 = g2

Step 3: The Button

In this project, I have made use of a button so that the user will be able to start the clock with ease whenever they want and whenever they are ready to practise a play. The code I made for this is in the file attached to the instructable and what it does is start the countdown from 24 after being pressed. After the countdown ends, the button will be available to be pressed but not during the countdown. This is because the sole purpose of this project is to let basketball players practise how they would handle a game situation by practising tough shots with a time limit. Being in the mindset of a game late in the fourth quarter is one of the most intense mindsets children and professional players have.

As shown in the diagram, there are four legs that come out of the button. Leg A will have a wire that connects to 5V, leg B will have a resistor of 10K Ω that connects to ground, and leg D will have a wire that connects to digital pin 10 (in my case).

When creating the code for the button, you must declare a variable for the button, make it equal to 0, and state that the digital pin used for the button is an input component instead of an output. To do this, you write "int button = 0;" if you want the variable to be called "button" and under 'void setup()' in the case that the buzzer is connected to pin 10, "pinMode(10, INPUT);".

Now you must write the code for the button such that whenever it is pressed, something will happen. Under 'void loop()', you need to write the following:

button = digitalRead(10);


if (button == HIGH)


for (int i = 24; i >= 0; i--) {






Step 4: The Piezo Buzzer

One of the most prominent features of the shot clock is the piezo buzzer. In this project, I have made use of a piezo buzzer to recreate the sound the NBA uses to represent that the 24 seconds allowed for a basketball play has run out and you have to shoot the ball before the buzzer otherwise there is a turnover called the "shot clock violation" and as a result, the other team receives the ball.

The piezo buzzer has two legs; a positive leg and a negative leg. A wire should be connected from the positive leg to the digital pin you want to use (in my case, I used pin 9). Whenever you use a piezo buzzer and you want to produce a sound, you must input the number of hertz you want to output so that the piezo buzzer can produce the pitch you want. I used 200 hertz as it sounds very similar to the one used in professional basketball matches.

You must also state how long you want the sound to be produced in milliseconds (1000 milliseconds = 1 second).

An example of the code used when making the piezo buzzer function is the following:


tone(13, 128);




From the example above, we can find three pieces of information conveyed in the code.

- The pin used: pin 13

- The pitch produced: 128 hertz

- How long the sound is produced: 3 seconds (3000 milliseconds)

Step 5: Conclusion

Above is the image for what the project should end up looking like (try not to be messy when wiring).

As you saw in the image on the step of gathering the materials, you might have noticed a shift register. I had started this project by making use of a shift register to create more digital pins for me to use as there were not enough on the Arduino for all components to work. Using a shift register is difficult to incorporate into this project as it took me about 3 weeks to figure out how to use it. I suggest that you use the analog in pins as output pins and work from there.

I was planning to use large scaled components so that I could test the shot clock on an actual basketball court but my components did not arrive in time. I highly encourage you to buy the larger scaled components yourself online so that you can take this to the basketball court.

I hope this project helped to get yourself into a late close game mindset and I hope you are able to hit some nasty buzzer beaters before the time runs out!