Skip to the content
2 layers88 × 88 mmTtl2dvi tht, the printed circuit board in 3D

RP2350 Based TTL Video To DVI Converter

Size
88 × 88 mm
Copper layers
2
Thickness
1.6 mm
Parts
37
Nets
63
Pads
211
Tracks, vias
333, 75
Pours
15
Routed
Yes
KiCad
KiCad 10.0 (file 20260206)
Created
25 Jul 2026
Updated
14 Oct 2026

Overview

Ttl2dvi tht is an open-source printed circuit board by charlysan, from the charlysan/pico-ttl2dvi repository on GitHub, published under the MIT licence. It is a 2-layer board of 88 × 88 mm with 37 parts on 63 nets, routed with 333 tracks and 75 vias.

Its parts include 12 resistors, 6 connectors, 3 capacitors, 3 ICs and 3 switches. It belongs with the interfaces and adapters boards and the RP2040 and RP2350 boards of this library.

README

README.md

pico-ttl2dvi

Build

Firmware and hardware for the RP2350 that captures digital TTL video from retro PC graphics cards and outputs DVI/HDMI, live.

TTL signals go straight into the RP2350, are sampled by PIO, reconstructed into a framebuffer, and re-emitted as DVI by PicoDVI.

Disclaimer. This is an experimental hobby project. The firmware and hardware designs are shared as they are, with no warranty of any kind. Wiring a graphics card to a microcontroller means connecting 5V signals to a 3.3V chip, and a mistake can damage your graphics card, PC, monitor, RP2350 board or anything else attached. Build and use it at your own risk. The author accepts no responsibility for any damage or loss that results.

Table of contents

Supported sources

SourceData linesDot clockOutput
MDA / Hercules (16 MHz clone crystal)VIDEO + INTENSITY, 2-bit16.000 MHz4-level grey
CGA, 640-wide modesRGBI, 4-bit14.323 MHz16 colours
Commodore 128 VDC, 80-columnRGBI, 4-bit16.000 MHz16 colours
EGA, 350-line modesRGBrgb, 6-bit17.750 MHz64 colours
EGA, 200-line modesRGBI, 4-bit14.161 MHz16 colours

Supports text and graphics modes. CGA and EGA 200-line modes use the standard CGA palette (including the IBM 5153 "brown" correction). EGA switches between its 200 and 350-line modes live, following the card.

Colour sources are encoded as RGB222, which gives about 75% of full brightness. Turn up the monitor's brightness to compensate.

Wiring

DE-9 from the card, 330 Ω in series on every line, into the RP2350's 5 V-tolerant inputs.

SignalDE-9GPIO
VIDEO (MDA) / Secondary BLUE (EGA)720
INTENSITY / Secondary GREEN (EGA)621
RED322
GREEN423
BLUE524
Secondary RED (EGA)225
VSYNC926
HSYNC827
GND1GND

On EGA 350-line modes, pins 2, 6 and 7 carry secondary red, green and blue. In 200-line modes the card drives it like CGA: pin 6 is INTENSITY and pins 2 and 7 are unused. Pin 2 is never ground on EGA, so use only pin 1 for GND.

DVI output pins are per board (cmake/boards.cmake + src/config/board.h); on the default Waveshare RP2350-PiZero they are GPIO 32-39.

Direct (resistors only)

The minimal hookup. The 330 Ω limits current into the RP2350 pad's clamp diode

  • that diode is the "5 V tolerance", and the resistor is what keeps it safe.
text
   graphics card (TTL, 5V)                     RP2350
   ───────────────────────                     ──────
   DE-9 7   VIDEO      ─────[ 330Ω ]────────►  GPIO 20
   DE-9 6   INTENSITY  ─────[ 330Ω ]────────►  GPIO 21
   DE-9 3   RED        ─────[ 330Ω ]────────►  GPIO 22
   DE-9 4   GREEN      ─────[ 330Ω ]────────►  GPIO 23
   DE-9 5   BLUE       ─────[ 330Ω ]────────►  GPIO 24
   DE-9 2   sRED       ─────[ 330Ω ]────────►  GPIO 25
   DE-9 9   VSYNC      ─────[ 330Ω ]────────►  GPIO 26
   DE-9 8   HSYNC      ─────[ 330Ω ]────────►  GPIO 27
   DE-9 1   GND        ────────────────────►   GND

With the pad clamping, each asserted line draws a few mA from the card. Power the Pico first, then the PC; power the PC down first.

Buffered (74HCT541 + resistors) - recommended, through-hole

