Sometimes, open source software doesn’t work. It works great initially for an application or platform, but with dependency module upgrades and new Linux versions, issues occasionally arise. The great news is that since it is open source, we have the opportunity to fix the issues and build on what was released. This happened to me while researching a way to add a WiFi connection update method to Raspberry Pi projects like the Espresso Connect. The goal is to allow an easy update to the WiFi connection of projects when the WiFi connection is changed. This blog described an easy and robust methodology for the Raspberry Pi Zero. At startup, if a WiFi connection is not detected, the Raspberry Pi will become its own WiFi access point and webserver. From a smart phone or labtop, a user can log onto the access point, which brings up a portal webpage that lists all the visible local WiFi networks. The user can pick the appropriate WiFi network and password for the local connection and press connect. The Raspberry Pi will then attempt to log onto the new network and all is well. If it is not successful, then it will become an access point again allowing another iteration attempt. The github repository wifi-connect-headless-rpi shows the code and provides an easy installation script that can also work with a WiFi connected headless Raspberry Pi. Of course it is open source and a step by step guide is given below.

Standing On a Firm Foundation

This WiFi connection methodology is based on open source projects that provide a firm foundation of work. The great work by Balena’s Wifi-Connect shows a project that worked on an earlier version of the the Raspberry Pi OS system and was written in Rust. I used this code in my Easy IoT Fleet Deployment of ETA Nixie Tube Clocks blog with the BalenaOS version of Linux. It still works with BalenaOS and containers, but has issues with the latest Raspberry Pi OS. To fix the OS issues, OpenAgricultureFoundation based its work also on the Balena project, but nicely rewrote the code in python. Since some time has passed and newer versions of the the Network Manager module and Raspberry Pi OS have come out, it also has issues. In this blog, the OpenAgricultureFoundation python-wifi-project project was forked and workarounds to the issues were found. The result is a version that works with the latest Network manager (version 2.2 as of the blog post) and the Raspberry Pi OS (Debian based 11 bullseye). In addition, a new installation method was written that allows installation using a remote ssh connection (i.e. headless). I expect that eventually both Balena and OpenAgricultureFoundation will update their projects giving the reader even more options to choose from.

Easy Installation over WiFi

Most of my Raspberry Pi projects don’t include a keyboard and mouse, so a new installation script was written to also allow installation over a Raspberry Pi Headless WiFi connection. The result is a quick and easy method to install this WiFi connection method to any Raspberry Pi project.

Creating a headless Raspberry Pi SD image

The steps below assume you have a Raspberry Pi project and are remotely connected over ssh. There are several ways to create this, but I found the Raspberry Pi Imager to be the easiest.

Creating a Headless Raspberry Pi SD image and network setup

Step by Step

Quick and Easy Installations with a headless Raspberry Pi Project

Log into the Raspberry Pi from an ssh connection. The command below assumes the raspberry pi name is headlesswifi. Use the name you used during the SD card imaging.

ssh pi@headlesswifi.local

Update the system

sudo apt-get update

Install Git. The default Raspberry Pi OS does not have git installed.

sudo apt-get install git

Clone the github repository

git clone 

Change to the scripts directory

cd wifi-connect-headless-rpi/scripts

Run the Rpi Headless Script

sudo ./

Reboot the system

sudo reboot

Find and connect to the Rpi-[hostname] access point from your smart phone or laptop, where hostname is the name of the Raspberry Pi.

If a browser does not open automatically, then open a web browser and go to address Choose the correct WiFi network and input the correct password then hit the Connect button.

Wait a couple of minutes and re-log into the raspberry pi from an ssh connection

ssh pi@headlesswifi.local

When you log in, then you know the wifi-connect-headless-rpi system is working


Please subscribe

Please subscribe and let me know your comments. Better yet, let me know what other projects you need. Have a great day. The surf was great two weeks ago, but I’m missing it this week.