The Raspberry Pi has an HDMI port to connect a display. If your monitor only has VGA, you have to use an adapter. Because this requires a digital-to-analogue conversion, those adapters can be quite pricey, and they can draw lots of power. So our friend Gert van Loo (who developed the Alpha board that became the Raspberry Pi, and the man behind the Gertboard and Gertduino) has created a VGA adapter that uses the Pi’s GPIO.

This wasn’t possible on the Model A or B, but now the B+ exposes 40 GPIO pins, there’s more to play with. As well as just allowing you to connect a VGA monitor natively, it also means you can use it as a secondary monitor alongside HDMI. And unlike composite video, the DPI interface can be run independent of the HDMI. The software for dual screens is still under development, but we expect that to arrive in the next couple of weeks. Running two screens at maximum resolution will consume SDRAM bandwidth, and is yet to be tested. (And there’s a catch: as the board uses most of your GPIO pins, you lose access to them.)

The VGA output supports the same resolution as your HDMI one: from 640 x 480 up to 1920 x 1024 at 60fps. At the highest resolution the pixel quality is almost as good as HDMI. The adapter uses a simple resistor ladder network as a digital-to-analogue converter, so the colour quality depends on how well-balanced your resistors are. There is slight colour banding, and with 6 bits per channel you have a maximum of 262144 colours.

Dom has been working on the software side and the new DPI (read: VGA) driver software has been added to the latest release.

“Where can I buy one?”, I hear you ask. Currently, nowhere. But Gert has made the VGA adapter open hardware, so you can make it yourself, or find yourself an enthusiastic partner and have it made. All the data is in the public domain on GitHub. Besides the manual and schematics, you will also find the database for the PCB and the Gerber files. The PCB design supports both through-hole and SMD parts. The design consists of:

1 PCB

2 connectors

20 resistors

The cost is not prohibitive, but having a single PCB made is rather expensive, so you might want to collect a group of interested people and order a batch; if you’re interested in doing that, head over to the forums and see if you can organise a group buy.

Gert’s looking to get the PCBs produced, and hopefully the manufacturer will be able to put them on sale (we’ll update with a link) – but they’re so easy to make we anticipate they’ll be generally available before long anyway. Gert says he expects in due time that a far-east manufacturer will see fit to sell them for two dollars.

Want to see a prototype? Of course you do.

Click to embiggen, and marvel at Gert’s work soldering together some of those teeny resistors.

Update 23/9: The PiHut have launched a Kickstarter project to crowd fund this as a product. It’s available in kit form for £6 and the target has already been reached – get yours now at kickstarter.com!

Too bad it couldn’t be rotated 180° so that it sits within the Raspberry Pi’s footprint (So that the DE-15 port points in the same direction as the HDMI port). I guess that this is just a matter of the PCB design and this could be made to work with a slight revision of the PCB.

I like your suggestion.
Advantage of B+ is ports only on 2 sides.
With this design if I need analogue audio also I have to connect 3 sides.
Hopefully a manufacturer will do the modification.
Thinking on PCB. If the board has to be turned 180 then the lines would have to cross. Not impossible but a challenge when the board is already double sided (at least)

Looking at the image again. Maybe the VGA 15D is so big if it was mounted the other way around it would have to be above the board requiring extra support not to cause it to damage the GPIO connection due to repeated insertion and removal.
Possibly a HAT style board would give more area for the cross over and option to use the mounting holes for support.

The trick i’ve found with surface mount passives is you cover one pad with solder, then you bring the component in with tweezers and remelt the solder, then finally you solder the other pad.

Would probablly have made more sense to use 0805 if designing the board for novices.

I’ve just taken a look at the schematic and the resistor values and some of the values gert has specified don’t seem to be standard values at all. Did he just draw the schematic without looking at his list of standard resistor values and substitute later? did he find a source for 4K and 8K resistors?

Rounding gert’s values to the closest values from E24 or E96 (note that e24 is not a subset of e96) and looking for through hole resistors at farnell gets us

Don’t rotate it – simply flip the PCB over and transpose the two rows of GPIO pins. This would take all of ten seconds in an auto-routing PCB package and leave the VGA connector topside. GPIO connector would have to reside on opposite surface of PCB (obviously). Still LMAO over the pic of the prototype, Gert. Should have wire-wrapped it for a super-retro look ;)

No. They were arbitrarily connected. The video is running of HDMI and the desktop is VGA.
But on a video you would not notice a difference in quality if they were swapped around. You have to get real close to notice the difference.

