How To Control Your Raspberry Pi From Any Computer Using VNC

How to Control Your Raspberry Pi from Any Computer Using VNC

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

How to Control Your Raspberry Pi from Any Computer Using VNC

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

How to Control Your Raspberry Pi from Any Computer Using VNC

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.

  1. Power up your Raspberry Pi and plug it into your router with an ethernet cable.
  2. 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.
  3. 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 pi and 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.
  4. 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: vncserver and 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

How to Control Your Raspberry Pi from Any Computer Using VNC

Now it's time to log into that VNC Server:

  1. From your PC or Mac, double-click the VNC Viewer application you downloaded in the first step.
  2. 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.
  3. Enter pi for username and raspberry for 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

How to Control Your Raspberry Pi from Any Computer Using VNC

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:

  1. In the Raspberry Pi's desktop environment, click the Terminal icon to open up your command line.
  2. Type in sudo raspi-config and press Enter.
  3. Use the arrow keys to scroll down to Advanced Options and press Enter.
  4. Scroll down to VNC Server and press Enter.
  5. 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.

WATCH MORE: Tech News

Comments

    Wouldn't one want to log into the Pi under display:0 vs display:1 perhaps even as the default?

    I've had a Pi sitting there for months, with no real urge to doing something (theres always next weekend), mostly because I didnt have a spare mouse. And having just bought a cheapo on the weekend, now I find this.

    Typical, but not surprising :) Ah well, my main mouse is starting to fritz anyway, always handy to have some sort of backup.

    I've seen a few articles about using VNC (and your PC).
    I've also seen articles about making a Raspberry Pi into a thin client, or even a terminal.

    What I haven't seen [yet] is - an ultra thin client / terminal, for connecting to the Pi. Or any of the plethora of Dev boards, come to that.

    Should I be searching on Kickstarter?

Join the discussion!

Trending Stories Right Now