Connecting a Raspberry Pi to a Laptop Display

After purchasing a Raspberry Pi and an SD card, you might not feel like going out and buying a display, mouse, and keyboard just to create a simple project. No worries! Together, a laptop and an internet connection are sufficient to get started on your Raspberry Pi. How?

1. Make Sure the OS Is Installed on the SD Card

Your SD might have Raspberry Pi Operating System installed. Otherwise, you can easily download the Raspbian Operating System and install it on a blank SD card.

For the rest of this tutorial, I will be assuming that your SD card has the Raspbian operating system installed.

2. Configure the Wifi Connection on Your SD Card

Now you’re ready to configure your SD card so that, on boot, your Raspberry Pi will connect to a wifi network. Once the Raspberry Pi is connected to a network, you can then access its terminal via SSH.

Insert your SD card into your laptop. You should see a /boot file folder show up. First, create a file named wpa_supplicant.conf in the /boot folder.

Information like accepted networks and pre-configured network keys (such as a wifi password) can be stored in the wpa_supplicant.conf text file. The file also configures wpa_supplicant—the software responsible for making login requests on your wireless network. So, creating the wpa_supplicant.conf file will configure how your Raspberry Pi connects to the internet.

The contents of your wpa_supplicant.conf file should look something like this:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

The first line means “give the group ‘netdev’ permission to configure network interfaces.” This means that any user who is part of the netdev group will be able to update the network configuration options. The ssid should be the name of your wifi network, and the psk should be your wifi password.

After creating and updating the wpa_supplicant.conf file, add an empty SSH file in /boot. This SSH file should not have any file extensions. When the Rasperry Pi boots up, it will look for the SSH file. If it finds one, SSH will be enabled. Having this file essentially says, “On boot, enable SSH.”  Having SSH will allow you to access the Raspberry Pi terminal over your local network.

3. Turn on Your Raspberry Pi

Put the SD card back in the Raspberry Pi. Power on.

4. Connect to Your Raspberry Pi with SSH

Make sure your laptop is on the same network as the Raspberry Pi (the network in the wpa_supplicant.conf file). Next, you’ll want to get the IP address of the Raspberry Pi on the network. Run arp -a to see IP addresses of other devices on your network. This will give you a list of devices and the corresponding IP and MAC addresses. You should see your Raspberry Pi listed with its IP address.

Connect to the Raspberry Pi by running ssh pi@[the Pi's IP Address]. If this is your first time logging in, the default password should be “raspberry.” You can configure your own custom password after the first login.

You should now have access to your Raspberry Pi command line.

5. Install VNC Server

Now you have access to your Raspberry Pi terminal, but how do you see the Raspberry Pi desktop? You’ll need to install a VNC server. Running a VNC server on your Raspberry Pi allows you to control your Raspberry Pi desktop remotely on a laptop (the VNC viewer).

Realvnc-vnc-server worked well for me.  To install, copy the following into the terminal:

sudo apt–get update
sudo apt–get install realvnc–vnc–server realvnc–vnc–viewer

After installing the VNC server, you will need to enable it:

  • type sudo rasps-config in your terminal
  • A pop-up will appear; navigate to 5 “Interfacing Options”
  • Navigate to “P3 VNC”
  • Select “Yes” also provides a step-by-step guide on how to do this.

6. Install a VNC Viewer on Your Laptop

I installed VNC Viewer from RealVNC.

After installation, launch VNC Viewer, and type in the IP address of your Raspberry Pi as the VNC server address. If you’ve forgotten its IP address, just run arp -a again.

VNC Viewer will then prompt you for the Raspberry Pi default credentials. If you have not yet configured them, the default username is “pi,” and the default password is “raspberry.”

Congratulations! You should see your Raspberry Pi desktop!