In my previous article, I had written about Raspberry Pi and the use of the GPIO pins. You can set up the Pi using a monitor connected to the Pi using an HDMI cable and the keyboard, mouse connected to RPi’s USB port. Just download the Raspbian OS in an SD card and put in the slot given in the backside of the Raspberry Pi and BAM!! Do not worry, if you don’t have a monitor, keyboard, etc for this. It is so simple to set up the Raspberry Pi and access on your laptop. Only thing, you must have a LAN (Ethernet) cable and modem with the internet. When you do not use a monitor or keyboard to run a Pi, it is called as headless.
About Raspbian
Raspbian is a free operating system based on Debian optimized for the Raspberry Pi hardware. An operating system is the set of basic programs and utilities that make your Raspberry Pi run. However, Raspbian provides more than a pure OS: it comes with over 35,000 packages, pre-compiled software bundled in a nice format for easy installation on your Raspberry Pi. The Raspbian is free software and a community funded.
Things you needed to setup Raspberry Pi
- Raspberry Pi
- Ethernet cable
- Router
- SD card (maybe 16 GB)
- SD card reader
- Micro USB 2.0 Power source Connector ( smartphone charger to power RPi)
Softwares needed
- SD Card Formatter – https://www.sdcard.org/downloads/formatter_4/
- Win32 DiskImager – https://sourceforge.net/projects/win32diskimager/
- Advanced IP Scanner / Fing app – https://www.advanced-ip-scanner.com/
- Putty- https://www.putty.org/
- TightVNC Viewer – https://www.tightvnc.com/download.php
- Raspbian Image – https://www.raspberrypi.org/downloads/raspbian/
Follow these steps to install the headless Raspberry Pi successfully.
Step 1 : Formatting the SD Card using the SD Card Formatter
Install the SD card formatter from the link given above. Insert the SD card in the card reader and format it.
Step 2: Download the Raspbian Image
Download the Raspbian Image from the given link. You can choose either Raspbian Stretch Lite version or with the desktop from the options. If you are choosing Raspbian stretch with desktop, you will have access to desktop and icons ie. you will have access to GUI. If you are choosing the Raspbian stretch lite version, you will be able to boot the command line. Also, the size of this file is less and uses fewer resources. But for beginners, use the desktop version.
It will be downloaded in a Zip file, unzip it and you will find an image file. Meanwhile, download the Win32 DiskImager in your laptop.
Step 3: Write the Image file to the SD card using Win32 DiskImager
Open the Win32 DiskImager and click the icon (1). Select the image you need to write to the SD card and click Write (2) option. This takes 5 – 10 minutes to be done.
Step 4: Adding SSH file to the SD card
So now you have written the image file into the SD card and you will numerous files. In the recent Raspbian OS, SSH is not enabled so you have to create a file and add to that. Simply you can create a new file in the notepad and save it as “ssh” and copy it to the SD card. This flags the Pi to enable the SSH system on the next boot.
Step 5 : Start Booting the Pi
Right now you have the Raspbian OS installed in your SD card. Put it in the slot given back of of the Pi and connect the Power connector and the Ethernet cable to the modem with internet. Both the green and red LEDs should be blinking. Now download the TightVNC viewer, Putty and Advanced IP Scanner.
Step 6: Find the IP address of you Raspberry Pi
You can find your Raspberry Pi’s IP address by using an app called Fing or you can download Advanced IP Scanner.
Important note: The network of which your
Step 7: SSH into the Raspberry Pi
I use putty for enabling the SSH in the Pi. The default credentials are
username : pipassword : raspberry (this can be changed in the configuration)
Enter the IP address of the Raspberry Pi in the putty and enable the X11 forwarding. Click Open. Give the username as pi and password as raspberry.
Update the Raspberry Pi with the following linux shell commands. Install the tight vnc server in the Raspberry Pi.
sudo apt-get update
sudo apt-get install tightvncserver
Step 8 : View in the tightVNC viewer
As you had already downloaded and installed the tightVNC viewer in your system. Now install in the Raspberry Pi using the above command.
tightvncserver
It asks to set up a password for tightVNC server.
Open the
Finally!!
You will get a display like this, but you can change that to wifi mode. You can simply do that by clicking on the data symbol on the right top corner and select your wifi name and enter password.
Configure the Raspberry Pi
You must configure the Raspberry Pi and set up the location in order to access the WiFi.
sudo raspi-config
Final Step
So now you have enabled the WiFI. You can remove the ethernet cable from the Pi and start from
You can find the new IP address of the Raspberry Pi without the LAN cable. Use the IP address for Putty and the TightVNC viewer.
Everytime when you are opening the putty, check for the updates by applying the command:
sudo apt-get update
When you are disconnecting the Pi, apply the command;
sudo reboot
Summary:
- Download and install Putty, TightVNC viewer
- Download and install SD card formatter and Advanced IP Scanner
- Download Raspbian Image
- Write the Raspbian image in SD card using Win32 DiskImager
- Insert the SD card in the Pi and power up
- Connect the ethernet cable to the router
- Open Advance IP Scanner and search for the Pi’s IP address
- Open Putty and enter the IP address
- Install tightvncserver in putty
That’s it! You can access your Pi headless. For any questions, feel free to contact me or you can comment below.