Arduino VGA Games 4-in-1

3,060

27

16

Posted

Introduction: Arduino VGA Games 4-in-1

After the publication of the Arduino VGAx library on GitHub done by Sandro Maffiodo aka Smaffer, I have reproduced and published on Instructable some of the most famous classical games. Recently I decided to put four of them together, in particular: Pong, Breakout, Bomber and a drawing toy inspired to Etch-a-Sketch.

The hardware is simply the same of my first Instructables: VGA Pong with Arduino Uno.

The only needed components are two potentiometers, two buttons, few resistors and a DSUB15 (VGA) connector. As usual, no supporting IC or special shields!

You can see the 4-in-1 games in action in this video.

The VGAx library allows to use four color with a resolution of 120 x 60 pixels, not many but enough for this retro-game “console”. The graphic is raw but, thanks to the use of the potentiometers, the games run smoothly. Simple sound effects are available too.

Step 1: How to Build Your Own "4-in-1 Games" With Arduino

First download " ArduinoVGAgames" code at the bottom of this page and copy it on your PC in a directory with the same name. Then download the Smaffer’s VGAx libraries from this link on GitHub. The easiest way is to copy them in the Arduino software subfolder named "libraries", to be immediately recognized.

Uploaded then the code in your Arduino (I tested Uno and Nano). A worning for low available memory is normal. If you do not have other errors everything is ok and you can immediately start to build your own console.

For this you need:

  • an Arduino Uno Rev. 3 or an Arduino Nano 3.x
  • a 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 linear potentiometers (similar values are fine too)
  • two buttons other two resistors (from 1 to 2 kOhm are fine)
  • some piece of cable + breadboard or a strip board
  • facultative: a piezo speaker

The schematic is reported at the beginning of this Instructable, together with an overview of the finished “console”. The speaker must be connected to analog pin A0.

I placed the Arduino board with the VGA connector in a wood box, which holds also the second player potentiometer and button, while the main player potentiometer and button are in a separate and smaller box.

If you decide to reproduce this toy, I appreciate if you write a comment or send a picture in the comment section below.

Step 2: Some Final Comment

Joining four games in one was challenging, due to the Arduino lack of SRAM, the real bottle-neck of the VGA performances.

The AVR microcontroller has only 2048 bytes available to store and manipulate the variables. On the other hand the VGAx library stores the screen variables in a 120x60 pixels framebuffer where each pixel needs 2 bits (4 colors), for a total of 1800 bytes.

Only 248 bytes are then available for the sketch variables but, in my experience, one should leave at least 100 bytes free to avoid instabilities.

The VGA standard has been officially put in retirement in 2015, for being substituted with HDMI, and nowadays is almost impossible to find a new monitor or TV that implements it.

The question is then: does it make sense to produce an Arduino game for this standard? Well, I believe the answer is yes! For this reason, nowadays, almost everybody has an old and unused VGA monitor, eventually 4:3, still working fine, since it has been replaced with an HD one. If you, as I do, feel sorry to throw in the waste a working yet obsolete device, you can convert it in an old style retro-gaming station by means of a bare Arduino and few other components.

Share

Recommendations

  • Epilog Challenge 9

    Epilog Challenge 9
  • Paper Contest 2018

    Paper Contest 2018
  • First Time Author Contest 2018

    First Time Author Contest 2018
user

We have a be nice policy.
Please be positive and constructive.

Tips

Questions

16 Comments

Can I change some game to Tetris?

Yes sure! I did a newer instructable to do that! see here.

link isnt clickable

Tetris is here.

Now it should work.

What about composite 4-in-1 ? Would that be also possible?

Do you mean "composite video"? In my understanding having a composite color video output (RGB) for the Arduino exceeds its capabilities.

What about TVOut version, possible?

Yep! See my reply above, to DYI Circuits

Yes, I meant composite video, but I don't think that RGB is necessary just black and white composite video, there should be even a library for that.

Ok, then for B&W you can use the TVout library. My games can be converted for that but the conversion is not straight forward, many commands have a slighly different sintax. I did it (for instance) for tetris. You can find both versions here, among my other instructables.