So I can assume the GPU is driving the framebuffer, and also copies the pixels to the GPIO’s using 20 of them in the same 32 bit I/O bank. Or perhaps some DMA mechanism is doing the copying. (i’m just curious how it works).
anyway, its a great trick, never had thought it would be possible.

What happens when we also add the DSI driven LCD? can we then have three independent screens? :-)

You obviously skipped reading the manual :-).
There it lists the format of each file. To make PCBs you need the gerber files which are also on Github. Just had an email from Newbury Electronics (PCB train) where I had the prototypes PCBs made. They promised to make a batch and sell the bare PCB in their online shop. I have no price or link yet.

Does the DPI have pixel clock and DE signals?
If so, it could be used to drive a lot of lcd displays directly, since Gert’s VGA already has RGB and H/V sync, all that is needed for a typical lcd panel is pixel sync and DE.
Also most laptop lvds displays are 6bit, and an lvds transmitter board is relatively easy to build.
This could be really awesome.

The DPI peripheral is designed for DPI LCDs so it is likely that other DPI LCDs can be used.
I believe pixel clock and DE are available.
If your display can be driven with standard HDMI/DMT timings the I suspect just using dpi_group and dpi_mode (much like hdmi_group and hdmi_mode) and using a suitable dt-blob.bin file will allow DPI LCDs to be driven.
(and it is possible to configure custom timings, much like with hdmi).

This would be totally awesome to drive a fullHD LCD in LVDS directly! A transmitter like the SN75LVDS83B used in this could be used. Does the remaining GPIO pins include the LSbits RGB data as well? having 24bits of color depth would be even better ;-)
What is a “suitable dt-blob.bin” and how would it be generated?

This uses dedicated hardware on BCM2835 which can drive a DPI display. There should be no real difference in cost compared to the HDMI output.
We did find at 1080p when busy the DPI output does underrun sooner than HDMI, possibly due to smaller fifos in the hardware block.
At lower resolution, or with overclock this is not an issue.

Any reason for using 6 different resistors for each colour, rather than an R-2R ladder?
Reason I ask, I’ll probably cobble one together on Veroboard, and since I’ve got lots of single-value resistors …

What a coincidence, just two days ago I got this hdmi to vga adapter http://www.ebay.com/itm/310979850383 and it works perfectly with no extra power needed even on old model B :-) But still, this is great news. Can this parallel interface be used to drive cheap parallel LCD displays instead of SPI?

is this GPOI->VGA fully driven by software?
to keep the signals in sync on a high resolution is this really possible – even other programs are running at the same time?
is the software driver available? would be interesting to me, to see the source of the driver

oh, read a bit more about…
it is hardware driven and only switched to GPIO by software…
nice feature of the RPi B+ model. badly model A and B seems to be not compatible – even by using less color depth :(

“This wasn’t possible on the Model A or B, but now the B+”[this thread]

and

“Can I use it on the A or B?
No, it only works on the B+. It is no so much the number of GPIO pins required, the right GPIO pins
are required. The VGA output must have access to at least the MS bits of each colour channel and on
the A and B these are not on the GPIO header for all three colours.” [document from github]

and

“But only for the B+ and at the cost of losing most of your GPIOs” [document from github]

gives me the feeling that model A and B are not possible.
and somethere in the document was written the only model B+ has the possibility to pass DPI signals to the GPIO…

You need a tutorial to boil an egg?
1. Buy a water boiling mug. Also works well for ramen noodles and tea.http://peter-pockets.rhcloud.com/tai-cheng-water-boiling-mug/
2. Change the car-style connector to Molex.
3. Get a PC power supply (or alternative 12V 8A or higher).
4. “Just add water” to the inside of the mug, not on the electronics.
5. Add one or more eggs.
6. Plug it in, wait 20 minutes until it boils.
7. Drain, remove the shell, add a pinch of salt, eat.

I also realised that the VGA pinout exposes H-Sync, GND, and Green on one diagonal. The spacing means that a standard 0.1″ female header wire with 3 pins fits on that diagonal. The outside of the jumper then contacts the adjacent pins, allowing V-Sync to be tied to HSync, and the red and blue channels to be added. The resulting connector is so much smaller!

If composite-to-monochrome-VGA is possible, this would be huge! I plan to build it later this week, but I need to get permission to enter the office soldering lab again.

Out of curiosity, could this PCB be extended to include other extra connectors too? I’m thinking perhaps USB or audio jacks, or even just breaking out the spare GPIO. Would make a fantastic addon board, perhaps include the RTC PCB aswell, call it the “+” and sell it with a B+ as the Raspberry Pi B++ :)

