Setup VNC with raspberry pi

Remember, last time we controlled our Raspberry Pi using SSH? While SSH brings whole Linux console from Raspberry Pi to your computer, it doesn’t really replicate the functionality of a monitor. After all, where is ‘remote control’ if you can’t see and control the desktop, right? Don’t worry, this post will teach you how to bring your Pi desktop to your computer by setting up VNC on Raspberry Pi. This is just like SSH, but with desktop instead of console.

What is VNC?

VNC stands for Virtual Network Computing. As the name suggests, it is virtual computing over the network. VNC consists of two components: a server and a client. Server is the computer which is bing controlled remotely and client is one which we are using to control the server. In our case, we will set up the Pi as VNC server and use any other computer on the network as client.

Setup VNC on Raspberry Pi

To correctly install and set up VNC server, we will need to access the Pi. As mentioned in this tutorial, you should set up SSH connection between the Pi and the computer. Once SSH connection is made, follow the steps to set up VNC server:

  • First of all, we need to install the packages necessary for VNC. You can install all the packages in one command!

    $sudo apt-get install tightvncserver

  • Now that you have installed the package, you need to start the server. Again, a simple command should do this.

    $vncserver :1 -geometry 1200×600 -depth 16 -pixelformat rgb565

    This command starts VNC server at port ‘1’ with resolution of ‘1200×600’. You may change the port number if you wish. Make sure the port is free. Other services may require that port. For example, SSH and FTP have default ports as 22 and 21 respectively. Avoid such ports. Secondly, ‘1200×600’ is the resolution which you will on the client machine. So, if your laptop as resolution of 1366×768, make sure your VNC server sends something lower than this. If you set VNC resolution to 1366×768, you will have Raspberry Pi’s desktop occupying whole laptop screen.Setup VNC on Raspberry Pi

  • Fist time you start the server, you might be asked for a password. Enter the password you wish to setup and complete the process.

That’s it! You’re done here. Now, move ahead and setup the client.

Setup the client

Setup VNC on Raspberry PiThis is relatively easy. Actually, you don’t have to do any setup at all. All you need to do is download a VNC client (we recomment downloading UltraVNC viewer), enter the details and hit the go button. Boom, you have the Raspberry Pi desktop, running inside a window on your computer.

The beauty of VNC is that it provides not only monitor but also other peripherals like mouse and keyboard. You can use your computer’s mouse and keyboard as if it was connected to the Raspberry Pi directly.

Need some more help? Let us know via comments.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.