VGA signal generation hacks

This is continuation to Interesting VGA hacks hacks posting. Interesting VGA hacks hacks was concentrated on using VGA card for nontraditional uses, this posting on the other hand concentrates on generating VGA signals with other hardware than VGA graphics card.

It seems that modern microcontrollers are well suited to display information on analog VGA monitors:

AVR VGA generator implements VGA on microcontroller. This AVR-based VGA generator uses ATmega1284 to output a stable VGA signal. Anyone who’s looked into the VGA standard will know that this is quite an accomplishment. Red, green, and blue each get their own two-bit range selected via a set of resistors for a total of 64 colors. 128×96 pixel video is up and running.

Arduino Uno output to VGA monitor project shows how you can output VGA signals to a monitor, turning your Uno (or similar) processor into a “video card”. The biggest challenge is to ge the pixel data out – it just can’t be done with software running on this processor and we also don’t have enough memory to even hold those pixels all at once.   The fastest way we can get bits “out the door” is using the SPI hardware.

Code: VGA RGB Signal project Connect Arduino to VGA input on TV. You can find the circuit diagrams and code at Github at arduino-vgaout.

VGA interfacing AVR microcontrollers project shows us how to push data to a VGA monitor from your AVR project.  It turns out that it is pretty simple, requiring only n open port and a few resistors and diodes. Well, it is that simple for the most basic version which gives you 56×60 pixels. Version 2 outputs 240×240 resolution.

Microcontroller VGA Interface projects page (tinyvga.com) show examples how to use Microchip PIC 16F84 VGA Output and several versions for Atmel AVR VGA outputs.

Other popular way to generate VGA signal is to use FPGA chips:

FPGA VGA Resistor DAC page tells that VGA is a very friendly protocol to use with FPGA’s and CPLD’s and because of this we can easily build video controllers with basic PLDs. The VGA protocol itsself is slow, running around the 20-30 MHz range depending on the resolution chosen, meaning that we can even breadboard or wire-wrap prototype designs!

VGA Controller (VHDL) page shows a VHDL source code of a VGA interface controller. It generates the signal timing for a VGA interface, offers configurable VGA mode (i.e. resolution and refresh rate). The page has an example implementation using a DE2-115 development board.
FPGA Tutorial 4. VGA in VHDL on Altera DE1 Board video tutorial I will show how to program VGA interface in VHDL, suing DE1 Altera board. Eventually it will program a simple game.

Pong Game page shows that FPGAs can become video generators easily. The pong game consists of a ball bouncing on a screen. A paddle (controlled from a mouse here) enables the user to make the ball bounce back up.

Draw VGA color bars with FPGA in Verilog page mentions a FPGA workshop. The most useful comments will be in the VGA controller module we wrote: vga640x480.v.

Design Recipes for FPGAs – A Simple VGA Interface article gives tips for VGA implementation using FPGA.

 

Other related information:

Calculator for video timings

VGA signal timing

VGA timings

VGA signal timing calculation using MCU

 