A 5 V octal buffer between card and Pico. Its CMOS inputs draw ~0 current, so the video card's drivers are not loaded, and a fault on the Pico side cannot reach the card. The 330 Ω moves to the buffer's outputs, where 5 V logic meets the 3.3 V pad.

text
                        ┌───────── 74HCT541 ────────┐
                        │ (5V, 100nF across 19-20p) |
   DE-9 7   VIDEO  ────►│ 2  A1              Y1  18 │──[330Ω]──►  GPIO 20
   DE-9 6   INTEN  ────►│ 3  A2              Y2  17 │──[330Ω]──►  GPIO 21
   DE-9 3   RED    ────►│ 4  A3              Y3  16 │──[330Ω]──►  GPIO 22
   DE-9 4   GREEN  ────►│ 5  A4              Y4  15 │──[330Ω]──►  GPIO 23
   DE-9 5   BLUE   ────►│ 6  A5              Y5  14 │──[330Ω]──►  GPIO 24
   DE-9 9   VSYNC  ────►│ 7  A6              Y6  13 │──[330Ω]──►  GPIO 26
   DE-9 8   HSYNC  ────►│ 8  A7              Y7  12 │──[330Ω]──►  GPIO 27
   DE-9 2   sRED   ────►│ 9  A8              Y8  11 │──[330Ω]──►  GPIO 25
                        │                           │
                 GND ──►│ 1  /OE1          /OE2  19 │◄── GND
                 GND ──►│ 10 GND            Vcc  20 │◄── +5V
                        └───────────────────────────┘

   DE-9 1   GND ─────────────── common ground ──────────────►  GND

Both /OE pins (1 and 19) must go to GND, and keep one common ground between card, buffer and Pico.

Use the HCT part, not plain HC: its TTL-level input thresholds read a 5 V TTL high reliably at 5 V Vcc.

Buffered (74LVC245A, no resistors) - best

The same idea, but powered at 3.3 V. LVC inputs accept 5.5 V regardless of Vcc - 5 V tolerance is a designed-in property of the family, so the card connects straight in and the outputs are already 3.3 V logic.

text
                    ┌───────── 74LVC245A ─────────┐
                    │ (3.3V, 100nF across 10-20p) │
   DE-9 7  VIDEO ──►│ 2  A1                B1  18 │────►  GPIO 20
   DE-9 6  INTEN ──►│ 3  A2                B2  17 │────►  GPIO 21
   DE-9 3  RED   ──►│ 4  A3                B3  16 │────►  GPIO 22
   DE-9 4  GREEN ──►│ 5  A4                B4  15 │────►  GPIO 23
   DE-9 5  BLUE  ──►│ 6  A5                B5  14 │────►  GPIO 24
   DE-9 9  VSYNC ──►│ 7  A6                B6  13 │────►  GPIO 26
   DE-9 8  HSYNC ──►│ 8  A7                B7  12 │────►  GPIO 27
   DE-9 2  sRED  ──►│ 9  A8                B8  11 │────►  GPIO 25
                    │                             │
            +3V3 ──►│ 1  DIR                      │  DIR high = A→B
             GND ──►│ 19 /OE              Vcc  20 │◄── +3V3 (Pico 3V3 pin)
                    │ 10 GND                      │
                    └─────────────────────────────┘

   DE-9 1  GND ─────────────── common ground ──────────────►  GND

DIR high and /OE low enable the A→B direction; both must be tied, not left floating. Power it from the Pico's 3V3 pin - the 5 V tolerance depends on Vcc being 3.3 V.

Beyond dropping the resistors, this also removes the power-sequencing rule: LVC supports partial power-down, so the card may be live while the Pico is off.

Controls: buttons and IR remote (optional)

Three push buttons and an IR receiver drive a one-line on-screen menu, so the box can be tuned without a computer. Both are optional.

FunctionGPIOHeader pin (Pi layout)
IR receiver output631
Button PREV (previous / -1)726
Button NEXT (next / +1)824
Button ENTER (short: select, long: back)921

Hold ENTER + PREV for 2 s to reset, ENTER + NEXT for 2 s to reboot into USB BOOTSEL (for a UF2). The screen counts down; let go to cancel.

