Using a Raspberry Pi to connect a third display over LAN

I’ve received my rPi a while ago, but never wound up doing much with it. Recently I have received another screen which is a little older, but still features a DVI input. Since developers can’t have enough screen space and my laptop has only one VGA output, I decided to use the raspberry pi as my ethernet-to-DVI adapter.

IMG_20130331_200140

This how-to is composed of two parts, first I explain how to get synergy up and running, and then how to set up your VNC to help the illusion that everything is happening on the same computer.

install synergy on laptop and Pi

Now we need to edit the configuration file in /etc/synergy.conf on the laptop (i.e. server). My configuration boils down to this:

IMPOTRTANT: the names »raspberrypi« and »laptop« have to be replaced by the hostnames of the computers involved. If unsure, open a terminal and type hostname

This basically instructs synergy to create two synergy screens, and redirects the mouse and keyboard input of the server to on of those computers, depending on where I left the screen with the mouse. This setup says, the rPi-screen is left of the laptop; If I leave the laptop screen to the left, the raspberry pi will receive the input of mouse and keyboard and vice-versa.

Now we can start the synergy server on the laptop:

The -f switch keeps synergy in the foreground, so we can see any errors on startup. You can leave it out once the setup works.

Now on the rPi

You have to substitute the IP with the IP of your server, of course. Now you should be able to move your mouse between the two screens, yaay.

Setting up VNC

First, you need to install tightvnc on laptop and Pi (or any VNC client/server for that matter, but later on I’ve got sometricks, I didn’t try out using other software)

now we need to set up the X server, that will later be displayed on the rPi-screen. To do so, edit ~/.vnc/xstartup

As you can see, I am starting another window manager and launching a desktop as well on X-display :99, note the colon in front of the 99. You can of course replace xfwm4 by any window manager of your choice.

Now we need  to setup a password for the vnc server. This is only due to a bug in tightvnc, so you can skip this part if your VNC client supports standard UNIX authentification. Just start vncpasswd and enter some password.

Now wecan finally start our VNC server:

As you can see, I’m starting the server on the same display (:99) as previously set up in the ~/.vnc/xstartup. The -geometry switch lets me specify the size of the display of this X server. This should be the same resolution as the display connected to the raspberry pi. The resolution I’m using only looks weird, because I’ve rotated the display by 90 degrees, because I’m planning on looking at PDFs and the like on that screen.

Now we can start the vncviewer on the raspberry Pi:

Again, you need to replace the IP  with the IP of your laptop/server. Basically, that’s it. You should now be able to use your third screen. But I encountered some problems, like the keyboard focus not working properly in fullscreen mode and the ‘d’ key not working properly, I’ve prepared some workarounds for that; But depending on your setup, maybe it works for you out of the box.

Some Workarounds

Getting the keyboard to work in fullscreen mode

install the program xrdb

Now we need to set the option grabKeyboard inthe ~/.Xresources file and the apply the configuration using xrdb:

Now you should be able to use your keyboard in fullscreen mode.

pressing the key ‘d’ results in showing the desktop instead of typing the character ‘d’

This seems to be a problem using the keyboard shortcuts, which are predefined in XFCE in combination with VNC. To work around thi issue, just set the show desktop command to some other hotkey.

Go to the keyboard tab and change the show desktop hotkey to something different.

16 thoughts on “Using a Raspberry Pi to connect a third display over LAN

  1. Pingback: ディスプレイアダプタとしてのVNC | 日々の記録

  2. Hi there,
    Great job you did with this tutorial.
    Really simple.

    I get a connection with my pi (both synergy & tightvnc)
    and both mouse and keyboard get passed properly,
    but my pi has a grey(ish) screen and I can’t drag windows to it…
    How can I fix this?

    • you can fix the grey screen by setting the color model used by the vnc server. it probably uses RGB556 to save bandwidth, but you should be able to set list to 24bit RGB to make it look right.

      unfortunately there is no way to drag windows between the monitors. this is only possible if you make some adjustments using xrandr to expand one of your screens virtually, but this often causes other issues… I recommend using your pi screen for monitoring and the like, where you don’t need to touch the windows ofteen

  3. Hi, great tutorial, I have a question, it is possible to install more than 1 display via LAN, I mean, the raspberry Pi has their own monitor, and I want to connect 10 tft displays via LAN, is like the display are the hosts and the PI is the server.

    Thanks.

    • It is possible to add many more displays, as long as the network bandwidth and the power of the host computer is sufficient; But I guess even adding a second screen could max out a normal desktop easily, since everything had to be rendered in software (as opposed to be composited by the graphics card), then it needs to be compressed, sent over the wire and so on…

    • If you mean streaming any part of the your regular desktop by “original desktop”, then yes, you can do that using vnc. when starting vncserver, you just have to pass :01 as arguments, instead of :99

  4. Hey this looks great! I’ll certainly give it a shot. Just one question – how responsive is it? I know that VNC isn’t the greatest for latency (although it may have come a long way in the last few years).

    I’ve also just ordered the new Pi2 – can’t wait for them to port Win10 over to it so I can try that out too! 🙂

    • Well, let’s just say you can’t watch a movie on it. But especially for any kind of terminal/word-processing applications good enough. You can play around with the color-depth settings to reduce the throughput and therefore the latency. Furthermore, if latency is important to you, you could try to use another vnc client, fbvnc, which draw directly into the framebuffer instead of going through X11 which would also help with screen update frequency.

  5. Hi,

    Like the idea.

    I would be interested in how it performs when you are trying to play a live Web cam stream (connected to the pi with USB redirection via VNC) and see the latency.

    That way the network & the pi has to simultaneously send & receive big amount of data.

    Thanks,

    • It’s quite a while that I haven’t used this setup. The latency was okay for typing stuff in the terminal but for surfing or even watching movies it was not that great.

Leave a Reply

Your email address will not be published. Required fields are marked *