Wednesday, 15 October 2014

My Raspi Journey 1 - remotely connect to a Raspberry Pi

Like many others I was excited when the Raspberry Pi was released a couple of years ago. Like many others my Pi sat in a cupboard for months gathering dust.



I think part of the problem is that which ever way you cut it, computer programming is tricky to get your head round and even with the very accessible Raspi the practical uses in a classroom environment are limited unless you want to get technical. So, I started a little journal showing what I did with my Pi from day one. I'm going to post some of these steps and lessons learned here over the next few weeks.

I'm going to assume you've done the basics and bought a raspberry pi, downloaded the image and have booted it up (instructions here, so I won't repeat it)

Remotely Log in to your Pi:




Remotely Log in to your Pi:

Sometimes you may wish to work on your Pi without connecting it to a TV or monitor. Or maybe you want to access your Pi remotely if it is being used as part of a robot assembly or similar.
I had the best sucess by following the instructions at Simplesi.net but I've repeated them here. This will install x11vnc onto your raspberry pi and will run the program automatically on boot, so after installing x11vnc you should be able to boot your Pi up without connecting a keyboard or monitor.

First, you need to install x11vnc onto your Raspberry Pi: To install, run LX Terminal and copy and paste the following code:wget http://goo.gl/MbfUEp -O isx11.sh and then press enter to download the installer. Once it has finished downloading, type the following and follow the instructions:

sudo bash isx11.sh

At the end, you need to reboot your Pi. Next, you need to install a VNC program on another computer (I use TightVNC myself) to connect and control and view your Pi. You will also need to know the IP or mac address of your raspberry pi to connect the VNC. I used nmap to find this out. With your Pi connected to your home network (either wireless or LAN) run the nmap program. Trevor Appleton explains exactly what to do next on his blog:

http://trevorappleton.blogspot.co.uk/2013/03/remotely-find-raspberry-pi-ip-address.html

Open up nmap on your computer
  1. In the Target box type: 192.168.1.0/24
  2. Select Profile: Ping scan
  3. Click on: Scan
(If you're on a private network, simply substitute the 192.168 for your own domain IP for example 172.16.x.x)
You should see a list of all devices connected to your network. My Pi showed up as a device called "Nisca" and as well as getting the IP address it's worth noting the MAC address. The IP address is not always constant and may change but the MAC address is unique to individual devices. This may come in handy if you have more than one Pi connected on a school network say.

Once you've identified your Pi's IP address you can enter those details into your VNC program along with any password you've entered for the connection. You should now be able to view your Pi's screen on another computer for configuration purposes. One issue I've had so far using this method is that Java screens running on the Pi show up blank on the computer screen, for example running Minecraft. This is a common problem at the time of writing with no easy fix. Scratch works fine though, as does viewing the Terminal window.

No comments:

Post a Comment