Accessing Raspberry Pi without monitor and keyboard

Raspberry Pi is a small embedded linux machine which runs on ARM architecture-based processors. It is a small computer, which when connected to a monitor/display, a keyboard and a mouse, can do almost all the tasks of a linux machine. But what if we don’t have monitor and keyboard? This post explains how to install Raspbian OS on the Pi with only laptop and how to use the Pi remotely.

Requirements

  • Laptop or Desktop (windows/linux/macOS)
  • Raspberry Pi
  • Memory card (16GB+ preferred)
  • Router (For internet connection)
  • Raspbian OS
  • Balena Etcher (For writing iso file on memory card)
  • Putty or MobaXterm (For remote access)

Installation

Download Etcher and Raspbian OS. Balena Etcher is required for flashing the Raspbian OS onto the memory card. Insert the memory card into the laptop. Select the ISO or zip file of the Raspbian OS that was downloaded, then select the memory card and hit Flash.

Balena Etcher for flashing OS

It will take some time to flash the file and for it to validate. After flashing the Raspbian OS, take out the memory card and reinsert it into laptop for to enable ssh access.

You might get this pop up after re-inserting memory card. Click cancel to continue

For windows

Open cmd.exe (Command window). Powershell may not work. It didn’t work for me. Hence, it is better to use cmd. The user directory will pop up when it opens. Else if you have opened cmd using administrative priviliges, the system32 directory will be visible.

  • Switch to the memory card drive. It will be named “boot”. Note the alphabet representing the boot drive. (Mine is ‘F’)
    Type F: and press Enter.
  • Type the command below
    type NUL >> ssh
    This will create an empty file named ssh in the drive without any extension.
  • Check in the boot directory for the file.
  • If you are connecting the laptop using ethernet, go to the section “Remote access using SSH” below or if you are connecting wirelessly using WiFi, go to section “Configuring WiFi”.
  • Now you can insert the memory card into the Raspberry Pi.
Creating blank file in the boot directory

For Linux and Mac

Open up a terminal window and run the following command
touch /Volumes/boot/ssh

Configuring WiFi on raspberry pi

In the boot directory, create a file named “wpa_supplicant.conf” and paste the code below. Change the country to using respective country code. Country code can be found by clicking here. I live in India and so my country code is IN. Replace NETWORK-NAME to your WiFi name and NETWORK-PASSWORD to your WiFi’s password.

country=IN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="NETWORK-NAME"
psk="NETWORK-PASSWORD"
}

After editing title of your country code, network name and network password, save the file and insert the memory card into Raspberry Pi and power it on.

Remote access using SSH

You don’t need an extra configuration file for connecting using ethernet cable. Connect ethernet cable to raspberry pi and the other end of the cable to the router. The laptop using for remote accessing the Pi must also be connected to the same router.

Login into the router admin panel from browser in laptop and find the IP address of the Raspberry Pi. Note down the IP address of the Pi. You can even access using the hostname of Raspberry Pi, but some of the router admin panel don’t show hostname. Hence, I have chosen to use IP address.

Router login Screen
Locate IP address of Pi

Once you get the IP address, open PuTTY or MobaXterm. In this example, I will be using MobaXterm, just to show how to access GUI by remote login.

  • Open MobaXterm, Click on session
  • Select SSH from the menu and type the IP address of the Raspberry Pi and click OK.
  • If the connection is successful, a terminal window will open and prompt to login.
    By default, the login ID of the Raspberry Pi will be “pi” and the password will be “raspberry” (Without ” “)
    Provided that authentication is successful, you will be able to log into the Raspberry Pi.
  • If you want to start GUI and access the desktop, type the command
    startlxde

If you are comfortable using just command line, I would suggest to skip the last step. Running a graphical interface needs more RAM and by using the terminal window, you can save some RAM space.

You can use PuTTY for remote login. Procedure is much simpler; enter the IP address, insert the port number as 22 and click “open”.

And that’s it. This is how to access Raspberry Pi over WiFi/Ethernet.

Further read

Check links below for updating the operating system, changing hostname, username and rest of the tutotials. Enjoy and keep innovating.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.