The technology blog of Neil Thompson

All articles to date have been about getting the GPS working with the Raspberry Pi and converting the original Python code to PHP. All of this works well (for me) but what if you want to make changes to the settings or download the log file while you are out and about and away from your home network?

Normally what happens is that you configure your device to connect to a known network but as you are going to be using the GPS/Pi combination away from known networks you need a way to access anywhere without having to connect a screen and keyboard to the Pi. To do this you need to configure peer-to-peer networking. What this means is that you are creating a machine to machine connection without the router that would traditionally be required. This allows you to connect in any way you would over a normal network, so over http or ssh, for example.

To setup peer-to-peer networking you need to be able to connect your Pi to the internet to install the software that you will need. The rest of this post assumes that you have already done this but if not see here to connect a wireless dongle or hook up a USB Ethernet dongle.

NOTE: If you complete these steps your Pi won’t have internet access at the end over wifi. If you want to connect again you will have to change the interface back or connect over ethernet.

Install a DHCP Server

So first we have to install a DHCP server which will be used to allocate an ip address in the same range as the Pi to any device that connects to it. To do this you first need to update apt and then do the install itself:

Once you save the file you should now be able to start the DHCP service successfully:

sudo service isc-dhcp-server start

Change the wifi interface

Now we need to change the interfaces file to give the Pi a static IP address in the same range as the DHCP service is serving:

sudo nano /etc/network/interfaces

If you have already setup wireless networking then you will have already made changes to this file. We are going to replace the contents of this file so it’s a good idea to take a backup first. Then replace the content with the following:

The value you give wireless-essid will be what is shown when you search for the network so you can change it to something more memorable if you wish.

For the changes to take effect you need to restart the network service but the easiest way to achieve this is to restart the Pi itself:

sudo reboot now

Now when you search for wireless networks you should see your Pi network appear similar to as shown below on an iPhone:

You can select and use this exactly as you would any other network so, for example, here I have connected over SSH to my Pi and, if you have installed it, you could also access a web browser.

If you complete all the above you will be able to access your Pi no matter where you are and make changes on the fly without having to change connection details for each wifi network you want to connect to. In a later post I will show how you can use of this alongside the GPS.