Bitbanging VGA Fits In under 1 kB

Don’t throw those old VGA monitors away, turn them into works of art with [danjovic] and VGA Blinking Lights. This circuit uses a PIC16F688 to generate VGA video. Not just a random spray of monochrome dots either. VGA Blinking Lights puts up an ever-changing display of 48 colored squares.

blink-thumbOriginally created for the square inch contest, VGA Blinking Lights could hide behind a quarter. [Danjovic] dusted his project off and entered it in The 1 kB Challenge. The code is written in PIC assembly. The final hex used to generate the squares clocks in at 471 words. Since the PIC uses a 14 bit word, that’s just over 824 bytes. Plenty of space for feature creep!

Video is generated with a twist on the R2R DAC. [Danjovic] tweaked the resistor values a bit to obtain the correct voltage levels for the VGA standard. The color of the squares themselves are random, generated using a Galois Linear Feedback Shift Register (LFSR).

With only a handful of components, and a BOM cost under $5, this would be a fun evening project for any hardware hacker.


If you have a cool project in mind, there is still plenty of time to enter the 1 kB Challenge! Deadline is January 5, so check it out and fire up your assemblers!

21 thoughts on “Bitbanging VGA Fits In under 1 kB

  1. Admittedly pedantic but VGA Blinking Lights can only almost but not quite hide behind a quarter. Neat project though, generating VGA or any video signal with a pretty limited microcontroller is generally kind of difficult to do given the bandwidth (and sometimes pin count) needed.

    Would be nice to see more powerful “real time” type microcontrollers out there that can do HDMI but at a more reasonable price point. Looking at you BBB. Raspberry Pi is getting though but it’s not really a microcontroller. Are there any out there that do this that are not $100 or more each?

    Let’s see a 4K version at 120 Hz challenge next. Might need more than 1Kb for that though?

    1. If you can create VGA you can create HDMI, simply attach a DVI transmitter IC instead of the VGA DAC. You could look into the Orange Pi Zero. It is a quad core ARM with 512MB RAM and HDMI. It costs around 7€ delivered. It also has wifi and ethernet.

  2. Very cool project. I don’t own a PICKit or else I’d order the components today. I may look into converting the source to AVR assembly this weekend though. Hats off to danjovic on a very neat project!

          1. Yes but including all of the bitstream for a CPLD/FPGA would be like including the tape out data that was sent to that manufacturer of a CPU/MCU of other projects.

          2. Nah I reckon the 1K limit counts, if you’re cheeky enough to submit “code” in VHDL. How about the source code has to be less than 1K? You’ll have to use single-letter variable names and things. Or maybe check the bitstream, I’ve no idea what unencrypted CPLD bitstreams look like, but you could limit it to 1K of “active” information, the rest all being 0s or FFs or whatever CPLDs use for “tie it to GND”.

          3. @[Greenaum]

            Well yes but the 1KiB limit is a run-time limit. A CPLD/FPGA bit-stream only specifies a State Machine and a beginning state. It can be a Turing complete state machine just like a Micro-controller with registers and sRAM if you want.

            I think it would be fair to count the Bytes that create the initial state but not the Bytes that create the state machine itself because the a Micro-controller is also a state machine and the the Bytes that created the logic of the chip (AISC) are not included.

            The problem is this: How do you subtract an initial state (in Bytes) from the state machine in HDL?

        1. My apologies. After re-reading my comment I realize that it didn’t come out quite right.

          Perhaps I should have worded it this way:

          There is probably not much more that could be done close to the 256 (sic) byte mark. This light weight code will probably hit higher on the bang for byte scale than it’s heavier competitors.

          So Yes. It’s a certainly a valid entry.

          Kudo’s, excellent code. I hope it gets included.

Leave a Reply

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

You are commenting using your 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