can I just get green (or blue) to work in 1 bit (or 2 bit ‘greenscale’) on the older models (the documentation regarding available pins makes me believe so), and is the VGA mod locked to the B+ by the firmware?

Looking at the gerbers, it seems that the VGA connectors pins that are neither signal or GND are connected together (and one of those is +5v thereby, presumably, making them all logic high). I’m really looking forward to making one of these so I was wondering if someone who knows more about VGA than me could tell me whether these connections are strictly necessary? (Or if I’ve misread the gerbers!)

Looking at the datasheet for a lcd driver chip with DPI interface I see this:
“When DPI is selected, externally supplied VSYNC, HSYNC and PCLK signals drive the chip. Display data
(DB[17:0]) is written in synchronization with those synchronous signals following data enable signal (DE).
This enables updating image data without tearing effect on the panel.”

Is the pixel clock available? Data Enable would also be nice, but many LCDs can get away with just h/v sync.

This is very snazzy! If this has already been suggested then… Whoopsie! (My brain turned to mush trying to read the comments and I gave up.)

My electronics skills are somewhat basic but I would have thought that if you replace one resistor with two (or 3 or more) in parallel then wouldn’t that even out the errors/variances in resistance even with 1% devices.

I would think that getting them from different batches/manufacturers would help smooth the averages as same batch would potentially have the same errors which gets you no-where.

Also if people are not too concerned with 18bpp then could an older model A or B be used with fewer pins to give a 6bpp or 9bpp.

Thank you F. I’m on holiday, keeping track of raspberrypi.org on tablet and it’s not so easy to get all the info… ☺

Bradley, if you use 3 1% resistors then you end up with a 3% resistor, as all 3 resistors can be out by 1%… You can’t spread the odds as you spread it both ways. This is related to probabilistic math and it does not always make sense… ☺

You can’t always average %ages like that. I find it safer to average the absolute variance and the absolute size and then calculate the the %age.

Feel free to correct me, but you are both talking about +1%. The variance is +/- and this was the thought behind using more than one as you are not reliant on any one variance that could be up to +/- 1% but you are using a probability that they won’t all be the same. In the process of writing this I realised they could be either series (1/3rd the size for 3) or parallel (3x the size for 3) and still average out. Worst case you will arrive at +/-1% as Gert said. I would guess that parallel could be implemented vertically on a PTH board without any redesign and, to my eyes, be slightly neater than series. Not sure if SMT components have their contacts on the top as well as the bottom to get a similar vertical effect for a parallel circuit without redesign.

How can I run the ‘rpi-update’ command without a HDMI monitor? Do I have to run it on Raspberry? The rpi-update is the first thing I have to run, it’s written in the Installation section of the vga_manual.docx from the GitHub domain. Thanks in advance.

I wish I could find some instructions on how to use that alledged dual monitor function.
At the moment I can only use either VGA or HDMI, no way of using both outputs at the same time.
Some comment would be greatly appreciated.

Thanks to Gert for all the great efforts.
Gut my vga666 soldered and installed. Can easily switch between hdmi and vga output. Also having console on one display and omxplayer on the other works just great.

I just hoped to find a second /dev/fb[n] that I can write to from C code. But unfortunatly that is not the case yet.

Will this be something that will come with an update of raspian some time? Or: how is omxplayer yet capable to adress the second output? Is there some sample C code for it?

Regarding omxplayer:
took a look into omxplayer.cpp at github repository. From that it seems that the mysterious –display command line parameter is not supported in that version.
If there is no second /dev/fb, maybe the memory area for the one /dev/fb is shared between both outputs? …and if so, the dpi framebuffer starts somewhere at an offset that is calculated by the –display parameter.
Just try to figuring out how the second display can be adressed by programming.

– after some reverse engineering I found out that omxplayer adresses the gert-vga not by framebuffer but by bcm_host interface. The related libs and headers should be at /opt/vc/lib/ and /opt/vc/include/ and /opt/

– an excellent starting point for using them is the following github which has some example code on how those APIs can be used to get monitor output. IMPORTANT: the sample code addresses the default monitor. To address the gert-vga, one need to find the line…
DISPMANX_DISPLAY_HANDLE_T display = vc_dispmanx_display_open(0);
and change it to…
DISPMANX_DISPLAY_HANDLE_T display = vc_dispmanx_display_open(4);
the URL for the sample code is:https://github.com/AndrewFromMelbourne/raspidmx

Have fun and good luck!!

Posted by Ben NuttallRaspberry Pi Community ManagerLikes Adventure Time