107 Comments

  1. Tomi Engdahl says:

    This is nuts old-school hardware hacking.
    The trick is that this classic video game is made out of discrete components — it is 100% IC free. I like the beauty of it’s complex wiring!
    https://blog.hackster.io/video-pong-made-with-all-discrete-components-cbffe6a2721d
    http://www.glensstuff.com/videopong/videopong.htm

    Reply
  2. Tomi Engdahl says:

    Having picked up a bulk supply of VGA capture cards for pennies on the dollar, developer Ben Cox sets out to get them working on a modern Linux build.

    Ben Cox Revives Epiphan’s VGA Capture Cards with Custom Reverse-Engineered Linux Driver
    https://www.hackster.io/news/ben-cox-revives-epiphan-s-vga-capture-cards-with-custom-reverse-engineered-linux-driver-4fb8de896605

    Having picked up a bulk supply of VGA capture cards for pennies on the dollar, Cox sets out to get them working on a modern Linux build.

    Writing userspace USB drivers for abandoned devices
    https://blog.benjojo.co.uk/post/userspace-usb-drivers
    https://github.com/benjojo

    Reply
  3. Tomi Engdahl says:

    Land Boards’ FabGL-Compatible ESP32-VGA Brings Video, Audio Output, PS/2 Input to the ESP32-WROOM
    https://www.hackster.io/news/land-boards-fabgl-compatible-esp32-vga-brings-video-audio-output-ps-2-input-to-the-esp32-wroom-3c54c9c42d20

    Built as part of a project to create a low-cost ANSI terminal, the design includes inputs and outputs well-suited to retro computing.

    Land Boards’ Doug Gilliland has released PCBs for his latest retro computing-inspired design: the ESP32-VGA, which adds a VGA video output plus PS/2 connectors for a keyboard and a mouse to the popular Espressif ESP32-WROOM microcontroller module — and which boasts full support for the FabGL library.

    “FabGL has a great library for doing VGA with the ESP32,”

    The card, which accepts the Feather-style ESP32-WROOM development board on a set of female headers, supports all the FabGL libraries.

    http://land-boards.com/blwiki/index.php?title=ESP32-VGA

    Reply
  4. Tomi Engdahl says:

    This entire project relies on the Raspberry Pi’s ability to generate a VGA (Video Graphics Array) signal. Most people connect displays to their Raspberry Pi through the HDMI port, which will give you the best picture quality and performance. But you can also use the Raspberry Pi’s GPIO (General Purpose Input/Output) pins to generate a VGA signal. This requires the coordination of HSYNC, VSYNC, and data signals, but the Raspberry Pi has built-in utilities to handle that. By setting those to the configuration described in the tutorial, you can output a video signal

    https://www.hackster.io/news/revive-your-old-macintosh-classic-with-a-raspberry-pi-0e679f8bd168?c2937f3a1b3a177d2408574da0245a19

    Reply
  5. Tomi Engdahl says:

    You should never underestimate the endless possibilities the humble breadboard can offer. This video is well worth a look.

    https://m.youtube.com/watch?feature=youtu.be&v=l7rce6IQDWs

    Reply
  6. Tomi Engdahl says:

    An Open Source HDMI Implementation For FPGAs
    https://hackaday.com/2020/06/02/an-open-source-hdmi-implementation-for-fpgas/

    With some clever hacks and fast IO work, it’s possible to get your average garden-variety microcontroller to output some form of video. Old analog standards like composite and VGA are just slow enough that it’s possible to bitbash one’s way to success. If you’re serious about video work, however, you’ll want something more capable. For those use cases, [purisame]’s got what you need – an open source HDMI implementation for FPGAs.

    Unlike other free and open source projects in this space, [purisame] has eschewed simply outputting compatible DVI signals on the port. This implementation is pure HDMI 1.4b, enabling the extended capabilities this brings, like combined video and audio streams. Thus far, it’s been tested on Xilinx and Altera platforms, though it may be compatible with Lattice, too.

    Send video/audio over HDMI on an FPGA
    https://github.com/hdl-util/hdmi/
    https://purisa.me/blog/hdmi-released/

    Reply
  7. Tomi Engdahl says:

    Taking advantage of higher-order harmonics, Manzel Seet’s PAL Streamer can output valid video signals from slower microcontrollers.

    Outputting a Video Signal From a Microcontroller’s GPIO Pins — Through Square-Wave Harmonics
    https://www.hackster.io/news/outputting-a-video-signal-from-a-microcontroller-s-gpio-pins-through-square-wave-harmonics-a42c99e52137

    Taking advantage of higher-order harmonics, Manzel Seet’s PAL Streamer can output valid video signals from slower microcontrollers.

    “I wanted to make a simple & cheap analog TV transmitter from parts I had lying around,” Seet explains of the project’s origins. “I searched online and I came across @CNLohr avr_vhf project. He used an AVR ATtiny85 to generate PWM waveforms which were picked up by his TV.”

    “I found it clever and genius because I didn’t know that a square wave PWM could serve as AM modulation. In his case, he both overclocked the MCU to 30MHz and used PLLx8 to the timer. Thus, his timer is clocked at 240MHz and with a period of 4, its output is 60MHz (approximately the frequency of CH3).

    The breakthrough came in using harmonics: “I realized that PWM is a square wave and thus it has odd harmonics. I thought it would be creative if I could simply output a lower frequency of which its harmonics matches the TV channel frequency,” Seet explains. “In my case, through trial and error, I managed to get a clear image on the TV with a 6.86MHz PWM output. The 9th harmonic is 61.71MHz which is about CH3 frequency. In theory, you can replicate this behavior on any slow microcontroller (like an Arduino Uno which does not have PLL

    With some wiring, a Python script, and a TV with analog tuner still present and functional — an increasingly rare site these days — Seet was able to successfully play back still images and animated GIFs from a PC via a USB connection to an STMicro STM32 Nucleo development board. While the system works without external components, Seet admits it could be improved by the addition of a bandpass filter to avoid interference across other channels.

    Reply
  8. Tomi Engdahl says:

    Easily generate retro-looking VGA graphics for your Arduino projects!

    MiniVGA
    Easily generate a VGA signal for your Arduino projects.
    https://www.hackster.io/nickbild/minivga-216797

    Reply
  9. Tomi Engdahl says:

    Easily generate a VGA signal for your Arduino projects with the Nano 33 IoT-driven MiniVGA.

    MiniVGA
    Easily generate a VGA signal for your Arduino projects.
    https://create.arduino.cc/projecthub/nickbild/minivga-216797

    MiniVGA generates a 200×150 @ 60Hz 3-bit color VGA signal. The interface is simple and can be controlled by GPIO from any number of devices, such as Arduino microcontroller dev boards or custom built retrocomputers.

    A TinyFPGA BX has been programmed to generate an 800×600 @ 60Hz VGA signal. Each pixel is repeated 4 times horizontally and vertically to yield a resolution of 200×150 pixels. Screen data is continually refreshed based on the data stored in a section of the BRAM dedicated to this purpose.

    The interface consists of a 15 bit address bus, 3 bit data bus, and an interrupt signal. To set a pixel color, set the desired address on the address bus (top left pixel = 0; bottom right pixel = 29, 999).

    Reply
  10. Tomi Engdahl says:

    Add an open source, true HDMI port to your FPGAs with this HDL implementation of an HDMI controller.

    Open Source HDMI for FPGA
    https://www.hackster.io/news/open-source-hdmi-for-fpga-f3e885b41aa5

    Add an open source, true HDMI port to your FPGAs with this HDL implementation of an HDMI controller.

    While the major FPGA vendors such as Xilinx and Intel provide IP blocks for an FPGA developers to implement HMDI signaling in their designs, this locks the design to that particular FPGA chip family. When the event arises such that a design needs to be portable between FPGAs from various vendors, developers turn to either an open source implementation of HDMI or to writing their own from scratch.

    Written in System Verilog, this pure HDMI 1.4b implementation can be tailored to fit any system specifics that it is instantiated within. From double data rate I/O to the specific desired refresh rate, the top level System Verilog file can control how the module is built in the programmable logic of a given FPGA.

    One thing to keep in mind with this, and any HDMI implementation on FPGA, is that FPGAs do not support the TMDS (transition-minimized differential signaling) communication interface. Thus LVDS with 100nF capacitors in series on the lines to try to mimic the impedance that the twisted pair lines of TMDS has may be necessary.

    https://github.com/hdl-util/hdmi/

    Reply
  11. Tomi Engdahl says:

    Open Source HDMI for FPGA
    https://www.hackster.io/news/open-source-hdmi-for-fpga-f3e885b41aa5

    Add an open source, true HDMI port to your FPGAs with this HDL implementation of an HDMI controller.

    Reply
  12. Tomi Engdahl says:

    Taking advantage of higher-order harmonics, Manzel Seet’s PAL Streamer can output valid video signals from slower microcontrollers.

    Outputting a Video Signal From a Microcontroller’s GPIO Pins — Through Square-Wave Harmonics
    https://www.hackster.io/news/outputting-a-video-signal-from-a-microcontroller-s-gpio-pins-through-square-wave-harmonics-a42c99e52137

    Taking advantage of higher-order harmonics, Manzel Seet’s PAL Streamer can output valid video signals from slower microcontrollers.

    through trial and error, I managed to get a clear image on the TV with a 6.86MHz PWM output. The 9th harmonic is 61.71MHz which is about CH3 frequency. In theory, you can replicate this behavior on any slow microcontroller (like an Arduino Uno which does not have PLL).”

    With some wiring, a Python script, and a TV with analog tuner still present and functional — an increasingly rare site these days — Seet was able to successfully play back still images and animated GIFs from a PC via a USB connection to an STMicro STM32 Nucleo development board. While the system works without external components, Seet admits it could be improved by the addition of a bandpass filter to avoid interference across other channels.

    Reply
  13. Tomi Engdahl says:

    The uChip Simple VGA Console Is a Portable 8-Bit Gaming Device
    The uSVC is designed around a SAM D21 MCU, offers 320 x 200 resolution, and can be used with standard USB gaming controllers.
    https://www.hackster.io/news/the-uchip-simple-vga-console-is-a-portable-8-bit-gaming-device-59d162f54d49

    Reply
  14. Tomi Engdahl says:

    Gameduino 3X Dazzler HDMI Arduino Shield Launches on Crowd Supply
    https://www.hackster.io/news/gameduino-3x-dazzler-hdmi-arduino-shield-launches-on-crowd-supply-e42656abff2b

    The Gameduino 3X Dazzler is an Arduino shield with a GPU, FPGA, HDMI, and Python support for gaming and audiovisuals.

    Reply
  15. Tomi Engdahl says:

    Inspired by Ben Eater’s “world’s worst video card,” George Foot’s design reduces the component count to a bare minimum.

    George Foot’s VGA “Video Card” Fits on One Breadboard — Nearly — and Could Be the World’s Simplest
    https://www.hackster.io/news/george-foot-s-vga-video-card-fits-on-one-breadboard-nearly-and-could-be-the-world-s-simplest-9763b6341c5c

    George Foot has created what may very well be the world’s most basic “graphics card,” in the form of a component-reduced breadboard circuit inspired by Ben Eater’s earlier VGA output circuit project.

    “Inspired by Ben Eater’s ‘World’s Worst Video Card’ video, I wanted to see how low we could get the chip count, and whether it would fit on a single breadboard,” Foot writes of his project. “It would have done, if I’d squeezed it in more tightly! The key simplification from Ben Eater’s design is getting rid of all the logic for working out the sync signals and just storing that in the EEPROM instead, along with the image data. It has some effects on the output resolution options, but is very effective at reducing the chip count, making this a very accessible way to experiment and tinker with video output!”

    “There were a lot of compromises to keep the IC count low

    Full details, including schematics, EEPROM image, and Python scripts, can be found on the project’s Hackaday.io page.

    World’s Simplest TTL VGA circuit?
    How many TTL ICs do you actually need to output a VGA image?
    https://hackaday.io/project/175434-worlds-simplest-ttl-vga-circuit

    Reply
  16. Tomi Engdahl says:

    A VGA Retro Console With Everything Generated From A Single ARM Cortex M0
    https://hackaday.com/2020/10/28/a-vga-retro-console-with-everything-generated-from-a-single-arm-cortex-m0/

    uChip Simple VGA Console
    Cortex M0+, open source retro-gaming console, which connects to VGA and uses USB Gamepads/Keyboards.
    https://hackaday.io/project/172215-uchip-simple-vga-console

    Reply
  17. Tomi Engdahl says:

    Oscilloscope Learns How To Speak Japanese, And VGA
    https://hackaday.com/2021/01/20/oscilloscope-learns-how-to-speak-japanese-and-vga/

    previously developed the hardware needed to convert a VGA signal into X- and Y-axis analog outputs,

    VGA display… On a 3″ scope tube!
    https://oscilloclock.com/archives/2496

    Reply
  18. Tomi Engdahl says:

    Control short animations of different emojis over VGA (480p) using UART and a Xilinx, Inc. Zynq board.
    https://www.hackster.io/dominic-meads/animate-emojis-using-zynq-uart-and-vga-c3b851

    Reply
  19. Tomi Engdahl says:

    Running Six VGA Projectors From A Single ESP32
    https://hackaday.com/2021/08/18/running-six-vga-projectors-from-a-single-esp32/

    Today’s microcontrollers are high-speed powerhouses that can do absolutely wonderous things. By virtue of fast clock speeds and special DMA hardware, it’s often possible to achieve great feats that seem almost ridiculous at face value. [Bitluni] decided to demonstrate just that, running six (6!) VGA displays from a single ESP32.

    The ESP32 clocks in at 240 MHz at top speed. It also features some nifty DMA hardware along with GPIO mapping that makes it perfectly suited to this task. [Bitluni] was thus able to set it up to drive up to six VGA displays at one bit per pixel monochrome output. Alternatively, ganging up six output pins into two sets of three, he was able to run two VGA displays with 3-bit color. The resolution is an impressive 640 x 400 in both cases, and [Bitluni] demonstrated the hardware by driving six projectors with a starfield display.

    https://www.youtube.com/watch?v=HEM04lS2R-Y

    Reply
  20. Tomi Engdahl says:

    Creating Video From A ROM
    https://hackaday.com/2021/09/10/creating-video-from-a-rom/

    We’re used to computers with display screens, yet how many of us have created the circuitry to drive one directly? Sure, we’ve coded up an SPI display driver on a microcontroller, but create the hardware to generate a usable video signal? That’s a little more difficult. [Jdh] has given it a go though, with a TTL video card.

    https://www.youtube.com/watch?v=OW1EmG7b4DU

    Reply
  21. Tomi Engdahl says:

    https://eater.net/vga
    Let’s build a video card!
    In these videos, I talk about how VGA signals work and build a circuit that provides the correct timing of sync signals so that a monitor recognizes the signal and displays an image stored on an EEPROM.

    Reply
  22. Tomi Engdahl says:

    A Slim 7400 Logic VGA Board For All Your Retro Needs
    https://hackaday.com/2021/12/14/a-slim-7400-logic-vga-board-for-all-your-retro-needs/

    Over the years we’ve seen a number of hackers generate VGA with 74xx logic chips, but they’ve generally not been the most practical of builds. Often put together as part of a competition or purely for the challenge, these circuits are usually implemented in a mass of jumper wires and often take up multiple breadboards. Not exactly something you can toss in a drawer when you’re done with it.

    But the Vectron VGA Plus, created by prolific hacker [Nick Bild] manages to improve on things considerably. Designed specifically to be smaller and simpler than its predecessors, the custom PCB contains far fewer chips than we’re used to seeing for this kind of thing. At the same time it provides a handy header row along the bottom that allows the user to connect whatever they’re working on, from microcontrollers to retro computers.

    Vectron VGA Plus
    Vectron VGA Plus generates a 640×480@60Hz VGA signal and has an interface that works with retro computers or microcontrollers.
    https://github.com/nickbild/vectron_vga_plus

    Reply
  23. Tomi Engdahl says:

    Vectron VGA Plus
    Vectron VGA Plus is a VGA graphics adapter that can interface with retro computers or microcontrollers.
    https://create.arduino.cc/projecthub/nickbild/vectron-vga-plus-92331a

    Reply
  24. Tomi Engdahl says:

    Raspberry Pi Pico Video Output
    https://picockpit.com/raspberry-pi/raspberry-pi-pico-video-output/

    The Raspberry Pi Pico is an incredible little microcontroller. While it does not have a video output interface built-in, like it’s bigger Raspberry Pi Zero / 1 / 2 / 3 / 4 / 400 brethren (HDMI / double HDMI in their case), it is possible to add a video output to the Pico! (As VGA or DVI over an HDMI connector, read on for details)

    We’ll explain why a video out is a very special feature for microcontrollers, and what types of video out you can build or purchase for your Pico. We’ll also show you some sample code – already precompiled for you, so you can download it, and talk about what you need to modify to make it run.

    Reply
  25. Tomi Engdahl says:

    NTSC Color Composite Video From ESP_8_BIT by rossumur
    https://newscrewdriver.com/2021/04/28/ntsc-color-composite-video-from-esp_8_bit-by-rossumur/

    GitHub user rossumur found a way to generate color NTSC composite video signal from an ESP32 on stock unmodified hardware. The clever video hack was done using, of all things, an audio peripheral called the Phase Locked Loop. This color video capability formed the basis of an 8-bit video game console project called ESP_8_BIT, and I had to take a closer look.

    Reply
  26. Tomi Engdahl says:

    Recreating An Analog TV Test Pattern
    https://hackaday.com/2023/06/09/recreating-an-analog-tv-test-pattern/

    While most countries have switched to digital broadcasting, and most broadcasts themselves have programming on 24/7 now, it’s hard to remember the ancient times of analog broadcasts that would eventually stop sometime late at night, displaying a test pattern instead of infomercials or reruns of an old sitcom. They were useful for various technical reasons including calibrating the analog signals. Some test patterns were simply camera feeds of physical cards, but if you wanted the most accurate and reliable test patterns you’d need a Philips pattern generator which created the pattern with hardware instead, and you can build your own now because the designs for these devices were recently open-sourced.

    [Matt] from [Matt’s TV Barn], as the name implies, has an interest in various television technologies, and this is such an iconic piece of machinery that can’t easily be purchased, so he set about recreating the signal generator on his own. All of the source for these cards can be found at this GitHub page for anyone interested, and most of the parts can still be found today. The main exception being the adjustable inductors, which [Matt] needed to build from scratch.

    #7 – Building a Philips PT8631 pattern generator from scratch
    https://www.youtube.com/watch?v=bqOodLWSI5g

    Reply
  27. Tomi Engdahl says:

    This simple software makes a color bar or cross-hatch pattern on PC VGA or SVGA monitor. Its very simple just look at the circuit for all pin definitions.
    http://www.sxlist.com/techref/ubicom/sxvgatst/index.htm?fbclid=IwAR0cQ_QTYtit5LC9ifPtllPcGoIrafRovm294L2C1-DxebEhk2Re25C-MUQ

    Reply
  28. Tomi Engdahl says:

    Although new VGA-equipped monitors can still be bought, the old standard is definitely on its way out by now, being replaced by high-speed digital interfaces like HDMI and DisplayPort. It therefore makes sense to prepare for a VGA-less future, as is doing. He designed an 8-bit ISA display card with an HDMI output that enables even the very first generation of PCs to talk to a modern monitor….

    https://hackaday.com/2023/09/10/upgraded-graphics-gremlin-adds-hdmi-video-to-vintage-pcs/?fbclid=IwAR0zJH1Nm4BMpMslxerIkVisfd7zroeSQ8Ih-ByI2yVm4dnUMdNwH1BW_b0

    Reply
  29. Tomi Engdahl says:

    This video board was designed for a NorthStar Advantage, but is compatible with a broad array of devices, including the Raspberry Pi Pico.

    Evan Allen’s TTL-to-Composite Adapter Board Aims to Give Video Outputs to Retro Gear — And More
    https://www.hackster.io/news/evan-allen-s-ttl-to-composite-adapter-board-aims-to-give-video-outputs-to-retro-gear-and-more-16a7e27a80e6?fbclid=IwAR2l4sRtciPVzBGOAy7L9jc4srGMaAG7HQ_1W4CjzHC0SIX1kRP3IaSlNOs

    This video board was designed for a NorthStar Advantage, but is compatible with a broad array of devices, including the Raspberry Pi Pico.

    Reply
  30. Tomi Engdahl says:

    https://www.advancemame.it/video-link

    A collection of video and hardware links useful to use Arcade Monitors and TVs with a VGA board.

    Reply

Leave a Reply to Tomi Engdahl Cancel reply

Your email address will not be published. Required fields are marked *

*

*