How to Remotely Access Raspberry Pi 4 through laptop using SSH & VNC?
- February 7, 2020
- Posted by: Naveen PS
- Category: Learn Technology in 5 minutes
The brand-new Raspberry Pi 4 has been out for a few months now. People say that the Raspberry Pi 4 is a pocket-sized Desktop Replacement. Just by connecting a keyboard, a mouse and a monitor, you can essentially have a PC at your home in under 50$. But Raspberry Pi 4 is much more than just a desktop. It can be used as a prototyping tool to do physical computing, by interfacing its GPIO pins with peripherals.
Because of the wide variety of its use cases, there will be times when you can’t or you don’t want the Raspberry Pi to be always connected to a monitor, keyboard or a mouse. Perhaps you’re using another computer and you only have peripherals for your main Desktop. Maybe you have installed your Raspberry Pi 4 behind your TV or a nest of cables and it is out of reach. It is at times like this you wish you had some kind of remote communication with your Raspberry Pi 4.
In this blog, you will learn the straightforward and easy way to setup the Pi and work with it remotely from the first boot itself. That too without ever connecting any mouse, monitor or keyboard.
First, you need to download and install mainly 4 software on your PC and they are:
- Balena Etcher
- Advanced IP Scanner
- VNC Viewer.
You can find the Download Links for Windows and Mac OS here:
- Balena Etcher: https://www.balena.io/etcher/
- PuTTY for Windows: https://www.putty.org/
- PuTTY for Mac OS: https://www.ssh.com/ssh/putty/mac
- IP Scanner for Windows: https://www.advanced-ip-scanner.com/
- IP Scanner for Mac OS: https://angryip.org/download/
- VNC Viewer: https://www.realvnc.com/en/connect/download/viewer/
All these apps have Mac Versions too, thus you don’t need to worry if you are an Apple User.
The first thing you have to do is download the Raspbian OS from the official downloads page and then open Balena Etcher, and click select image and select the zip file you just downloaded. Then connect your MicroSD Card to your Laptop and click flash to start flashing the card.
Once flashing is done, access the Boot Drive of the MicroSD Card. As we are doing a headless installation, we need to manually enable SSH and also add Wi-Fi credentials of the network to the MicroSD card before the first boot. For that, you need to create 2 new files in the boot drive.
- ssh file with no extension
- wpa_supplicant.conf file and add these lines in them
Make sure you change the country ID and your Network Credentials before saving. Now your MicroSD Card is ready to be put in the Pi 4 for the first time. Once the MicroSD Card is inserted and the Pi 4 properly powered on, connect your laptop to the same Wi-Fi network as the Pi.
Now go to your command prompt in Windows and type
ipconfig and get the default gateway. The same information can be obtained by typing
ifconfig in the terminal on Mac OS.
Our next task is to find the exact IP address of the Raspberry Pi 4. For this, we are going to scan the whole network using the IP Scanner. You can see that when we can scan with the default gateway range, the Raspberry Pi device shows up with IP address information.
Now open PuTTY and enter this IP address and authenticate the signature and login using the default username pi and password raspberry. Now you are in the terminal window of the Raspberry Pi.
sudo raspi-config and go to interfacing options and enable the VNC option. Now create a VNC server on the Pi by entering
Finally, open the VNC Viewer App and enter the IP address as shown in the PuTTY terminal and authenticate the server by entering the default username and password. Now you will be greeted with the GUI of the Raspbian Buster on the Laptop.
You have now successfully completed a headless installation and remotely access the Raspberry Pi’s GUI.
Learn Technology in 5 Minutes is a unique video series aimed at demystifying cutting edge technologies in the field of AI, IoT & Embedded Systems. Invest just 5 minutes of your time every day and within a year you will have wide breadth and depth of knowledge on various topics.