Arduino Snake on a VGA Monitor

About: Family man, developer, gamer, stargazer...

Well... I bought an Arduino. Initially, the investment was motivated with something that would make my daughter interested in programming. However, as it turned out, this thing was more fun to play with for me.

After playing around with making LED's light up, button interaction and serial printing, I decided to set raise the bar a bit and actually make something. As one of my biggest interests is gaming it was naturally going to be something gaming-related, and therefore I decided to create my own little arcade machine. I quickly realized that the actual cabinet-building had to be a future project, and that I needed to focus on wrapping my head around programming with the limited resources that Arduino has to offer. So I decided that a good first game would be Snake.

In order to get started I had to wrap my head around how to solve input and display. For input I wanted a genuine arcade feeling, so I purchased an arcade joystick and buttons. Display was a bit trickier as I did not want to be limited to small TFT screens. I then found the awesome VGAX library by Sandro Maffiodo. However, since I had to solder my own VGA port, this meant that I had to revisit the art of soldering, something I've not done since school (more than 20 years ago).

So, without further talking, here is how I made my first Arduino project!

Step 1: Requirements

Step 2: Solder the VGA Port

I started by soldering the VGA port. The best instructions I could find for this was on Sandro Maffiodos VGAX page.

I noticed that it was easier to start solder the connections in the middle row on the VGA port. Starting with any of the other rows made it hard to reach the middle connections without solder off the existing connections (probably due to me having a big and cheap soldering iron).

Step 3: Connect Everything to the Arduino

I then connected everything to the Arduino. I made a fritzing chart above that you should be able to follow (warning, there are lots of cables that are easily tangled up together).

The VGAX library has support for 4 colors only, however you can choose among 6 different color schemes. These are defined by connecting the VGA cables for RGB in various combinations. Check out Sandro Maffiodos VGAX page to learn more.

Step 4: Upload the Game

The game source code is available on my GitHub.

Step 5: Enjoy!

You can now engulf yourself in 10 levels of good old retro Snake!

I hope you enjoyed this instructable!

Please follow me on YouTube and Twitter if this was of value for you.

Share

Recommendations

  • Trash to Treasure

    Trash to Treasure
  • Paper Contest

    Paper Contest
  • Remix Contest

    Remix Contest

2 Discussions

0
None
honocorp

8 weeks ago

John, congratulations, this an outstanding project !
I spent hours and hours playing snake on my Apple II during college.
However, if newbies try to make it, it won't work ! Your Fritzing is not according to your .ino.
Line 200, you set up pin 11 as input for actionButton, but it's connected to a Joystick switch.
Line 202, you set up pin 13 as input for JoyDown but it's not connected to anything on Fritzing.
The action button is actually pulled down but not connected to any pin of the Adruino.

No big deal, and as you say... a lot of wires ! So this post might help some.

As for me, I prefer the two buttons version. Right and left following snake movement. It's a bit more tricky as when the snake goes down, you have to press Right to actually go Left... I'll dig a bit in the script and adapt it to my preference.
It will definitely end up with a stand alone arcade Snake finally using an outdated 15" screen.

Thanks again for this project !


0
None
DIY Hacks and How Tos

11 months ago

Fun project. I always thought that Arduino could make a video game system.