text
   push buttons (each one to GND)              RP2350
   ──────────────────────────────              ──────
          ┌─── PREV ───┐
   GND ───┤            ├───────────────────►  GPIO 7
          └─── o  o ───┘
          ┌─── NEXT ───┐
   GND ───┤            ├───────────────────►  GPIO 8
          └─── o  o ───┘
          ┌── ENTER ───┐
   GND ───┤            ├───────────────────►  GPIO 9
          └─── o  o ───┘

   IR receiver (KY-022 / VS1838B)
   ──────────────────────────────
          ┌───────────┐
          │  KY-022   │
          │         S ├─────────────────────►  GPIO 6
          │       VCC ├──────┬──────────────◄  3V3
          │           │     ═╪═ 100nF 
          │         - ├──────┴───────────────  GND
          └───────────┘
  • No resistors. The firmware enables the internal pull-ups, so a button reads low while pressed. Wire buttons to GND, not to 3V3 with pull-downs: RP2350 erratum E9 can latch an input with the internal pull-down at ~2 V.
  • Power the IR receiver from 3V3, not 5 V: its output is pulled up to its own supply, so at 3V3 it connects straight to the GPIO.
  • Put a 100 nF capacitor across the receiver's VCC and GND, right at the module. Without it, the switching noise from the video inputs reaches the receiver through its supply, and its LED flickers (observed when switching to EGA 350-line (1 px stripes or checkerboards).
  • The remote must speak NEC, which most cheap remotes do.

To use a remote, either:

  • on the box: Menu → Remote → Learn, then follow the on-screen prompts with the push buttons. It asks for the navigation keys, then offers shortcuts from a list (OSD status/live/hide, scanlines, load slot 0-7); or
  • from a computer: record its buttons with tools/irlearn.py --learn ir.txt, turn the map into a UF2 with tools/irmap2uf2.py ir.txt, and drop irmap.uf2 on the BOOTSEL drive (or picotool load -f irmap.uf2). This route can put any console command on a key.

Firmware updates leave the map in place.

Adapter board

An experimental through-hole board design (KiCad) is in hardware/tht. See the hardware documentation for how to build one. Rev A is untested; only the breadboard prototype has been verified.

Quick start guide

You can check the Quick Start Guide documentation here

How it works

text
  TTL video ──> [capture] ──> rawbuf ──> [view] ──> framebuffer ──> [video] ──> DVI
                pio0/core0                core0                   pio1/core1
                   ^
                   |
                [sync] ──> [sigcheck] ──> [detect] ──> reboot into another source
             HSYNC/VSYNC   rate check    auto source
             measurement

No CPU sits in any per-line timing path. PIO waits on sync edges; the CPU only acts once per frame, during vertical blanking. Capture and DVI are on separate PIOs and separate cores, so neither can stall the other.

Core 0 only does the per-frame work: it waits for the VSYNC edge, sizes the sampling window from the sync measurement, arms the DMA and the sampler, and when the frame ends reconstructs it with view. Per line, the PIO locks to each HSYNC edge and DMA stores the samples, with no CPU involved.

The source (card descriptor) configures both sides at boot: capture gets the data pins, dot clock and default bp/phase; video gets the DVI raster and encoder.

Per frame:

  1. sync measures the HSYNC period and pulse width with a PIO countdown.
  2. capture sizes its sampling window from that measurement, then a single DMA transfer records one VSYNC-bounded frame of raw samples into rawbuf. Sampling is 1x or 2x, picked per source: 2x when the dot clock is not close enough to a whole number of system clocks, so reconstruction can pick the sample nearest each pixel's centre rather than its edge.
  3. view reconstructs each line, maps sample values to grey levels or RGB222 colours, and writes the result into the framebuffer at the current position (hpos/vpos).
  4. video on core 1 walks the framebuffer, repeats rows for vertical scale, adds the letterbox, TMDS-encodes each scanline and feeds the serialiser continuously.

Signal check and auto source. sigcheck checks the HSYNC/VSYNC rates against known ranges. Once they are stable, detect picks the source from the line rate, and from the measured dot clock when several sources share a line rate. If it finds a different card, it reboots into that source.

Modules

PathRole
src/configBoard pins and DVI pin config; the source-card descriptors (pins, dot clock, sysclk, defaults)
src/capturePIO sampler + DMA into rawbuf; per-line reconstruction; signal check. capture.pio, sync_period.pio
src/videoFramebuffer, DVI raster tables, TMDS encoding on core 1, colour tables
src/viewScan converter: joins capture and video, owns all display framing
src/settingsPersistent settings slots in the last flash sector
src/consoleUSB CDC command console
apps/ttl2dviThe application: startup order + command table (main.c), command bodies (commands.c), source detection (detect.c), OSD messages (osd.c), buttons and menu (buttons.c, menu.c), IR remote and learning (remote.c, learn.c), auto tune (tune.c)
src/irNEC IR decoder on pio2
apps/dvi_testStandalone DVI test card, links libdvi only
extern/dviVendored PicoDVI (libdvi) (fork from mlorenzati)
toolsttl2dviPanel.py control panel, grab.py frame grabber, autotune.py dot clock and phase tuning, irlearn.py / irmap2uf2.py IR key maps

