Introduction: Connecting Raspberry-Pi to Laptop Without HDMI or Ethernet Cable

Connecting to Raspberry-Pi becomes a tough task especially when we do not have an HDMI cable or ethernet cable. In such case we can make use of SSH(Secure Shell) through Putty and VNC viewer.

Here is a step by step process of the same:

  • Take a SD card and connect it with your computer. It can be done by putting it in microSD card adapter or SD card reader. Or we can connect it using our mobile.

  • Backup and delete all the files on microSD card.

  • Download Raspbian Buster with Desktop zip file and extract it. Link: https://www.raspberrypi.org/downloads/raspbian/

  • Download Rufus software and install it. Link: https://www.raspberrypi.org/downloads/raspbian/

  • Open Rufus and select the SD card on which the Raspbian OS is to be installed. Select the iso file of the Raspbian OS and click Start. SD card will be formatted and Raspbian OS will be written on it.

  • Create a file with name ‘ssh’ without any extension and put it in the SD card folder. This is to enable SSH in Raspberry-Pi. There will be no code in this file.

  • Create a file with name ‘wpa_supplicant.conf’ and put it in the SD card folder. This file is to enable Raspberry-Pi Wifi adapter to connect to the Wifi with given credentials. The code present in this file should be:

country=IN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={ ssid="<wifi name>" scan_ssid=1 psk="<wifi password>" key_mgmt=WPA-PSK }
  • Put the SD card in the Raspberry-Pi and connect the Raspberry-Pi with USB cable for power supply.

  • Download Putty(SSH client for windows). Link: https://www.putty.org/

  • Download VNC viewer for graphical interface of Raspbian OS. Link: https://www.realvnc.com/en/connect/download/viewer/

  • Connect your laptop with the same Wifi, whose credentials are given in wpa_supplicant file.

  • We can check and verfiy that Rasperry-Pi gets automatically connected to the Wifi.

  • Now we have to find the IP address of Raspberry-Pi. We can get that by opening up the router setting page where all the connected clients are visible.

  • We can also use Nmap to scan the router IP address and get the IP address of all the devices connected to it. Mobile hotspot can also be used for the same. Link: https://nmap.org/download.html

  • We can also use Nmap to scan the router IP address and get the IP address of all the devices connected to it. Mobile hotspot can also be used for the same. Link: https://nmap.org/download.html

nmap -sP -PI -PT <ip address of host>/24
  • We can obtain IP address of host by checking the network properties in our laptop as DNS server address, and now we have the IP address of Raspberry-Pi.
  • Open Putty. Enter the IP address of the Raspberry-Pi. Insert ‘22‘ (SSH Port no.) in Port. Click Open.

  • A terminal opens where we will be asked username and password. Username=’Pi’, password=’raspberry’.

  • We get the CLI of Raspberry-Pi. Type:

sudoraspi-config
  • We get the configuration menu.

  • Go to Interfacing options, choose VNC and enable it. We can now exit the terminal.

  • Open VNC Viewer. Create new connection with IP address of Raspberry-Pi. Login again with Username=’Pi’, password=’raspberry’.

  • We get the GUI of Raspbian OS.