Arduino VGA Games 4-in-1

10,343

38

24

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.

Be the First to Share

    Recommendations

    • Battery Powered Contest

      Battery Powered Contest
    • Plywood Challenge

      Plywood Challenge
    • Plastic Contest

      Plastic Contest

    24 Discussions

    0
    msameer39
    msameer39

    14 days ago

    Excellent. Simply superb

    0
    im_hotep500
    im_hotep500

    5 weeks ago

    Good afternoon. I built the game, it worked perfectly, but I'm having difficulties with the sound. I installed normal 8 ohm speakers, installed piezoelectric devices on the A0 + GND port and was unsuccessful. I checked the sketch to find some definition of musical notes or buzzer commands, or definitions of port A0, and also found nothing. Also during the execution of the game I measured voltage at port A0, and always as a result 0 Volts. Can you help me? Thank you
    0
    barteklepko
    barteklepko

    Question 10 months ago

    Tell me how to connect the speaker because I plugged it into the pin A0 and vcc and only the noise was heard instead of noises

    0
    Rob Cai
    Rob Cai

    Answer 10 months ago

    Hi, just connect the speaker pins to A0 and GND. NB, if you have an high impedance speaker, such as a piezo, connect it directly. If it is a low impedence one (a normal speaker), you may need some resistors in series, i think few hundreds ohms.
    By the way, I update this project here with five games.

    0
    barteklepko
    barteklepko

    Reply 10 months ago

    Thanks

    0
    barteklepko
    barteklepko

    Question 10 months ago

    Hello,Is it possible to replace a 4: 3 monitor with a 16: 9 monitor to work properly?

    0
    Rob Cai
    Rob Cai

    Answer 10 months ago

    Hi, it is possible to use any monitor but with a 16:9 the image will be stretched. There is no simple methode to squeeze the image back unless by reprogramming all the games.

    0
    simaopintocorreia
    simaopintocorreia

    1 year ago

    I only have one thing to say:
    I will do this, I will buy the components, get a VGA (video graphics array) monitor and hope it works well.

    0
    do_morro
    do_morro

    3 years ago

    Can I change some game to Tetris?

    0
    Rob Cai
    Rob Cai

    Reply 3 years ago

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

    0
    vadym6
    vadym6

    Reply 3 years ago

    link isnt clickable

    0
    Rob Cai
    Rob Cai

    Reply 3 years ago

    Tetris is here.

    Now it should work.

    0
    DIY Circuits
    DIY Circuits

    3 years ago

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

    0
    Rob Cai
    Rob Cai

    Reply 3 years ago

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

    0
    chanov
    chanov

    Reply 3 years ago

    What about TVOut version, possible?

    0
    Rob Cai
    Rob Cai

    Reply 3 years ago

    Yep! See my reply above, to DYI Circuits

    0
    DIY Circuits
    DIY Circuits

    Reply 3 years ago

    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.

    0
    Rob Cai
    Rob Cai

    Reply 3 years ago

    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.

    1
    fredlb
    fredlb

    3 years ago

    Hi,

    I want try do this project , it's amazing !

    But the problem my screen is completely disformed like you can see on the picture above.

    I try another monitor and another power but the problem was the same

    Perhaps it's because i'm working for the moment with a breadbord ?

    Thanks for you attention :-)

    pong.jpgpong2.jpg
    0
    fredlb
    fredlb

    Reply 3 years ago

    Finally

    i find myself the solution of my problem ...

    I change my version of Arduino , i try the version of this instructable (1.6.4) and it's working fine !

    Perhaps a picture of my versio coming soon ...