Everything that differs between cards - data pins, dot clock, system clock, framebuffer depth, TMDS encoder, DVI raster - is selected from the source descriptor at boot. Switching card reboots into the new configuration.

Console

Connect to the USB serial port (115200 baud, any terminal) and type help.

text
source [n]           select the card (reboots)
source auto on|off   automatic source detection (stored in flash)
mode [n]             DVI output raster (reboots)
status / state       signal and settings; state prints one line for tools
bp / phase           capture framing: sampling window, sub-pixel sampling instant
dotclock [MHz]       card dot clock, or default
hpos / vpos          display position
vscale [1..4]        vertical scale
scanlines on|off|switch  blank every other line (vscale >= 2)
mdalevels            MDA grey levels
slots                saved settings for this source
save / load / clear  settings slots in flash (8 per source)
default [n|off]      slot applied at boot
detect / measure     which source auto would pick / measure the dot clock
tune [apply]         measure the dot clock and pick the phase (auto tune)
osd ...              on-screen display; osd live toggles live measurements
ir on|off / ir map   print IR remote codes / list the loaded key map
reboot / bootsel     reboot / reboot into USB BOOTSEL (for a UF2)
capture / fastcap    dump a frame over USB (tools/grab.py, tools/autotune.py)
dvi_test             on-screen test pattern

Example:

text
screen /dev/tty.usbmodem1101 115200

ttl2dvi> source
  auto detection: on
  0  MDA16  2 data bits @ GP20, 720 px, 16.000 MHz dot, sysclk 256 MHz   <- current
  1  CGA    4 data bits @ GP21, 640 px, 14.322 MHz dot, sysclk 258 MHz
  2  C128   4 data bits @ GP21, 640 px, 16.000 MHz dot, sysclk 256 MHz
  3  EGA    6 data bits @ GP20, 640 px, 17.750 MHz dot, sysclk 266.4 MHz, both families
ttl2dvi> source 1
switching to CGA...

Tuning a card

If a card's crystal differs from the defaults, the picture shimmers or shows evenly spaced vertical bars. Put text or a test pattern on screen, then:

  • on the box: Menu → Sampling → Auto tune. It measures the dot clock from pixel edges, picks the phase, shows the result, and offers Apply, Apply and save to a slot, or Cancel;
  • on the console: tune prints the same result, tune apply applies it;
  • from a computer: tools/autotune.py does the same from a fastcap dump, with an edge histogram and the best phases listed.

Auto tune and tune search from -25% to +33% of the current dot clock, so a card on a different crystal is usually found without changing the source. If the result isn't a whole fraction of the system clock it says "may shimmer": it works, but a source built for that clock would be cleaner. autotune.py searches ±5%; for it, set dotclock near the card's first. bp (the left edge) is not tuned. Save the result in a slot.

ttl2dviPanel

tools/ttl2dviPanel.py is a Tk GUI over the same console (pip install -r tools/requirements.txt). It polls state once a second, so the knobs follow changes made from the console.

Build

Requires the Pico SDK (2.3+) and CMake:

sh
mkdir build && cd build
cmake -DTTL_BOARD=pizero ..
make -j

Or you can use Docker:

sh
 docker run -d -it --name pico-sdk \
 --mount type=bind,source=${PWD},target=/home/dev \
 lukstep/raspberry-pi-pico-sdk:v1.2.0
sh
docker exec -it pico-sdk sh -c \
"cd /home/dev/build && cmake \
-DTTL_BOARD=pizero \
-DPICO_PLATFORM=rp2350-arm-s .. \
&& make -j\$(nproc)"

TTL_BOARD selects the hardware profile (pizero | pico2_dvi) and is the single source of truth for the board. The output is build/apps/ttl2dvi/ttl2dvi.uf2.

Then just upload the .uf2 file to rp2350 (in BOOTSEL mode). For example:

sh
cp build/apps/ttl2dvi/ttl2dvi.uf2 /Volumes/RP2350

Hardware

Tested on a Waveshare RP2350-PiZero (RP2350B, 48 GPIO, 520 KB SRAM).

Screenshots

Check Wiki for some screenshots.

Discussion

Acknowledgements

Inspired by mlorenzati/pico-rgb2hdmi, which converts analog RGB to HDMI on an RP2040.

DVI output is PicoDVI by Luke Wren.

Licence

MIT.

extern/dvi is vendored PicoDVI and keeps its own licence - see extern/dvi/LICENSE.

Parts

