Accessing Raspberry Pi 2 using laptop/desktop display and keyboard

There is a lot of buzz regarding IoT (Internet of Things). So we have got our own Raspberry Pi 2 devise to experiment with it. Though we are building something serious, but here is something for starters to access Raspberry Pi 2 using networking.

This tutorial will enable one to access Raspberry Pi 2 using networking.

IoT

Things Needed

1.) Raspberry Pi 2

2.) Micro SD Card with RASPBIAN setup

3.) A laptop or a desktop computer

4.) An ethernet cable

5.) A Micro USB power adapter for Raspberry Pi device

6.) A router (Optional)

Setting up IP for Raspberry Pi (Skip to step 2 if router is available)

If you do not have router setup then it has to be P2P setup. To do this we need to make sure that our raspberry device has an ip address. To set up ip address, follow instruction as below

1.) Remove Micro SD card (make sure raspberry device is powered off)

2.) Put Micro SD card into Card reader and connect to computer

3.) locate cmdline.txt

4.) Take backup by copying it to cmdline.txt.bak

5.) Open cmdline.txt and add ip=169.254.0.2 to last of the line. Make sure that you don not create a new line. The address can be anything in between 169.254.0.0 to 169.254.0.254, take a note of it in case you changed it.

6.) Save and safely remove the card

The Setup

Now we need to setup networking between laptop/desktop and raspberry pi device.

1.) Connect Raspberry Pi device to power source using micro usb power chord

2.) Power on Raspberry Pi

3.) Connect Raspberry Pi to router using standard networking(ethernet) cable or to your laptop/desktop, if you do not have router

Accessing Raspberry Pi device

Here comes the real deal, since we are going to establish ssh connection, the UI would not be available since serial connection does not support graphical program. (but do not worry, that can be achieved using VNC, we will cover that in other blog post)

If you are using router with dynamic IP (DHCP) the browse your roter setup and mak a note of raspberry pi IP, one can look for device named raspberrypi (if RASPBIAN is being used)

1.) Open the terimnal and ssh into device

ssh pi@169.254.0.2

replace 169.254.0.2 with IP router allotted or if IP entered in cmdline.txt

2.) Put in password when prompted

Raspebian have default password set to raspberry

You should see a raspberry pi command prompt

3.) If this is your first time please run system-config to setup stuff like overlocking