Arduino Pong




Introduction: Arduino Pong

This Instructable is based on a how-to written by James Bruce:

Note: This project will not work with the Arduino Yún. An Arduino Uno, Nano or one with a similar architecture is advised.

The requirements:

1x Arduino (I used the Uno. Again, the Yún won't work)

1x 470 ohm resistor

1x 1k ohm resistor (I used a 1.1k ohm resistor)

1x Jumper wire

2x 10k ohm Potentiometer

1x RCA video cable

1x Pushbutton

1x 10k ohm resistor

Step 1: Download the TV Out Library

You can download the library ( from here:

You'll want to unpack the .zip file and copy the resulting folders to either Program Files (x86)/Arduino/libraries or Documents/Arduino/libraries.

Step 2: The RCA Cable

Take on end of the RCA cable and strip the outer layer away. Gather up the shielding, twist it and put it away to one side. This is your ground. In the centre should be another cable with some plastic shielding around it. Strip this away as well. This is your signal line. Next you'll want to take your 470 ohm and 1k ohm resistor and solder them both to the signal line. Plug the 470 Ohm resistor into pin DO7 on your arduino and the 1k resistor into pin DO9. This will produce the analogue video input. After that you can take the jumper wire and solder it to the shielding outside of the RCA. This jumper wire needs to be plugged into one of your Arduino's GND pins. If you want you can test TV Out by loading in an example in the Arduino IDE (File>Examples>TVout>DemoPAL or DemoNTSC depending on your region)

Step 3: ​The Potentiometers

Each potentiometer should have 3 pins. The middle one needs to be connected to either A0 or A1 on your Arduino. One of the side pins (it doesn't matter which) should be connected to +5V and the other to GND. You can find a full Fritzing diagram and some pictures above. You can once again test this if you want by using an example from the Arduino IDE (File>Examples>Analog>AnalogInput)

Step 4: The Start Button

Next you'll want to wire a pushbutton to pin DO2. Again, a diagram and pictures can be found above.

Step 5: ​The Pong Code

You can download the Pong code (written by Lamonica and modified by duboisvb) from this pastebin:

Step 6: ​Have Fun!

That's everything. Pong is obviously a very simple game but you should still be able to get some fun out of it. If you want to speed the game up a bit try changing the 3 in if(frame % 3 == 0) to a 2 or even a 1. Credit goes to Alex in the comment section of the original how-to article for that one.



    • Tiny Home Contest

      Tiny Home Contest
    • Water Contest

      Water Contest
    • Creative Misuse Contest

      Creative Misuse Contest

    12 Discussions

    I'm having trouble with the code and I don't know how to solve it.

    Line: void processInputs() {

    Error: a function-definition is not allowed here before '{' token

    If it's an easy fix please don't ridicule me, I'm just a beginner. And if you need more information tell me what you need.

    Very nice projekt, works well for me. I had some trouble with the arduino code. Even though arduino should do this by itself I needed to declare the drawMenu() function at the start of the code (after global variables). I will try to make the game a little more modern with variable angle depending on where you hit on the pad etc.

    This creative project makes use of a small CRT TV...You can probably add a clock to make it more useful.Also a sound output would be very desireable. Thumbs up

    The original Joysticks, were nothing more than Potentiometers themselves, just moving a 45-degree (<40%) travel of the potentiometer' full travel. You can make your own, putting the potentiometer through a thin panel, and connecting a "bat' level to the wiper, then simply put limits to the 45-degrees of center.. Then, comes the fun, of adjusting the arduino code, (the PONG game portion, where it reads A0 & A1) to only see the limited travel of the pots.. Just would require a little more work on the controllers. Or, are you talking the Atari 2600-Joysticks? The 2600 joysticks were only push-button. (logic 0 & 1), That would require the arduino code to react to 4 digital lines in, 2x up, and 2x down.. and require the arduino to monitor which button was pushed, and move the virtual paddle (on-screen) to match.

    I stand with foot-in-mouth.. when I said <40%, it should've said <20%.. (divide 100/4=25, and since potentiometers only move 80% of a full circle...)

    I stand with foot-in-mouth.. when I said <40%, it should've said <20%.. (divide 100/4=25, and since potentiometers only move 80% of a full circle...)

    Everything was displayed on my TV, but the pots weren't moving the paddles, nor was the start button working. I tested my wiring/pots using the example sketch for analog input and they were working properly. Any ideas?

    Just made it. It is beautiful ! Will add photos and info about it later! Very nice instructable Just needs a final photo of the screen and the Arduino working. Wans`t so sure if it was going to work! Btw what was the 10k ohm resistor for? Haven`t used it :P Discovering it was quite annoying just like an extra screw when everything is back in place ^^

    1 reply

    It's for the start button (as you can see in the fritzing diagram). Not sure how you got it to work without it but oh well. Glad you had fun :)

    I'm so trying this! :)

    Awesome arduino project. You should enter this in the Arduino All the Things contest.