37
QtyValueFootprintReferences
8330RResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_HorizontalR1, R2, R3, R4, R5, R6, R7, R8
4M3MountingHole:MountingHole_3.2mm_M3_Pad_ViaH1, H2, H3, H4
3100nFCapacitor_THT:C_Disc_D5.0mm_W2.5mm_P5.00mmC1, C2, C4
31kResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_HorizontalR10, R11, R12
1100RResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_HorizontalR9
11N5819Diode_THT:D_DO-41_SOD81_P10.16mm_HorizontalD2
15V INConnector_JST:JST_XH_B2B-XH-A_1x02_P2.50mm_VerticalJ6
174LVC14A / 74HCT14Package_DIP:DIP-14_W7.62mm_SocketU2
174LVC245A / 74HCT541Package_DIP:DIP-20_W7.62mm_SocketU1
1ConsoleConnector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalJ5
1DE9 male (video in)Connector_Dsub:DSUB-9_Pins_Horizontal_P2.77x2.84mm_EdgePinOffset7.70mm_Housed_MountingHolesOffset9.12mmJ2
1DIR (245) / OE1 (541)Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalJP2
1ENTERButton_Switch_THT:SW_PUSH_6mmSW3
1HSYNC: 1-2 BUF / 2-3 SCHConnector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalJP3
1IDC10 (alt video in)Connector_IDC:IDC-Header_2x05_P2.54mm_VerticalJ3
1IR activityLED_THT:LED_D3.0mmD1
1Logic analyserConnector_PinHeader_2.54mm:PinHeader_2x05_P2.54mm_VerticalJ4
1NEXTButton_Switch_THT:SW_PUSH_6mmSW2
1PREVButton_Switch_THT:SW_PUSH_6mmSW1
1RP2350-PiZeroModule:Raspberry_Pi_Zero_Socketed_THT_FaceDown_MountingHolesJ1
1VBUF: 1-2 3V3 (LVC) / 2-3 5V (HCT)Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalJP1
1VS1838BOptoDevice:Vishay_MOLD-3PinU3
1VSYNC: 1-2 BUF / 2-3 SCHConnector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalJP4

Similar boards

  • 2 layers40 × 34 mmDD HIP9011, the printed circuit board in 3D

    DD HIP9011

    rusefi/rusefi

    rusefi - GPL internal combustion engine control unit

    37 parts1.2k
  • 2 layers53.9 × 23.2 mmAnalog, the printed circuit board in 3D

    Analog

    hoglet67/RGBtoHDMI

    Bare-metal Raspberry Pi project that provides pixel-perfect sampling of Retro Computer RGB/YUV video and conversion to HDMI

    37 parts1kGPL-3.0
  • 2 layers52 × 51.8 mmEsp32-homeassistant rf bridge, the printed circuit board in 3D

    Esp32-homeassistant rf bridge

    hackclub/OnBoard

    💡 Join 1,000 teenagers and make your first PCB with a $100 grant!

    37 parts915
  • 2 layers87.8 × 59.8 mmFreeDeck SMD 2020-02, the printed circuit board in 3D

    FreeDeck SMD 2020-02

    FreeYourStream/freedeck-hardware

    all the stuff you need to build your own FreeDeck

    37 parts772
  • 2 layers65 × 28 mmBMS Cell Module, the printed circuit board in 3D

    BMS Cell Module

    stuartpittaway/diyBMS

    Do it yourself battery management system for Lithium ion battery packs/cells

    37 parts676GPL-3.0
  • 2 layers48 × 32 mmFlatSat, the printed circuit board in 3D

    FlatSat

    Pwnsat/FlatSat

    Flatsat v1.0 is a hardware based platform for aerospace cybersecurity research

    37 parts575GPL-2.0
  • 2 layers38.1 × 153.7 mmDEFOG PANEL, the printed circuit board in 3D

    DEFOG PANEL

    jrsteensen/OpenHornet

    OpenHornet 1:1 F/A-18C Simulator Repository

    37 parts431
  • 2 layers47.8 × 27.4 mmVsf stm32h7b0, the printed circuit board in 3D

    Vsf stm32h7b0

    vsfteam/vsf

    Versaloon Software Framework -- a tiny preemptive-capable event-driven incremental software framework for embedded systems

    37 parts341Apache-2.0

Questions

How big is the Ttl2dvi tht PCB?

It measures 88 × 88 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Ttl2dvi tht use?

37 parts. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Ttl2dvi tht KiCad files?

From the charlysan/pico-ttl2dvi repository on GitHub, at the commit this page was made from: the board is hardware/tht/revA/ttl2dvi_tht.kicad_pcb and its schematic hardware/tht/revA/ttl2dvi_tht.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Ttl2dvi tht design in my own project?

Its repository publishes it under the MIT licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).