Building a project where you need to access a Raspberry Pi remotely?
You can enable SSH on the Pi and access it remotely via a terminal from another system.
However, not everyone is comfortable with the device and the commands.
The alternative is to access the Raspberry Pi via VNC. This way, you can create a remote connection to the Pi and use it graphically as if it were connected to your monitor and keyboard.
Of course, such a connection may be slightly delayed depending on the configuration of the Raspberry Pi system and network speed.
But at least you can access it graphically remotely.
It consists of these steps:
- Enable VNC from Settings on Raspberry Pi
- Use the VNC client on the remote computer where you want to access the Pi (on the same subnet)
- (Optional) Set up a complex VNC configuration or use the paid option of Real VNC to access the Pi online
Let me show you how to access a Raspberry Pi using VNC. But first, fast
What is VNC?
VNC stands for virtual network computing. Think of it as SSH but with a GUI. It allows you to remotely access a computer on a network and allows you to control it using the normal GUI as if you were actually using it. VNC is equivalent to TeamViewer type of application.
In our case, VNC will help us control the Raspberry Pi over the network, but as if the mouse, keyboard, and display were physically connected to the Raspberry Pi. The use of VNC is not limited to computers. You can control your Raspberry Pi from your phone or tablet too!
There are many VNC programs available. I will be using RealVNC here. It is (probably) a proprietary solution from the original creators of the VNC protocol.
Step 1: Activate VNC on Raspberry Pi
Usually, the Raspberry Pi OS should already have the required packages installed. However, you can make sure of this by installing them again.
sudo apt install realvnc-vnc-server realvnc-vnc-viewer
Once you have the necessary package, proceed to enable the VNC service.
There are two ways to enable the VNC service; Using the GUI or using the raspi-config CLI tool. I will discuss both.
Method 1: Using the GUI
This is the easiest way to enable the VNC service. The steps to do this are as follows (for the default Raspberry Pi OS):
- From the top bar, select food menu > Preferences > Raspberry Pi . configuration.
- In the app view, go to interfaces tab.
- Make sure that the file VNC The service is set to maybe.
Method 2: Using the “raspi-config” tool
The ‘raspi-config’ tool is the lifesaver on the Raspberry Pi. It has all the different knobs that you can adjust to achieve your desired configuration.
To enable the VNC service, run the following command in your terminal:
This will start the raspi configuration tool in your terminal. go to the Communication options And find the option that says VNC and enable it.
do it! You have now set your Raspberry Pi as your VNC server.
Step 2: Connect to the Raspberry Pi (via LAN)
You have enabled VNC server on Raspberry Pi. Let’s call him.
Get the IP address of your Raspberry Pi
There are several ways to get the IP address of a Raspberry Pi. You can check your router for all devices; Or if you have already SSH into your Raspberry Pi, it is better to use the “hostname” command like:
Running the “hostname” command will give you the IP address assigned to your Raspberry Pi.
Please note that if a static IP address is not assigned to your Raspberry Pi by your router, it may change in the future.
On my network, the Raspberry Pi got “192.168.11.4” as its IP address. So, this is what I will be using. Yours will be different.
Get RealVNC Client
Just like SSH needs a server and client software, VNC needs a client too. You can visit RealVNC website to download the OS related client on your PC/Phone/Tablet.
Once you have downloaded the installer, install it using the standard method most suitable for your operating system and launch RealVNC Client.
Contact Raspberry Pi
Once the RealVNC client is installed, open it. You will have a title bar at the top (although the main UI has been redesigned). Please enter your Raspberry Pi’s IP address here.
Once you have entered your Raspberry Pi’s IP address into the top address bar, you will be asked for a username and password. Here, use the credentials you use to log into the Raspberry Pi itself – the ones used for SSH, too.
The username and password are “pi” and “raspberry” respectively. So, I will use these credentials to login.
Your computer must connect to the Raspberry Pi via a VNC session. our end! 🙂
Optional: Connect to a Raspberry Pi (online)
You just learned to connect to a Raspberry Pi on the same network, but what if you are not at home and want to connect to the device from the Internet?
You don’t need to remember any IP address or modify your firewall or router configuration. RealVNC handles all of this using your RealVNC account.
The downside to this is that you Need a paid account. At the time of writing this article, the cheapest subscription available is $3.39 per month (billed annually).
If you’re fine with another subscription and need to access your Raspberry Pi online frequently, this subscription should be worth it.
I use SSH to connect to my Raspberry Pi remotely. Using VNC can also be a good option if you need the convenience of a GUI. This works without much effort if the devices are on the same subnet.
I hope this quick tutorial was helpful in accessing a Raspberry Pi using VNC. Please let me know if you have questions and I will do my best to help you.