How to Control a Raspberry Pi From Any Computer Using VNC
The $ 35 Raspberry Pi is a fantastic little computer, but when you add in the cost of a display, mouse, and keyboard, things get a little more expensive. It’s good that you don’t really need them. With VNC, you can access your Pi from your laptop or desktop using the same mouse, keyboard, and display you always do, without having to reconnect.
Step one: download VNC Viewer on your Windows or Mac computer
You have many different VNC software options, but we found the VNC Viewer to be the easiest to use, and works well with the Raspberry Pi. From your PC or Mac (and iPhone or Android for that matter), go to RealVNC’s VNC Viewer , click the Download button for your operating system, then download the free app.
Step 2. Start VNC Server using SSH or Terminal
VNC Server is included with the newest version of Raspbian, PIXEL , so all we have to do is start the server. If you’re using an older version of Raspbian or a completely different operating system, this Raspberry Pi Foundation guide shows you how to download and install it.
We’ll assume you want to set up VNC because you don’t have access to an additional display, mouse, and keyboard. So, the best way to do this is by using Secure Shell (SSH). SSH allows you to control your Raspberry Pi using the command line from any computer. You will need to do this to start the VNC Server for the first time.
- Turn on your Raspberry Pi and connect it to your router using an Ethernet cable.
- Download and install the Pi Finder from Adafruit for your operating system. When the download is complete, launch the app and click the Find Pi button.
- The Pi Finder will search for the Raspberry Pi on your network. Let him do his job. Eventually, it will show the IP address of your Raspberry Pi. Make sure the user is set to
pi
and the password is set toraspberry
(assuming you haven’t changed the default, that is, enter your own credentials otherwise), then click the Terminal button. - This will allow you to enter the Raspberry Pi command line, where you can start the VNC server that comes with your Pi. At the command prompt, type:
vncserver
and press Enter. This runs the command and starts the VNC server on the Raspberry Pi. At the end of the command, you will see a note similar to the one in the image above, which says “New Desktop –raspberrypi:1
” followed by a number that includes the Pi’s IP address, for example (192.168.0.19:1
). … Make a note of this number, you will 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: login to VNC Server from your PC
It’s time to log into this VNC server:
- On your PC or Mac, double-click the VNC Viewer application you downloaded in the first step.
- In the VNC Server field, enter the number you wrote down in the previous step, for example
192.168.0.19:1
, then click Connect. - Enter
pi
as username andraspberry
as password and click OK.
Within a few seconds, the 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 a real Pi.
Step four: configure VNC to start automatically
If you don’t want to go through the process in step two, every time you want to use your Raspberry Pi, you need to configure the VNC server to start automatically on boot. It is very easy to do this:
- In the Raspberry Pi desktop environment, click on the terminal icon to open a command prompt.
- Type
sudo raspi-config
and 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, the VNC Server should now start automatically at boot. After setting up VNC, you can use your Raspberry Pi as a second computer no matter where it is connected. VNC is incredibly useful when you only have a laptop and don’t want to buy a whole bunch of accessories to use your $ 35 Raspberry Pi, or if you only need access to the UI for short periods of time for a project and don’t want to go through a chore. constant tweaking of everything.