The Raspberry Pi is a fantastically affordable computer, but when you add in the cost of a display, mouse, and keyboard, things get a little more expensive. Good thing you don't really need them. With VNC, you can access your Pi from a laptop or desktop computer using the same mouse, keyboard, and display that you always do, no rewiring required.
Step One: Download VNC Viewer on Your Windows or Mac Computer
You have a lot of different options for VNC software, but we've found that VNC Viewer is the easiest to use that works well with the Raspberry Pi. From your PC or Mac (and iPhone or Android, for that matter), head to RealVNC's VNC Viewer, click the Download button for your operating system, then download the free application.
Step Two: Start VNC Server Using SSH or Terminal
VNC Server is included with the newest version of Raspbian, PIXEL, so all we need to do here is start up a server. If you're using an older version of Raspbian or a different operating system altogether, this guide by the Raspberry Pi Foundation shows you how to download and install it.
We're assuming that you want to set up VNC because you don't have access to an extra display, mouse, and keyboard. So, the best way to do so is to use Secure Shell (SSH). SSH allows you to control your Raspberry Pi using the command line from any computer. You'll need to do this to start the VNC Server for the first time.
- Power up your Raspberry Pi and plug it into your router with an ethernet cable.
- Download and install Adafruit's Pi Finder for your operating system. When it's done downloading, launch the app and click the "Find My Pi" button.
Pi Finder will search for the Raspberry Pi on your network. Let it do its thing. Eventually, it will show your Raspberry Pi's IP address. Make sure the user is set to
piand the password is set to
raspberry(assuming you haven't changed these from the default, that is, otherwise enter your own credentials), then click the Terminal button.
This logs you into the Raspberry Pi's command line, where you can start up the VNC Server that comes packed with your Pi. In the command line prompt, type in:
vncserverand press Enter. This runs a command and starts the VNC server on the Raspberry Pi. At the end of the command you'll see a note similar to the one in the image above that says, "New desktop is
raspberrypi:1" followed by a number that includes the Pi's IP address, like (
192.168.0.19:1). Make a note of this number, you'll need it to log into the VNC server from your PC.
Now that the VNC server is running, you can log into it from your other computer.
Step Three: Log Into VNC Server from Your PC
Now it's time to log into that VNC Server:
- From your PC or Mac, double-click the VNC Viewer application you downloaded in the first step.
In the VNC Server box, type in the number you made a note of in the previous step, like
192.168.0.19:1, then click Connect.
pifor username and
raspberryfor password and click OK.
Within a few seconds, VNC Viewer should display your Raspberry Pi's desktop environment. You can now control your Raspberry Pi just as if you were sitting right in front of it and using a keyboard, mouse, and monitor connected to the actual Pi.
Step Four: Set VNC to Start Automatically
Unless you want to go through the process outlined in step two every time you want to use your Raspberry Pi, you'll want to set the VNC Server to run automatically at boot. This is very easy to do:
- In the Raspberry Pi's desktop environment, click the Terminal icon to open up your command line.
sudo raspi-configand press Enter.
- Use the arrow keys to scroll down to Advanced Options and press Enter.
- Scroll down to VNC Server and press Enter.
- Select Yes and press Enter.
That's it, now the VNC Server should start automatically on boot. Once VNC is set up, you can use your Raspberry Pi just like a second computer no matter where it's plugged in. VNC is incredibly useful when you only own a laptop and don't want to buy a whole set of accessories just to use your $US35 ($46) Raspberry Pi, or if you only need access to the user interface for brief moments for a project and don't feel like going through the rigamarole of setting everything up all the time.