make a VGA gaming system with any AVR

Generate VGA graphics using an AVR microcontroller and
an external frame buffer


Thanks to the cool folks at AVRFreaks.com forum for posting Brad’s VGA Video Generator in their tutorial section:  http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=99805

If you have been working on microcontroller projects for any length of time then you know that it can be difficult to display a large amount of data, especially when it contains more than just plain text. There are limits to how much useful information you can display on a basic character LCD, or even a dot matrix LCD, since most have low resolution, no color, and a poor refresh rate. I came up against this problem when working on a robotics project that needed to display a color image captured from a small camera and decided to see how much effort it would take to create an image on a VGA monitor using only a microcontroller to “bit bang” all of the necessary signals.

It took some time to learn how the 5 signals used on an analog VGA connection made an image appear on the screen, but the end results were much better than anticipated, providing a crisp 256 by 240 image on the monitor in 256 colors. Although it does take some intensive cycle accurate assembly programming, the basic coding is not very difficult to understand once you have learned what the monitor expects. In fact, making a microcontroller drive a VGA monitor is much easier than creating a video signal for a television because the VGA monitor does all of the difficult color coding for you as long as you send the video signals and sync pulses at precisely the right time. “Precisely” is the key!

This project is more like a tutorial, and is far from being perfect. The idea is to show how any microcontroller can be made to create a rock solid VGA image once timing parameters have been calculated properly. I am using an Atmel ATMega324 and ATMega644 for this project, but just about any microcontroller will work, once you understand the basics and decide on what type of image you want to display. This project will start off with a very minimal display system running from a single microcontroller and will progress up to a fully double buffered system that will display flicker free animations with a resolution of 256 by 240 and with 256 colors.

Any VGA monitor with a 15 pin analog connector will work, but the old-school glass CRT monitors will probably display the “nicest” image due to having round pixels and a truly analog horizontal line. Newer LCD monitors will work just fine, but there may be a slight “banding” effect on horizontal lines if you cannot adjust a setting called “pixel” clock. Nonetheless, the image will be very clean, crisp, and colorful on any VGA monitor.

I would like to thank the community on the AVRFreaks Forum for suggesting this tutorial and for all of the help that has been offered over the years by the many knowledgeable members. I hope this small project inspires those who want to generate video with a microcontroller and look forward to seeing what others can do to improve and modify these ideas!

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s