sub-512 byte 8-color VGA demo with ATtiny4/5

Generate VGA out from ATtiny5 with 3 pins

Similar projects worth following
1kB sounded absurdly big, so I wanted to try something even smaller.

Enter ATtiny5 - small AVR that runs max @12MHz, has 512 bytes of flash (yes, half-a-kilobyte), 32 bytes of SRAM and reduced tiny core with just 16 CPU registers. CPU has 6 pins in SOT23-6 size.

As VGA requires pretty steady clock, I used LTC1799 as external oscillator to run chip at 12MHz. Disabling reset-pin of ATtiny5 I was left with 3 usable pins (as 3 others are reserved for VCC, GND and Clock). I'm pushing HSYNC, VSYNC and 3 colors out from 3 pins.

The trick is to use the fact that pins actually have 3 states: Pulled high, pulled low and floating. Using simple diode + pull-up-resistor together with the fact that HSYNC and VSYNC signals are "idle high" and VGA monitor R,G & B lines have internal 75ohm pull-down, I can drive HSYNC/RED and VSYNC/GREEN from same pin. Blue comes out from disabled reset pin, which acts as "weak output pin", but seems to be just enough!

Project uses ATtiny5 is 6-pin MCU, available in SOT23-6 case:

  • Reduced AVR tiny core (16 CPU registers)
  • 512 bytes of FLASH for firmware
  • 32 bytes of SRAM
  • 12MHz max. clock

Because VGA signal timings need to be pretty accurate, external oscillator was used. Any 12MHz oscillator should do, in this project I used LTC1799 resistor-configurable SOT23-5 footprint chip.

Red led is used as diode in pin-splitting circuit.

I will keep on improving this even after 1kB Challenge deadline, but in level_up -branch of the repository.


Source code

asm - 5.97 kB - 01/06/2017 at 06:40


Definitions for ATtiny5

inc - 12.71 kB - 01/06/2017 at 06:40



Compiled hex for those without AVR assembler

hex - 1.13 kB - 01/06/2017 at 06:40


View all 3 files

  • 1 × ATtiny5 8-bit AVR MCU SOT23-6
  • 1 × LTC1799 Resistor configurable oscillator (SOT23-5)

View all 11 project logs

Enjoy this project?



Does this project spark your interest?

Become a member to follow this project and never miss any updates