We are already in process of building our simple Raspberry Pi projects, however I have received few queries on how to enable SSH in Raspberry Pi. So I thought I will write this post to share the details.

Enable SSH in Raspberry PI with monitor, Keyboard & mouse connected to Raspberry is pretty simple. You can refer my post Setup Raspberry Pi 3 for your IoT Projects & follow the steps to install NOOBS & boot to the home screen. Once you get in to the Pi Home screen , you can go to Preferences & click on Raspberry Pi Configuration .

Preferences->Raspberry Pi Configuration

This will bring up the configuration screen , go to the Tab Interfaces & select the radio button enabled for SSH. This will enable SSH to the PI & you can also enable Camera, VNC, Remote GPIO Pin etc in this screen.

Raspberry Pi Configuration

You can also go to Raspberry pi configuration screen through command Sudo raspi-config.

Now the interesting part was , how to enable SSH in Raspberry Pi with out monitor. You dont want to buy an HDMI cable & HDMI supported monitor to setup Raspberry Pi. Lets find out how we can enable SSH with out connecting monitor, keyboard or mouse to your Raspberry Pi.

To start you need to have different operating system, as NOOB will take you to the screen where you need to select the installation & configuration on the screen. So lets start with download of the Raspbian Operating system Raspbian Stretch lite from https://www.raspberrypi.org/downloads

Go to the downloads location & select Raspbian & in the next page click on download Zip below Raspbian Stretch Lite.

Raspbian Stretch Lite download

Extract the zip folder & you will get the image file "yyyy-mm-dd-raspbian-stretch-lite" , The date, month & year will change as new versions are released.

Keep your Micro SD card formatted & ready for installation. Just make sure you are selecting the right drive letter.

Format Micro SD Card

 

To write the image to Micro SD card, you can use Win32disk imager or Etcher. Refer the installation instructions to install Etcher.

I have used Win32disk imager, you download it from the link  and run the EXE to install.Follow the installation instructions, select I agree for license agreement & click next.

 

Select the installation location , click next

Select the options in other screens & click next,you can keep them default & installation will progress. It may take few minutes.

 Once the installation is completed click om Finish & the Win 32 disk imager will be opened. By default the drive letter will be assigned to Micro SD card inserted to your PC, however make sure you double check & confirm the drive letter.

Win32 Disk Imager

Select the raspbian-stretch-lite.img file & write to Micro SD Card. You will be prompted with a message that all files will be erased, click on yes to confirm.

Writing Image to Micro SD Card

It will take 5 to 10 min to complete the image writing. Let us wait!.

Once the installation is completed, go to drive letter/boot.

create file in the name ssh in the boot partition folder. The file ssh is with out extension.you can simply create a text file and rename to ssh, remove the extension .txt.

SSH

Insert the micro SD to the Raspberry Pi , Connect the Ethernet cable to Pi , Micro USB cable & power on the device.

To connect the Raspberry Pi through SSH, you need to know the ip address of the device. You can get that from your router or you can run the command arp -a from the computer which is in the same network which will list the ip address of the devices connected in the same network. you can identify the ip for the Raspberry pi from it & use to connect to SSH.

To connect to the Pi  we need a SSH client software, we can use Putty for this. Download Putty from here.

Once you run Putty, enter the IP address of the Raspberry Pi , click on open. enter the default user name , password.

Default user name: pi

Default password: raspberry

 

you are connected to the raspberry pi now and don't need a monitor , keyboard or mouse to work on your raspberry pi.

To connect through SSH with out Ethernet cable & directly with WiFi , create a "wpa_supplicant.conf" file in the boot partition & enter the below details in it.

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

network={
ssid="YOUR_NETWORK_NAME"
psk="YOUR_NETWORK_PASSWORD"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
}

Enter your network name & your network password . I have tried this , it has worked some cases & some of the time it has not worked where I had to edit "/etc/network/interfaces" or "/etc/dhcpcd.conf " I still need to get a clear picture on what works on which cases so I am not giving more details on this here. You can refer the link which will give some clarification on this. You will not be directly able to access the locations ./etc if you are using windows machine as these partitions are Linux partitions. you will need special software do this. To access Linux partition in Windows I would recommend the software Ext2Fsd, you can download & install it from here. By this software you can connect the SD Card & access the folders directly & make the changes required.

In this post I will cover all the things which you need to know to setup your Raspberry Pi to make it ready for your Internet of Things projects.

We will be using Raspberry Pi 3  model B+, which is the latest Pi available in market & this is having good specifications as listed below

  • Quad Core 1.2GHz Broadcom BCM2837 64bit CPU
  • 1GB RAM
  • BCM43438 wireless LAN and Bluetooth Low Energy (BLE) on board
  • 100 Base Ethernet
  • 40-pin extended GPIO
  • 4 USB 2 ports
  • 4 Pole stereo output and composite video port
  • Full size HDMI
  • CSI camera port for connecting a Raspberry Pi camera
  • DSI display port for connecting a Raspberry Pi touchscreen display
  • Micro SD port for loading your operating system and storing data
  • Upgraded switched Micro USB power source up to 2.5A

Raspberry Pi 3 Model B+


There are  lot of version of Operating system available to install in Pi, however we will use NOOBS (New Out Of Box Software). There are 2 ways NOOBS can be installed & we will go through them step by step.

You do have Raspberry Pi , What else you need to start the installation?

  1. A Micro USB Power supply 
  2. Micro SD Card ( Recommended 8 GB)
  3. TV or Computer Monitor
  4. HDMI cable
  5. Ethernet Cable ( If don't have wireless)

Setting up the Memory Card

  • Download the Operating system (NOOBS)

First step is to download NOOBS & have it ready in your PC.

Go to https://www.raspberrypi.org/downloads & you will be able to see multiple version of Operating system listed in the page.

We will be using NOOBS for installation, click on NOOBS. In the next page you will have 2 options NOOBS & NOOBS LITE.

NOOBS is an easy operating system installer which contains Raspbian and LibreELEC. It also provides a selection of alternative operating systems which are then downloaded from the internet and installed.

NOOBS Lite contains the same operating system installer without Raspbian pre-loaded. It provides the same operating system selection menu allowing Raspbian and other images to be downloaded and installed

NOOBS

Click on download zip for NOOBS & NOOBS LITE. we will use both in this post however to install you don't need to download both. You can download only one of the OS & can follow the procedure respective to it.

Once you downloaded the zip file, Right click & extract to the folder.

NOOBS will have files listed as below in the folder.

NOOBS

For NOOBS Lite

NOOBS LITE

  • Format the SD Card

Before we copy the NOOBS to the SD card , it has to be formatted. Use the software SD Memory Card formatter to do the same. Download the Card Formatter from https://www.sdcard.org/downloads/formatter_4/index.html & install it on your PC. When you go to the download page , you can select download respective to your PC operating system, & then click on Agree in license agreement.

Go the downloaded folder & run the SDcardformatterXXXsetup.exe . Once the installation is completed you will be able to select the drive from the drop down to the SD Card drive letter. Make sure you are selecting the right drive letter when formatting. Use SD Card reader to insert Micro SD card & connect to the PC. Once you selected the drive letter correctly, click on format. We are ready now to copy the NOOBS to the SD card once the formatting is completed & start the OS installation.

SD Card Formatter

  • Copy the NOOBS file to SD Card

Now open the windows explorer copy the files from NOOBS or NOOBS LITE folder & paste the files in to the SD card. Once the files are copied eject the SD Card from PC.

NOOBS Copying

  • Insert the SD card with NOOBS copied in to the Raspberry Pi
  • Connect the  keyboard, Mouse & TV with HDMI cable to the Pi, connect the Pi to the powercable & power on the device. if you dont have wireless connection, connect the Pi to Ethernet cable from your internet modem or router.

Once you power on the Pi, you will be getting the LED light flashing & the screen on the monitor will be displaying booting screen. Since this is the first time you are booting the Pi with SD card, you will be prompted to select the OS to install. Select Raspbian (Recommended) & click on Install button on top , click on yes on the warning message.Wait till the installation is completed.

NOOBS boot Up screen

Installation Screen

Once the installation is completed click on OK.

You will be taken in to the next screen where you need to reset the password for Pi, by default all raspberry comes with host name as Pi & password as raspberry. For security reason you need to modify the password which is recommended. Once you have changed the password ( Make sure you note this down some where) , you will be given option to select location, keyboard settings & connect to WiFi. Connect to the WiFi entering the password for your WiFi, Raspberry will look for the updates & will start downloading the updates from internet. This may take some time depending upon your internet speed. Once the download & installation of updates completed, click on reboot prompt & the Raspberry pi will be booted in to the desktop.

Pi Desktop

Wow!. its great, you have installed OS & your PI is ready now. You can check the Python installed in the PI by clicking on the Button on top left corner & going to the applications. We will be using python programs to run our projects. Wish you all the best to start your IoT projects. Will meet in next posts.