Access Pi Remotely | Outlaw Robotics

Access Pi Remotely

One of the first things you need to do once you have your raspberry pi up and running is to access it from a remote computer. Being able to do this saves having to connect up a monitor, keyboard and mouse directly to the unit.

Although this is not a problem in the early days of robot design, it can become a pain when your pi has several breakout boards on it and embedded deep inside your creation.

There are many different OSs that the Pi can use but in this tutorial we will be modifying Raspbian. We are also going to skip the part were you use putty to command access your pi and go for the GUI interface. Although the putty option is good, if you are still finding your feet, it’s nice to get the familiar GUI to work with. Over a local network connection it is also fast.

This first part will deal with accessing your Pi when it is on the same local network as your computer. The second part will deal with accessing your Pi from anywhere in the world.

 

Step one: Find your IP address

The IP address is needed to find your Pi on the network. There are several ways to do this.

The first is to connect your pi to a monitor, keyboard and mouse and find it out through opening a terminal window and typing in hostname -I  This will display your Pi’s IP address.

The second way involves not having to use the display at all. If you log into your router, you will be able to see a list of what IP address your raspberry pi is currently using.

The third and personally preferred  way is to use a program like nmap. This allows you to see all the devices that are connected to your network. From this we will be able to see what address our Pi is at and also its a nice tool to see who or what is connected to your network to make sure no one is piggy backing off your internet or trying to hack your network.

There are Windows, Mac and Linux of nmap. The first thing you need to know is what the IP address is of the computer you’re using. On Windows I usually go to the start, type in cmd for command and then in the terminal type in ipconfig. However, unless you are using a business network or a custom network, the most common IP address will be 192.168.0.XX or 192.168.1.XX. With that in mind, in nmap either enter:

nmap -sn 192.168.0.0/24

or

nmap -sn 192.168.1.0/24

The 0/24 at the end of the ip address covers the complete range for for 192.168.1.0/24 covers  from 192.168.1.0 to 192.168.1.255.

If you are using nmap GUI then in the Target box enter 192.168.0.0/24 or 192.168.1.0/24 and in the profile enter ping scan. You will see that in the command line box it will create the nmap -sn 192.168.etc.

From this you will get a list of all the devices connected to your network. The IP address we want is for the device with the hostname raspberrypi

 

Step two: Connecting to your Pi on a local network

Next we need to activate the VNC server on the pi. There are two ways to do this. The first is from the desktop. You  can do so by going to Menu > Preferences > Raspberry Pi Configuration > Interfaces and making sure that VNC is enabled.

The other method is by the command line. Do this by going to

sudo raspi-config

navigate to interface options

scroll down and select VNC>Yes

Now on the device you want to see your raspberry pi on you will need to download VNC Viewer. The Raspberry Pi website recommends using RealVNC. There are other VNC viewers available but this one does offer quite a wide array of applications for various devices including Apple and Android devices.

Now it is just a case of opening up the program and typing in your Pi’s IP address. You should now see your Raspbian desktop and be able to interact with it using your device.