Working with Raspberry Pi (without a separate display,mouse or keyboard)

So we have talked about Raspberry Pi before. Today we will see how to work with it. We know that to work with R-Pi we need a monitor, a keyboard and a mouse but many a times we do not have these. So today we will see how to work without a TV/Monitor, just with your laptop.

What all you will need?

  • A Raspberry Pi
  • An SD Card (4 GB or more)
  • USB Power Supply
  • Ethernet Cable/LAN

Let's setup the SD Card

  • Download an SD Card Formatter (you may use your favorite one or just download it from here).
  • There are many Operating Systems available for Raspberry Pi, but today we will work with Raspbian (Stretch version).
  • Download the image of the Raspbian OS (from here). You are given the options to download the zip folder or the torrent. Choose any as per convenience. This will take some time, till then continue to the next steps.

Let's setup the brain in the Card

  • For Disk Imaging use a Disk Imager (You may use any of your choice, but I prefer Rufus). So download it.
  • Using a card reader, insert the SD Card into your laptop.
  • Now format the SD card using the card formatter.
  • Unzip the downloaded Raspbian OS Zip folder to obtain a disc image file.
  • Once your SD card is formatted, open Rufus (for linux use DD tool or any Disk imager of your choice). Now select the path of your downloaded image (in the disc image option) and continue.
  • This will load the operating system in your sd card.
Okay now we are ready to go with the next steps.

Accessing the command prompt of the R-pi

Now we need a way to access the command prompt of the Raspberry Pi, we can do so with the help of an SSH Client. We will use the remote SSH client PuTTY for this purpose.
  • Download PuTTY (from here) and install it. Its installation is just like any other windows application. For Mac, we can ssh into the pi via terminal.
  • We also need to find out the IP Address of the Raspberry Pi, while it is connected to our router with an Ethernet cable. We can find it out by logging in into the router's configuration page and seeing the list of connected devices. Better way to do so is by using an IP scanner software, preferably Advanced IP Scanner (download from here). So, download & install this application (I so like the way, windows applications are easy to install).

This is a very-very Important step (Cannot stress on it more)

This took me a lot, no wait, a lot too much of time to realize. Please do not forget this step. I repeat, do not forget it. SSH is disabled by default in the Raspbian versions released after November 2016. We need to enable it to access the R-Pi command prompt. We can simply do so by accessing the raspi-config and enabling it, but note the title, it says without a separate monitor i.e. headless setup. So of course, we need to rely on some other method.

  • Create an empty file.
  • Name it 'ssh'
  • Place it in the root partition of the sd card. It is the top level folder of the sd card- the one with lesser memory.
  • Remember, the file you create should not have any extension (like .doc or .txt). You can do so by creating a blank file in notepad and saving it as 'ssh.txt' and then by deleting a trailing .txt extension. Now move it to the root partition.
Now we can eject the sd card from the computer.

Now, setting up the Pi

  • Connect the Raspberry Pi with Ethernet cable to the router and with the power supply. To find the local ip address assigned to the pi, open Advanced IP Scanner and give it a range and then click scan, it will display a locally generated list of IP addresses connected to the router. Now note the IP corresponding to "Raspberry Pi Foundation".
  • Now we will connect to the pi.
  • Open PuTTY. Enter the noted IP address into the host name. (Port to 22)
  • Click open to make the connection. You will be given a connection warning, just click on yes.
PuTTY will make an SSH connection between the R-Pi and our computer. It will open up a window giving us access to the Raspberry Pi’s command prompt.
  • When the connection is successful. Login prompt of R-Pi appears.
  • Since this is our first login, the username is: pi and password is: raspberry
Now we have logged in to the raspberry pi via ssh using PuTTY. To configure the pi, just enter sudo raspi-config to enter the settings menu to edit the default configs of the pi. But we can not yet access the desktop of R-Pi. To do so, follow the following steps.

Access Raspberry Pi with a Remote Desktop

  • Download RealVNCViewer from here.
  • Now we need to enable VNC on the Pi. Access R-Pi from Putty. Enter sudo raspi-config to enter the settings menu.
  • Select interfacing options from menu.
  • Then select VNC to enable VNC.
  • Now we need to reboot the pi with sudo reboot to enter the settings menu.
  • Find the IP address or the pi from the Advanced IP Scanner.
  • Now open VNC viewer. Enter the address in the address bar and press enter.
  • You will need to provide the username and password of the Raspberry Pi (which I mentioned above). Click on continue.
  • The Raspbian desktop will open in VNC viewer.
That is it, nothing more to do. All this hard work serves the purpose. Thanks for reading!

Comments

Popular Posts