Saturday, November 28, 2015

Use your smartphone as a GUI display for your pi

With a very simple hack, we can use our smartphone as a GUI display for your raspberry pi. This can work over remotely and there is not HDMI or any other connector required to connect your smartphone to your pi.

There are a few apps that you would require on your smartphone. Download and install

Xserver XSDL

Xserver XSDL is a xserver which can be run on your smartphone. Whereas connectbot is a simple ssh client for connecting to your raspberry pi via ssh. The trick here is to run the Xserver on your smartphone. Ssh to your pi and tell your pi to forward the display to the Xserver running on your smartphone.

Let us see the configurations that need to be verified on the pi. Ssh to your raspberry pi over the network and check the following configuration options in these files.


AllowTcpForwarding yes
X11Forwarding yes
X11DisplayOffset 10


ForwardX11 yes
ForwardX11Trusted yes

If these configuration options are commented out, simply uncomment them. Else add them and restart your ssh server on your pi.

$ sudo service ssh restart

Now start the app Xserver XSDL on your smart phone. It may download a set of fonts and will then ask you to run some commands on your linux PC. The Xserver starts running on port 6000. Now, we need to forward the display of pi to our smartphone.

Go back to the ssh connection on your smartphone and run these commands.

$ export DISPLAY=           
$ export PULSE_SERVER=tcp:

My smartphone is running on the ip And i am forwarding the display directly to the Xserver running on port 6000.
This is insecure as the port forwarding is not happening over ssh but directly from the pi to the smartphone. But if you are on a local network, it should not matter.

Now simply start your lxde desktop environment on the ssh connection. Execute the following command on the ssh connection.

$ startlxde

And bingo...

It is not very comfortable for working as the mouse pointer is difficult to catch and click. But if you have an old smartphone or tablet lying around, you can use it as a display - running a smart photo frame or a hanging smart calendar.

No comments: