Getting started with RaspberryPi without Screen

Getting started with RaspberryPi without Screen

  • 2016-09-07
  • 1627

We will talk about how to get started with RaspberryPi. How to  install the Raspbian Jessie on it, and how to configure it so that you would not need any screen to communicate with it !

So the per-requisites would be  :

  • Raspberry Pi 3
  • SD card (8GB+)
  • Power Source ( Mobile charger : I am using  5.0V -2.0 A )

So it looks like in upcoming blogs we would be working on these:

So now we would be going to install the Raspian Jessie on it and configure it so that we can use it without any additional Screen !

So we are going to follow the following steps:

Getting the Raspian Image and writing it on SD Card:

  1. Get the Raspian image from the official Raspberry Pi website.

  2. Write the image to the SD card using the instructions for your laptop OS (this takes some time) Note that you cannot just copy the .img file to the SD card, you need to use the instructions below:

    Eject the SD card from your laptop and insert into the Raspberry Pi SD slot.
    There is also one more resource for the instruction of setting up the SD Card you can find it here.

Setting up the Wifi Connection Settings:

After the image has been written on the disk we are going to make some changes to some configuration file , hence please do not remove the SD card yet.

  1. Now comes the important part , setting up the Wifi-connection so that you would not need any screen to login to the RaspberryPi.
    Hence please do not remove the SD Card from your card Reader
    So for this we are going to edit the wpa_supplicant.conf present on your SD card with the following path.
Path: ${path_to_SD_Card}/etc/wpa_supplicant/wpa_supplicant.conf
  1. In this Configuration file we will provide the settings of your network  for your Raspi3 so that it may connect to your wifi. So you have to provide the following details and your configuration file should look like this

    wpa

    Note: Here I have defined for the multiple networks for a single network you can do this by Adding just the following line at the end , and also open the file using the following command from your terminal:

nano ${path_to_SD_Card}/etc/wpa_supplicant/wpa_supplicant.conf

And now add the following configuration:

    network={
        ssid="your-network-ssid-name" //in my case it was dungeon_masster 
        psk="your-network-password" //in my case it was brokenwings 
        id="name"//this is optional but is required for multiple configur-
    ation
    }

Exit the terminal using “Ctrl+X” then “Y” and then “Enter”

Note: I am providing instructions for RaspberryPi3 as it has in-built wifi, this may be different on other version of Raspian and for any other model which does not have any built-in wifi

Now you are good to go for booting up your Pi.

Booting up the Raspberry Pi :

Connect the power supply to the Raspberry Pi, you will see the RED Light on and after two or three seconds  the Green light starts blinking , it means it has booted up.

Finding your RasberryPi’s IP address for ssh access:

Finding your RaspberryPi IP address can be as troublesome as finding a small bug in your Javascript Code.😛 and sometimes can be as easy as just finding bug in your Scala Code.😀

Method 1 : You can look for your Pi’s address in the Active Client Table of your network if you have the admin access.

Client Table

Method 2: This comes in handy when you do not have the admin access to the network then nmap comes to save us

**Nmap **(Network Mapper) is a security scanner. It is used to discover hosts and services on a computer network.

Find your IP using ifconfig:


ifconfig

wlan.png

Use the following command on your terminal to :

sudo nmap -sN 192.168.0.0/24

**Note:**Use your Ip in the nmap by replacing the last number by 0 and then /24 for scanning all network
This will result in the following to show your Pi’s address

MAC Address: B8:27:AS:LL:AH:UU (Raspberry Pi Foundation)
Nmap scan report for 192.168.0.5

Now we have got the IP address now its the time to login to the Raspi.

Logging in to the RaspberryPi:

Use the following command to login to the raspi

ssh [email protected]

By default :

Username: pi
Password:raspberry

Now You have logged in ! Now starts the process of setting up the Raspi.

Configuring Raspberry Pi:

Update the configuration on the Raspberry Pi.

  1. In a terminal window enter the following command
sudo raspi-config

You should now see the configuration tool:

rsapicon

To use the tool select from the main menu using the arrow keys then hit tab to jump to the select button. The space bar or enter key accepts the current selected action (Select or Finish). When an action has been performed use tab key to jump back to the list to select another option.

The following steps need to be taken in the configuration tool:

1: Expand Filesystem

2: Change User Password (default user is pi with default password raspberry)

5: Internationalisation Options (set the Locale/Timezone and Keyboard layout for your location. If using WiFi set your country to ensure correct use of WiFi frequencies)

9: Advanced Options:

A2-Hostname (give your pi a unique name)

A7-I2C (specify to load module as default)

Finish (select to reboot)

Your Raspberry Pi will reboot after finishing the configuration. If using a remote connection you will need to wait for the Raspberry Pi to reboot then reconnect (you should get the same IP address, if not use the hostname -I command to discover the new IP address assigned to your Pi.

Updating the firmware and Raspbian OS

Update all packages that have been updated since the Raspbian image was created.

Enter the following commands in a terminal window:

sudo rpi-update
sudo reboot -n

after the last command the Raspberry Pi will reboot. If using a remote terminal reconnect when the Raspberry Pi reboots. To update the raspbian OS enter the following commands:

sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y autoremove

Using the Pi’s Desktop: setting up VNC server

VNC is a service that allows the Graphical User Interface of the Raspberry Pi to be access remotely using a VNC client. 1. Install the VNC server using the following command:

sudo apt-get install -y tightvncserver autocutsel
  1. Run VNC server and follow the prompts to set an access password. You don’t need a view-only password unless you want to set one:
vncserver
  1. Enter the following to setup VNC to run at system startup:
cat >vncserver@.service <<EOF
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target

[Service]
Type=forking
User=pi
PAMName=login
PIDFile=/home/pi/.vnc/%H:%i.pid
ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 :%i
ExecStop=/usr/bin/vncserver -kill :%i

[Install]
WantedBy=multi-user.target
EOF
cat >/home/pi/.vnc/xstartup <<EOF
#!/bin/sh

xrdb $HOME/.Xresources
xsetroot -solid grey
autocutsel -fork
#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
# Fix to make GNOME work
export XKL_XMODMAP_DISABLE=1
/etc/X11/Xsession
EOF
sudo mv vncserver@.service /etc/systemd/system/
sudo chown root:root /etc/systemd/system/vncserver@.service
sudo systemctl daemon-reload && sudo systemctl enable [email protected]

To access the Raspberry Pi you will need a VNC client installed. There are a number of VNC Clients available. The Raspberry Pi web site includes instructions on how to set up and use RealVNC:

Accessing RaspberryPi’s Desktop without external Screen :

Finally you can access your Pi’s Desktop on your Laptop screen:

For this I am using Linux’s Remote Desktop Viewer:

So connect your Pi like this :

RDM

And here it comes what we waited for:

THE PI’s DESKTOP:

pides

Hurray !
Your Raspberry Pi has set up successfully !

In the Upcoming blog we will talk about setting up the scala environment on RasberryPi, till then play around with it ! Try to explore ! And let me know if you find anything interesting ! All comments are welcomed !

Suggest

Raspberry Pi 3 Day Project: Retro Gaming Suite

Advanced Home Automation using Raspberry Pi 3

IoT enabled Aeroponics using Raspberry Pi 3

Raspberry Pi: Full Stack

Hands on Internet of Things: Get started with a Raspberry Pi