Configuring A Raspberry Pi as a WiFi Hotspot and WiFi client
In episode 308 of the MobileViews podcast Jon Westfall talked about a blog post describing how to configure a Raspberry Pi 4 as a USB-C accessory for the iPad Pro. The instructions configure the Pi so that you connect an iPad to the Pi using a USB-C cable. A video is also available that provides step-by-step instructions, and you can also watch another video in which the author answers questions that were left in the comments of the original video.
While I found the concept intriguing there is no way I could implement it because it only works if you have the latest iPad Pro that has a USB-C port, which I do not have.
Later I found another video done by the author of the original one showing how to install an application called RaspAP and configure it to be a WiFi hotspot AND a WiFi client at the same time. With this configuration you can connect any iPad, or any other device that has WiFi and then you can SSH in to the Pi from the iPad to have access to a Linux command prompt, from which you could run a number of different applications, programming environments, and utilities.
It’s actually not too difficult to configure a Raspberry Pi as a WiFi hotspot (access point) and I actually had done so to a small Raspberry Pi Zero W that I have been using as a portable backup for a wiki I maintain of home information. The problem with how I have been using the Pi Zero is that it can only be either a WiFi access point OR a WiFi client, so when configured as an access point the Pi Zero can’t connect to my home network or the Internet.
What makes RaspAP better is that it configures a Raspberry Pi so that it can be an access point AND WiFi client at the same time using the same wlan port! I am not sure how this is done because as you may know a “normal” WiFi access point must have a second wired Ethernet connection to connect to a cable modem and provide Internet access, in such instances the access point routes (or bridges) network traffic between two networks (different IP addressing), one being the WiFi network and the other being the wired network, each requiring one port.
The installation of RaspAP does require connecting the Raspberry Pi to a wired network connection because there is a step that requires resetting the wlan0 interface that will hang if the port is in use. However, after installation, the Pi will connect to your home network and act as an access point for another network at the same time.
Along the way I also found out that I can power the Raspberry Pi 3b+ using the Ravpower (Model RP-PB043) portable battery that I own, which means that I have a portable, wireless network between an iPad and and a Linux computer that will work anywhere.
How might I use this set up?
Let’s say I am working on a Nodejs program. I can have Nodejs installed on the Raspberry Pi and I can have all my code also on that Pi, perhaps cloned from a git repo. Let’s say I plan to be on a long flight and I want to carry a minimal amount of gear. I can pack my iPad Pro, Raspberry Pi, and the Ravpower in my carry on and when I am able, power up the Pi, leave it in the carry on, and connect to it via WiFi from the iPad. At this point I can then SSH into the Pi and use a text editor (emacs, nano, etc..) to work on my code and test it using nodejs. Of course, you can do this for any other programming environments or compilers that install on the Raspberry Pi and run via the command prompt. (Actually.. one should also be able to VNC into the graphical Raspbarian environment if you need to.)
While I could do the above via the airplane WiFi, doing so costs money and service can be spotty, this network connectivity once configured is available nearly the same way all the time. The “remote programmer” scenario is just one idea off the top of my head, I am sure there are other uses cases for a configuration such as this. The developer of RaspAP is working to include OpenVPN to make the Pi a VPN endpoint that will provide all secured network communication for all devices that connect to it. You can find more examples for using RaspAP in this Github repo.