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.


  1. kay says:

    This is very awesome. I have to recommend a Propeller chip if you want to do vga out, but there is a lot of elegance in this method. I wonder if it’d play well with the 25.174?

  2. Hack Man says:

    Awesome but with the Pi doing HDMI out, it makes AVR chips like these look like dinosaurs.

  3. Max says:

    Why not use an XMEGA ? They support up to 32 MHz natively (and require minimal adjustments when migrating from normal avrs )….

  4. Alex Rossie says:

    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!

  5. Stoopid says:

    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..

  6. Ryan Voots says:

    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.

  7. Jack says:

    An AVR project that isn’t arduino based? Have my eyes deceived me?

  8. Arlet says:
  9. elias says:

    There are plenty of other examples. One of the nicest is this demo by Linus Aknesson: http://www.linusakesson.net/scene/craft/

    He is even abusing the SPI to output high resolution graphics.

  10. Peterbjornx says:

    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

  11. Spacedog says:

    nice presentation, implementation props for sharing the code.
    can’t wait to see the character se in action for updating images.t

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