Raspberry Pi for Commercial Applications: Configuring Wifi

 

This is the first part in a series for Raspberry Pi enthusiasts. As an enthusiast myself, one of my biggest struggles with these Pi projects is getting them deployed and off my workbench. But concerns like these hold me back from deployment:

  • How will the user change Wi-Fi settings?
  • Can I legally use the Raspberry Pi in commercial applications?
  • Should the bootup terminal be visible?
  • How will the user safely shut down the Pi?
  • What happens when the SD card inevitably fails?
  • Can I teach the user to troubleshoot issues on their own?
  • How do I make sure the user won’t need to use a terminal or SSH?

These and others are real concerns for Raspberry Pi projects built for commercial applications. So I’ve taken the time to compile a list of resources to answer some of these questions for other enthusiasts looking to use the Raspberry Pi for something beyond hobby.

In this first part, I will explore a few ways to give the end user tools to configure wireless access for their Pi.

 

Wi-Fi Settings

Wi Fi iconThis is one of the more challenging dilemmas: how do you give your end user the ability to set up Wi-Fi credentials on their new Pi-powered device? You can’t expect them to pull out a keyboard, log in to the terminal, and update wpa_supplicant. Before your project is commercial ready, you need a more elegant solution. There are many ways I’ve thought about solving this, and some need much more investigation than others.

Behave as a Wireless Access Point (ad hoc) Until Configured

In this scenario, when the Raspberry Pi first boots, it would look for a Wi-Fi connection that it can connect to; if it cannot, it turns into a Wi-Fi access point using an ad hoc network. The user would then connect the ad hoc network, open their web browser to a local IP (like 192.168.0.1), and be presented with a webpage for the user to enter Wi-Fi credentials.

I have got this setup somewhat working on my own but had some trouble reliably switching the Pi between an ad hoc network and normal mode. Here are a few resources for looking into this method further:

Use Bluetooth to Configure Wi-Fi Credentials

In this scenario, when the user powers up their Pi device, they would also be instructed to open an app on their smartphone that communicates with the Pi via Bluetooth; this will give the user a prompt in the mobile app to enter Wi-Fi credentials for the Pi.

Here are some resources to help with this method:

Configure Wi-Fi via SD Card or USB Flash Drive

If you know your end users can handle some slightly technical instructions, you can configure the Pi to look for Wi-Fi settings on the boot partition of the SD card or in a file on a removable USB flash drive. This isn’t very elegant solution, but it is very simple to set up and doesn’t ask too much of the user.

Pi as Private Hotspot

If you have many Raspberry Pi devices in your deployed project, it may be a good idea to have one act as a hub to which all other Pis connect. To do this, you will still need to get internet access for the hub Pi (maybe through Ethernet?). The benefit of this method is that all the Pis can have a preconfigured SSID and passphrase so they can connect through a traditional wpa_supplicant setup method.

Here are a few resources to help with this:

Wi-Fi Configured Over USB (Pi as USB Device)

In this scenario, the user would plug their Pi-powered device into their computer via USB, potentially install a software tool, and then interface with the Pi to configure its settings. This method is quick for end users if done properly. The challenge with this method is: what kind of USB device should the Pi be recognized as?

Ideally, you want a natively supported device that doesn’t need a custom driver. One that comes to mind is a mass storage device. With this method, you would give the user access to a single file containing Wi-Fi credentials (similar to the setup above). You can learn more about this method on Adafruit’s post about configuring the “USB Gadget” for the Pi.

Coming Up Next

I have only scratched the surface of these methods for configuring Wi-Fi for end users on the Pi. As I explore these methods more, I may write tutorials for each of these and publish code.

There are still more topics to cover for configuring your Pi for commercial use, such as Licensing, Software Updates, Powering your Pi, and more! Stay tuned for future articles as I address these and other topics.