Wifi my Pi

No Comments

Over the week I’m working on two current areas of practical research for Mineblock. The first has to do with one of the biggest gotchas of working with networked devices, particularly ones with no screen: getting it on the network and talking to it. The second is about installation and interaction: choosing the level of flexibility. This post is about the work on networking. I’ll write up the rest soon.

The problem with setup/connecting to wifi

For Raspberry Pis in general, people generally use them either with a screen and keyboard, getting networking information using the screen, or else headlessly, i.e. without a screen. This is where the problem comes. Moving the devices between networks means that you need to get them on the network to talk to them and for them to talk to the outside world, without being able to see the usual information on a screen.

For example,  I was able to get a Raspberry Pi (RPi) connected at my home office months ago but bringing it over to the Centre For Digital Media felt like starting from scratch. It had its home network programmed into it (using wpa supplicant, a linux networking tool that allows you to plug in and use wifi devices and specific which networks with passwords that they should attempt to connect to in a textfile.)

When moving it off a network it knows about, you’ll have to do one of two things in order to connect it up:

  • connect the RPi to a screen via its HDMI port and use a keyboard to enter the network information
  • connect it up to your own computer via an ethernet connection and share your network with it and then connect to it over ssh to use wpa supplicant or similar to get it on a network

The first of these may not be very convenient, because smallish HDMI screens may not be available. Modern TVs usually have HDMI sockets, but not all monitors do, and in any case you don’t necessarily want to carry one around with you. The second approach is feasible with Mac OS X (though not when the wifi network is certificate-protected), and it’s not for everyone.

Once you have managed to tell the device how to get on to a network, you then may need to connect to it the next time you want to talk to it. For a developer working on a RPi, typically you’ll want to try something out and reboot it.

If you are sharing your network with it, you can do this again, either finding the IP address via the console or nmap and sshing to it that way, or by installing Avahi on it and thereby giving it a known name so you can connect to it on the same network (e.g. ‘mineblock.local’). (Typically anything giving out IP addresses using DHCP will tend to give out the same one to the same device, but you can’t rely on that).

If you have not installed Avahi on it, or if you are on a different network, you will need to find its IP address somehow. Again, you will need to either connect it up to a monitor and keyboard to see its IP (‘ifconfig’), or use nmap or Mac OS X console if you’re on the same network / sharing; or use some sort of display connected to the GPIO. Or you could make it say its IP address using Espeak, which is easy to do but is often hard to hear and difficult to remember the IP address by just hearing it.

Reconnecting and developing

For Mineblock ease of use is of utmost importance, the target audience being busy non-techie parents. I am working to make it easy for others who don’t have huge amounts of time or great skills in networking on linux-like systems to get started. None of the current solutions are very easy. It’s a substantial hurdle to getting things working for people.

People will have two distinct problems to contend with:

  • telling the device about the network
  • talking to the device on the network

The two problems have parallels in the consumer area too. Printers, networked web cameras and other consumer devices have this problem: they need to get on the network (perhaps with no easy user input device or feedback device) and other devices need to talk to them once they are on there. It’s obviously something that many Raspberry Pi and Arduino developers have thought about. Now that products like Nest have made network configuration seem so easy it has raised the bar for all networked objects.

A possible solution

For now and to solve the immediate problem, I’ve decided to take a similar approach to BBC’s Radiodan project that I saw at the Solid conference a few weeks ago. If the Mineblock doesn’t find a wifi network it knows about, it broadcasts its own wifi network with a known name and uses Avahi to enable the consumer to connect to it at a known identifier via ssh. The consumer can then ssh in and add wifi networks using wpa supplicant. In the future I plan to make it more easily configurable over a web interface, but for now, this greatly simplifies the issues of having connecting to it on various networks.

Previous Post
Next Post
Connecting directly to RPi

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.

This site uses Akismet to reduce spam. Learn how your comment data is processed.