Raspberry Pi

How To Connect Raspberry Pi To a Laptop?

No doubt that Raspberry Pis were manufactured to promote basic computer education to weaker sections of society, but now the definition of Raspberry Pi has changed up to a great extent.

Maybe you are a college student and have some projects to run in your exhibition where it is impossible to carry HD displays, or you don’t have any monitor and a laptop only. This is one of the instances where you will require to connect your laptop to the Raspberry Pi. Connecting Raspberry Pi to the laptop is not a tough task but long enough to mess up things.

Also, Raspberry Pi is known as a budget computer so, buying extra displays, keyboards and mice will surely contradict the main motto of the organization. The main benefit of connecting a laptop to Raspberry Pi is that it becomes wireless when connected via Wi-Fi. In this article today, I will be guiding you in connecting Raspberry Pi to a laptop. Let’s start:

Working Of The Setup

Raspberry Pi can be easily connected to the laptop using Wifi or ethernet. I prefer WiFi over ethernet as it makes the setup completely wireless. Certain applications enable users to set up connections among Raspberry Pi and laptops. The most trusted one among them is the VNC server.

VNC server enables users to view the Pi desktop remotely. Yes, you can keep Pi anywhere in your house and control it sitting in another corner.

Prerequisites For the Setup

  • Raspberry Pi
  • Stable WiFi connection
  • Laptop
  • SD card for Raspbian OS

How To Connect Raspberry Pi To Laptop

As told above, connecting a laptop to a Raspberry Pi is a long process. So I will be writing the post in steps so that it becomes easier to follow.

Step-1 Install Raspberry Pi OS

To begin with, we need to install the Raspberry Pi OS on the SD card. I advise you to install the popular Raspbian OS with desktop and recommended from this link. Raspbian provides you with fully working desktop conditions and a huge collection of programming tools. There are different versions of Raspberry Pi OS available, but for the fullest featured version, you can go with Raspbian Buster with a desktop. You can download a ZIP file or go with a torrent.

Extract the files of OS.

For writing a Raspbian image on the micro SD card, you need to download Win32 Disk Imager. Launch the Win 32 Imager application select the extracted file as an image input box.

Make sure that you are flashing the image to the right SD card. Click on the write button to proceed.

If you face a booting issue with your SD card, you need to format it for Raspberry Pi. This can be done using the official SD Formatter tool from the SD organization.

Step-2 Creating SSH File To Configure Wi-Fi

After installing Pi OS, you need to add some extra files for enabling SSH and connecting WiFi during boot. Starting with, create a file “wpa_supplicant.conf” and paste the code given below, entering your Wifi name, Password, and country code.

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

update_config=1

country=PK #Your country code

network={

ssid="My_WiFi" #Your WiFi Name

psk="123456789" #Your WiFi password

key_mgmt=WPA-PSK

}

To proceed with, create a void file and name it as “SSH” unaccompanied by any extension. This will authorize SSH on the Pi, and you will be able to connect from the PC.

Take out your SD from your PC, insert it into your Raspberry Pi board, and turn it ON.

Step-3 Connect To Raspberry Pi With SSH

Connect your Raspberry Pi and laptop with the same wifi network you entered in the wpa_supplicant.conf file. Now you will require the Raspberry Pi’s IP address. You can see all the connected devices with their IP addresses by running arp -a.

Run ssh [email protected][the Pi’s IP Address]command to connect your Raspberry Pi. If you haven’t configured your credentials earlier, the user name is pi and the password for the Pi password will be “raspberry”.

After connecting, you will have access to the Raspberry Pi command line.

If you don’t wish to run the commands, you can go for putty software. Here you just need to enter the IP address and the default credentials

Step-4 Install VNC Server And Set Resolution

After connecting to Raspberry Pi using SSH, you need to allow the VNC server to control using a mouse and keyboard.

Type the command sudo raspi-config to launch the config tool. Navigate to interface options and select VNC to enable it.

To set a resolution for your Raspberry Pi, move to advanced options and navigate to “resolution”.

You can choose a resolution other than the default from the given dropdown. Click the Ok button and then proceed to reboot.

Step-5 Installing VNC Viewer On Your Laptop

To view and control raspberry pi from your laptop, you need to download and install VNC Viewer.

Launch the VNC viewer when you are done with the installation. Paste the IP address of your Raspberry Pi and Fill in the default user credentials. Click the OK button, and your Raspberry Pi desktop will appear as a VNC window. You will be able to access GUI and perform tasks like a real raspberry mouse and keyboard.

How To Fix “Cannot Currently Show The Desktop” Issue On Laptop?

It’s very rare, but you can face the error “Cannot currently show the desktop” while connecting Pi to your laptop. This may be because of resolution issues. You can easily fix the problem by launching the Putty app.

Establish the connection to Raspberry Pi, entering the IP address and default user credentials. After you have set up the connection, open the configuration tool using the command sudo raspi-config.

Navigate to display options and click on Resolution. If you have an older version of Raspberry Pi, you can find the resolution tab under Advanced Options.

Among the given resolutions, you can choose anyone that suits your laptop. Don’t choose Default as it may cause issues again.

Click on the finish button and shut down the putty app.

Now open the VNC viewer and check if you are connecting to the Raspberry Pi environment or not. Usually, the issue gets resolved. However, if the issue still persists, you can try other resolutions one by one and check which one works for you.

How Can I Fix Slow Running Raspberry Pi?

Though Raspberry Pi’s are not made to compete for the fastest PCs in the market, the recent models are strong enough to replace the systems in most of the fields. However, your Raspberry Pi is likely to slow down if not optimized over time.

The main reasons behind a slow Raspberry Pi might be installed apps, hardware, or the operating system itself.

Here are the tips that can help you in optimizing your Raspberry Pi for faster processing:

Always use a quality micro SD card for writing your OS. Low-quality SD cards are slower in processing. Also, the card we get with our Pi is not the best one, and also storage capacity *GB most of the time.

As of now, several Raspberry Pi OS are now available with the 64-bit version. However, you won’t find a stable version for the OS; still, you can try the beta versions. You can try operating systems like Manjaro or Ubuntu that provide stable versions.

Don’t keep many useless apps on your Raspberry Pi, as it will slow down the device. You can list out the applications and uninstall the useless ones. This can be easily done by applications such as Synaptic.

Optimize the temperature for your Raspberry Pi. If it is getting too hot, then try installing a heat sink or a cooling fan.

Get your Raspberry Pi a proper power supply as different models have their specific requirements. You should always go for adapters from official raspberrypi.org.

The Conclusion

When connecting Raspberry Pi to your laptop, you need to be careful about certain things. From having a properly formatted SD card to a suitable OS image. Your Raspberry Pi and Laptop should be connected to the same network. And moving towards the IP addresses, they keep changing from time to time depending upon connection with ethernet or wifi. So if you fail the connection at your first attempt, try it again by double-checking the IP addresses.

About the author

Shubham Yadav

Shubham is a mechanical engineer by profession. Computer geek at heart he loves to explore new aspects of circuits, motherboards and general PC components.