Introduction: VGA Pong With Arduino Uno
I have repruduced a color version of the classic Pong running for a VGA monitor, using a bare Arduino Uno.
It is for two players and it has sound too. It has four colors and a resolution of 120 x 60 pixels.
My goal was to avoid any special shield or support IC!
I just used few resistors, a DSUB15 connector, a pair of potenziometers and buttons. The Arduino board and the others components are placed in two wood boxes. The second player paddle is connected to the main block by means of a recycled USB cable. Pictures of the whole "console" and a simple schematic are shown at the beginning of this video:
In the past I have reproduced the B&W version for TV, using the TVout libraries...
...but now, insted of the TVout library, the color Pong is done using the VGAx library recently written by Smaffer.
You can read further the details in this Arduino forum
Instructions to built your own Color Pong with Arduino
In brief, here you can download the latest code version, then you need the VGAx libraries from Smaffer on github published here.
NB it seems that the VGAx library is fully compatible only with Arduino IDE 1.6.4. Older or newer versions may not work properly or work at all.
Once you have the code uploaded an an Arduino Uno (I have Rev. 3) without errors, you can start to build your own console.
You need:
- an Arduino Uno Rev. 3
- DSUB15 Connector, i.e. a VGA female connector or a VGA cable to be cut.
- four resistors: 2 x 68 Ohm and 2 x 470 Ohm
- two 10 kOhm potentiometers
- two buttons
- other two resistors (from 1 to 2 kOhm are fine)
- some piece of cable
- facoltative: an USB female plug and an USB cable for the second player, or any other connector/cable with four wires
The schematic is reported at the beginning of this Instructable, together with an overview of the finished consolle and how the game looks on my TV.
I placed the Arduino board with the VGA connector in a wood box, which holds also the first player potentiometer and button. I used a second smaller wood box for the second player and I decided to connect it to the main one by means of an USB female plug and an USB cable. You can use any other connector/cable wich contains at least four separated wires.
Enjoy!
51 Comments
1 year ago
OK, so now I have the display but the paddles are jumpy. Is there a fix for that?
1 year ago on Introduction
I have an error message uploading the code - class VGAX has no member named 'print'
Can you help me with this?
Reply 1 year ago
did you install the VGAx Library, after downloading it from here ?
Reply 1 year ago
I think I figured it out. But now I am getting a DVI no signal on the monitor.
Reply 1 year ago
Maybe you have to enter in the monitor menu and select the VGA port. Some monitors have the automatic port detection, in some others you have to select the it manually.
Reply 1 year ago
Thank you. I did that but now says VGA no signal.
Reply 1 year ago
Yes, it is installed. The error message is class VGAX has no member named 'print'
6 years ago
Hello!
Nice projects, thank you!
Is it possible to put 4 your games in one sketch? It would be great!!!
Reply 6 years ago
Thank you for the compliment!
I think it is not possible, almost each game uses all the available memory for the variables and simply putting two or more games together would overtake the 100% of it.
But it would be possible to built a single "consolle" with four buttons and two wheels compatible with all the games, one has just to re-map buttons an potenziometers in the code. I plan to do that as soon as I have time, may be during the Christmas holidays. You just need then to upload the code in the same device.
Reply 6 years ago
It`s true, but if we choose ONE game in start menu (when it powered up or by pressing a reset) - we don`t need a room for variables of ANOTHER games.
About "consolle": I think, it needs one universal connector for 2 types of the manipulators - pot-s or buttons.
Reply 6 years ago
well, it is not so simple. If you join two games in the same sketch (each one with its own variables), the Arduino memory is occupied from the whole variables as soon as they are defined, even if you do not really use the ones for the first game when you play to game two.
The good news is that many variables can be used for one game or the other, you just need to assign theme one value or another, and this save space.
I have a working sketch now where one can choose between pong or breakout, and I plan to add more, but it will take time.
Reply 4 years ago
And if you put a SD card module for expand the memory and the arduino ges int the card cath a game whn we "quest" him to do this ?
Or an EEPROM?
4 years ago
You can send me a diagram and the code for the B&W and TVout version?
Question 5 years ago
Boa Noite... Poderia me passar a programação deste projeto?
Answer 5 years ago
http://forum.arduino.cc/index.php?action=dlattach;topic=328631.0;attach=135889
Question 5 years ago
it worked but there is flickering. suggest how to get rid o it. thnx
Answer 5 years ago
Try different Arduino IDE. I am usinge version 1.6.4
5 years ago
How to align this to center and get rid of the distortions?
5 years ago
Hi. Nice Project :)
Can I use this game for my design project ? thanks.
6 years ago
Hello
We have uploaded the code to the Arduino board but the monitor is showing no signal