Use when: Setting up a self-contained control system so irrigation, lighting, and automation continue to operate without relying on external Wi-Fi or internet. This is also used when preparing the system for handover, allowing a new occupant to immediately connect via tablet or laptop and operate or modify the setup without any network configuration.
sudo apt update
sudo apt install hostapd dnsmasq -y
sudo systemctl stop hostapd
sudo systemctl stop dnsmasqsudo cp /etc/dhcpcd.conf /etc/dhcpcd.conf.backup
if [ -f /etc/dnsmasq.conf ]; then
sudo cp /etc/dnsmasq.conf /etc/dnsmasq.conf.backup
fiEdit:
sudo nano /etc/dhcpcd.confAdd to the end of the file:
interface wlan0
static ip_address=192.168.4.1/24
nohook wpa_supplicant
Backup the default file:
sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.origCreate a new configuration:
sudo nano /etc/dnsmasq.confContents:
interface=wlan0
dhcp-range=192.168.4.2,192.168.4.50,255.255.255.0,24h
Create:
sudo nano /etc/hostapd/hostapd.confContents:
interface=wlan0
driver=nl80211
ssid=BackyardPi
hw_mode=g
channel=6
wmm_enabled=0
auth_algs=1
wpa=2
wpa_passphrase=[REPLACE_WITH_PASSWORD]
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
Edit:
sudo nano /etc/default/hostapdSet:
DAEMON_CONF="/etc/hostapd/hostapd.conf"
sudo systemctl unmask hostapd
sudo systemctl enable hostapd
sudo systemctl enable dnsmasqsudo rebootUse when: After setup or changes, to verify devices can connect reliably, Backyard Pi is accessible, IP assignment is correct, and the system recovers properly after reboot or power loss.
Connect a laptop, phone or tablet to:
SSID: BackyardPi
Password: <your password>
The connected device should receive an address in the range:
192.168.4.2 - 192.168.4.50
Open:
http://192.168.4.1:1880
If using the Node-REd Dashboard:
http://192.168.4.1:1880/ui
ssh pi@192.168.4.1- Power off the Pi.
- Wait 10 seconds.
- Power it back on.
Confirm:
- Hotspot appears automatically.
- Devices reconnect automatically.
- Node-RED is accessible.
Use when: Moving the system from standalone operation to integration with an existing Wi-Fi network, typically when a new owner wants broader network access, remote control, or integration with their own infrastructure.
Connect your laptop to:
SSID: BackyardPi
SSH into the Pi:
ssh pi@192.168.4.1Edit:
sudo nano /etc/dhcpcd.confRemove:
interface wlan0
static ip_address=192.168.4.1/24
nohook wpa_supplicant
Alternatively restore the backup:
sudo cp /etc/dhcpcd.conf.backup /etc/dhcpcd.confsudo rm -f /etc/dnsmasq.conf
if [ -f /etc/dnsmasq.conf.orig ]; then
sudo mv /etc/dnsmasq.conf.orig /etc/dnsmasq.conf
fiRun:
sudo raspi-configNavigate to:
System Options
→ Wireless LAN
Enter:
- New SSID
- New Password
Do not stop the services, as this will disconnect your current session.
Instead disable them so they do not start after the reboot:
sudo systemctl disable hostapd
sudo systemctl disable dnsmasqsudo rebootThe hotspot will remain active until the Pi reboots.
After reboot:
- The hotspot will no longer be available.
- The Pi will connect to the configured Wi-Fi network.
- Connect your laptop to the same Wi-Fi network.
- Access the Pi using its new IP address.
Check your router's DHCP client list and locate the Raspberry Pi.
Connect using:
ssh pi@<pi-ip-address>Or access Node-RED:
http://<pi-ip-address>:1880
Use when: Updating Wi-Fi credentials after router changes or network updates while keeping all system services running without interruption.
sudo raspi-configNavigate to:
System Options
→ Wireless LAN
Enter:
- New SSID
- New Password
sudo rebootCheck the router's DHCP client list and locate the Raspberry Pi.
Confirm Node-RED is available:
http://<pi-ip-address>:1880