pi2vga

SUPER LOW COST VGA OUTPUT FOR THE PI ZERO

The vga666 by Gert is already a low cost VGA output option for the Pi. But we can do better with the Zero! First, we'll use 16 bit output instead of 18 bit. This frees up the SPI and I2C ports with little loss in quality. The resistors can also be soldered between the Zero and the adapter, making the PCB smaller and eliminating a connector. I've also determined that 5% resistors are good enough: no need for higher cost 1% units. And by not using the middle row of pins in the HD15 connector, we can straddle-mount it on the PCB edge. The connector can be male, so the Zero will connect to the monitor ChromeCast style: no VGA cable needed. (This connector could even be scrounged from an old VGA monitor cable for free!)

With all of these modifications applied the PCB size is under one square inch. If you order from OSHPark, it will cost $4.95 for three copies. Enough resistors to build all three will cost $3.43 from Digi-Key, and a connector is $0.83. In total three will cost you $10.87: that works out to $3.63 each. That's half the cost of a micro HDMI to VGA adapter! If you build in larger quantities (to take advantage of resistor price breaks), and salvage connectors, you can make them for under $2.50 each. (NOTE: tax and shipping from Digi-Key isn't included in these prices.)

THE SCHEMATIC

WHAT IT LOOKS LIKE WHEN FINISHED

DESIGN FILES

You can use this link to order three boards directly from OSH Park. The PCB design files (in KiCad format) are in the pi2vga-v2.1.zip file in this project's files subpage. Also located there is pi2vga-v2.1-oshpark.zip, which is a zip file ready to send to OSHPark.

PARTS LIST (for each board)

You can order parts for three boards from Digi-Key using this quick order link.

SALVAGING CONNECTORS

If you have an old VGA cable (check with your local IT department, they probably have boxes of them) you can salvage the connectors. Start by pulling out the thumbscrews with pliers. Then use a hack saw to cut the ends off, but instead of cutting the cable cut through the middle of the large molded part, about one inch back from the front edge of the connector. Pry off the rubbery plastic shell. Heat up the solder joints and remove the metal shell. There will be plastic molded around the connector pins, melt it with a soldering iron and remove it. You can also use a flame or heat gun to soften the plastic and scrape it off with a screwdriver. Unsolder all of the wires. It may be a lot of work to save 83 cents, but re-using is better than recycling!

INITIAL ASSEMBLY

Lay the circuit board on a piece of urethane foam, "pi2vga" label down. You'll see four character labels on the board: they correspond to the colors of the first two bands on the resistors. For example, BnRd stands for the 120 ohm resistor: it's first two bands are brown red. Following these labels insert the proper resistors through the board and into the foam. Some holes don't have labels: leave them alone for now. Trim the resistor leads to different lengths, full length on the connector end of the board tapering to half length at the other end. Here's what it should look like:

Insert the leads into the Zero's GPIO holes until the Zero is resting on the resistors. A little encouraging with a toothpick helps get the leads into the right holes. Once done hold the assembly together and pull it out of the foam. Solder all of the resistors into the VGA circuit board: it'll be a bit wobbly until some of the resistors are soldered. Insert solid wire (cut-off resistor leads work) through the Zero and on into the remaining holes in the VGA board. These are the ground connections. Solder them to the VGA board. Remove the Zero (you didn't solder anything to it yet, right?) and set it aside. Trim the resistor leads to about 1/4" long.

TIP: If you trim the leads flush before soldering it'll lower the board profile nicely in exchange for making soldering a bit more difficult. 

Remove the center row of pins from the connector. If they won't readily pull out they can be bent until they break off. (If you're salvaging from a VGA cable there may be a solder connection to the shell that may need to be softened first.) If the remaining pins will bend without breaking bend them toward the center a bit to hold the circuit board lightly. Solder the connector onto the circuit board, with the narrower part of the connector (pins 11-15) on the side with the "pi2vga" label.

Insert the VGA board into the top of the Zero, connector end away from the SD card socket. Note that the top three holes on the Zero (pins 1, 2 and 4) aren't connected to the adapter. Make sure you get this right or you'll have to un-solder everything. (I'm ashamed to admit that I had to do this, but luckily I had only soldered six connections.) Solder only the two brown-red-brown resistors, the three green-brown-brown resistors, and one of the ground wires into the Zero. This will be enough to verify operation.

CONFIG FILES

In /boot/config add the following lines:

    dtoverlay=vga565-3

    enable_dpi_lcd=1

    dpi_output_format=3

    dpi_group=2

    dpi_mode=16

    display_default_lcd=1

You can change the dpi_mode=16 line to get other monitor resolutions. The values are the same as for HDMI group 2.

Run raspi-config and in the Advanced Options section disable I2C and the serial port console.

Copy the vga565-3.dtbo file from this project's files sub-page to /boot/overlays

Reboot and you should have VGA output!

TROUBLESHOOTING

Plug in a monitor or TV to the HDMI port and make sure there's no signal. If there is a HDMI signal you have a problem with the config file or overlays. If there is indeed no HDMI signal test for sync signals on the VGA connector. If you don't have a scope or frequency meter a speaker or headphone can test for the vertical sync signal. It should be about 60 Hz: a nice low buzz. If it's present the config files are probably correct, and your problem is most likely a wiring issue or broken monitor.

FINAL ASSEMBLY

Power off everything and finish soldering the rest of the resistors and ground wires to the Zero and clean up any flux residue. Connect the Zero to the monitor and power up. Log in and open the .png test files in this project's files sub-page. The color bands should smoothly proceed from light to dark. The middle two bands might be the same shade - this is a consequence of the 510 ohm resistor value not being quite correct. This shouldn't be noticeable in normal use though.

SO HOW DOES IT LOOK?

I was pleasantly surprised. At 1024x768 the RGB test pattern showed 16 discrete steps (32 for green), with the exception of the middle. This is due to the resistor problem I mentioned earlier. Photographs looked fine: I might even use this setup to make a digital picture frame!

This site has been tested to display correctly using Epiphany on the Raspberry Pi