AVR VGA generator


This simple circuitry makes up the hardware for [Andrew’s] AVR-based VGA generator. He managed to get an ATmega1284 to output a stable VGA signal. Anyone who’s looked into the VGA standard will know that this is quite an accomplishment. That’s because VGA is all about timing, and that presented him with a problem almost immediately.

The chip is meant to run at a top speed of 20 MHz. [Andrew] did manage to get code written that implemented the horizontal and vertical sync at this speed. But there weren’t enough clock cycles left to deal with frame buffering. His solution was to overclock the chip to 25 MHz. We assume he chose that because he had a crystal on hand, because we think it would have been easier to use a 25.174 MHz crystal which is one of the speeds listed in the specification.

Red, green, and blue each get their own two-bit range selected via a set of resistors for a total of 64 colors. As you can see in the video after the break, the 128×96 pixel video is up and running. [Andrew] plans to enlarge the scope of the project from here to make it more versatile than just showing standard images. The code (written in assembly) is available at his GitHub repository.

17 thoughts on “AVR VGA generator

    1. The pi is enormous and very expensive compared to a single AVR.

      Say you wanted to make a throwaway dongle to fit on the back of some monitors for a gag, you wouldn’t be using rpis for that would you?

        1. Because it is engineered for use with TVs, which by default (for some stupid reason) have some sort of 10% image zooming turned on.

          Usually when you turn it off you get more visible picture from your other sources too!

  1. Nice work, done alot of VGA work with FPGA’s luckily once you get it working on that you’re usually golden once you derive the proper clocks. Your milage may vary applies to digital tv’s more than ever. What works on one may not even on another of the same model!

  2. I Did this for my school final… I ran into a bunch of problems. But I used a 16F877A chip running at 4 MHz and the only real output I got was a checker pattern. a basic off/on on the output… I tried to get it to run at 20 Mhz, but I just couldn’t get it to work.. Even though I failed the project, I got a 100% due to me recognizing the limitations of the chip in the writeup… The teacher was real impressed I was able to do as much as I did with it..

  3. Also of use for doing this, Quinn Dunki has done it with a Atmega324, running at 10 MHz instead of overclocking. Halving the resolution to let you get away with some better timing and a few other things like that.

  4. Done it on an Uno once, used the timers for sync and SPI for pixel out, managed to get reasonably high res (2 actual pixels per soft pixel and 4 lines per soft line) that way

Leave a Reply

Fill in your details below or click an icon to log in:

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