Figure 0 - Microcontrollers are well suited to display information on analog VGA monitors
Microcontrollers are well suited to display information on analog VGA monitors

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 five 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 ATMega644 for this project because it has a large program memory to allow the storing of image data, 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!

Figure 1 - You will need a female VGA connector to hook up to your monitor cable
Figure 1 - You will need a female VGA connector to hook up to your monitor cable

You can either order a new 15 pin female D-Sub VGA connector such as the Digikey (A35116-ND), or simply salvage one by unsoldering it from an old VGA card. Cutting a VGA cable extender would also work, but then you will have to decide the wiring and solder the ends for use on your breadboard as you prototype this project. Old VGA cards are a dime-a-dozen at most surplus electronics shops. You can probably ask a computer repair shop for a fried VGA card to hack for parts. All you need is the female 15 pin VGA connector so that you can solder the necessary wires to connect to your breadboard.

Back Home Last Next
You are Viewing... Page 1 of 16
Lucid Science Electronics from the Fringe AtomicZombie Hack-a-day SparkFun