Activate an easy Automated WiFi AccessPoint or connect to a local WiFi Network for Raspberry Pi OS Bookworm. The AP is automatically created when you are not in range of a known WiFi network. Useful for both headerless or desktop setups. 

With the Raspberry Pi being so portable it is always useful to have a wifi connection. When the wifi signal has been lost due to a weak signal, it can be a bit of a nightmare trying to get access to the Pi without a screen.

The script in this Article will monitor the wifi connection and make sure you are connected to a known Wifi network when the signal is good or it will create a WiFi access point, so you will always have a wifi connection available.  It will also allow you to flip to an Access Point with a simple command and back to a WiFi network on demand.


The Access Point will allow a direct Wifi connection to the Pi from a Phone, Tablet, Laptop for use with ssh, VNC desktop sharing, a local web server, etc.

Every 2 minutes the AccessPopup script will check the local wifi network signals. If a known one comes back into range, then a connection is made to the wifi network and the Access Point is stopped.

This is useful for Devices that may be running sensors, cameras or other monitoring software in your Garden, Greenhouse, Shed or Garage that may be where the WiFi signal is weak. You will always be able to get a connection over wifi and is ideal for headerless setups. 

This is also useful for any setups where the Pi is required to go in and out of wifi range. 

Compatibility:

Requires any Raspberry Pi computer. Tested with PiOS 12 Bookworm, Ubuntu 23.10 Raspberry Pi Image and Arch Linux Arm for Pi4 32bit.
This will NOT work on PiOS 11 Bullseye or 10 Buster or older as they do not use Network Manager.

A similar script is available for PiOS 11 Bullseye and older called AutoHotspot.
This is available at raspberry-pi-automatic-hotspot-and-static-hotspot-installer

Installation and Use:

Latest versions:
accesspopup 0.8-6 12th Juy 2024
installconfig.sh 0.8-6 12th Mar 2024

Installation:
download the archive file with curl "https://www.raspberryconnect.com/images/scripts/AccessPopup.tar.gz" -o AccessPopup.tar.gzunarchive with tar -xvf ./AccessPopup.tar.gz change to the AccessPopup folder cd AccessPopup Run the Installer script
sudo ./installconfig.sh

The menu options below will be presented. Use option 1 to install the AccessPopup scripts.
This will automatically start monitoring the wifi connection every 2 minutes. It will also check the wifi at startup and then at every 2 minute intervals.

Setting a Constant Access Point:

Sometimes it is useful to be able to use the AccessPoint even though the Pi is in range of a known WiFi network.
This can be done by opening a terminal window and entering the command:
sudo accesspopup -a

to go back to normal use, just run the script without the -a argument.
sudo accesspopup

alternately use option 4 "Live Switch..." on this installer script.

Menu Options:

1 = Install AccessPopup Script
Installs the AccessPopup script and starts the 2 minute checks

2 = Change the Access Points SSID or Password
The access points wifi name (ssid) is AccessPopup and the password is 1234567890.
Use this option to change either or both. At least change the terrible password.

3 = Change the Access Points IP Address
The Access Points IP address is 192.168.50.5. Use this option to choose a new IP address, based on 10.0.#.# or 192.168.#.#

4 = Live Switch between: Network WiFi <> Access Point
Switch on demand. Set the Pi to an Access Point until the next reboot or switch back to a known WiFi Network in range.

5 = Setup a New WiFi Network or change the password to an existing Wifi Network
Scan for local WiFi networks and connect to a new one or change the password to an existing profile.

6 = Change Hostname
Change the system Hostname, so a connection can be made by name instead of an IP address.

7 = Uninstall AccessPopup
Uninstall the AccessPopup script and return the RPi to its default wifi setup.

8 = Run AccessPopup now. It will decide between a suitable WiFi network or AP

9 = Exit

 

Using the Access Point:

When the Access Point has been activated, the SSID AccessPopup will be broadcast. Using a wifi device, scan for new wifi devices in the area, and select AccessPopup.

You will be prompted to enter the password.

If you have not already changed it, the password will be 1234567890. Don't use the password that is used to log into the Raspberry Pi.

The connection to the Access Point will be made.

SSH, VNC, Web Server

Now that a connection to the Access Point has been made, If you are using SSH, VNC or accessing a web server of the RPi then use:

ssh: This email address is being protected from spambots. You need JavaScript enabled to view it..5   so if your user is called  pi, then use ssh This email address is being protected from spambots. You need JavaScript enabled to view it..5

VNC remote desktop: enter the server as 192.168.50.5 

Web server: if there is a web server running on the PI, it can be used by entering http://192.168.50.5/ into a web browser.

The Hostname of the device can also be used in place of the IP address for any of the above options.

 

Using AccessPopup in a terminal window: 

 AccessPopup is set to run automatically every 2 minutes but it can be run manually to switch to the Access Point.

In a terminal window enter: sudo accesspopup -a

The access point will be activated and the timer will be stopped so it doesn't try to connect to a Wifi network again.

To re-connect to a nearby known wifi network, either reboot or run the script without -a

sudo accesspopup

This will attempt to connect to a known local wifi network and re-activate the 2 minute timer.

If a wifi network connection can't be made, it will activate the Access Point again and continue to monitor the connections.

 

Using Network Manager from The Desktop:

Alternately to using the AccesPopup script, the Network Manager interface can be used to make your own Access Point. This will be used if no know wifi network is found when the Pi is started. If a known Wifi Network is then in range, Network Manager will keep the Access Point going until it is manually stopped in the WiFi menu or the Pi rebooted. If this suits your needs and you are always using the desktop environment then the standard setup may be useful. 

To create an Access Point in Network Manager use the "Create Wireles Hotspot" menu option

RPi NetworkManager CreateHotspot
RPi NetworkManager Hotspot Details

As standard Network Manager will use a previously setup Access Point if no known Wifi network is in range. Then when a known Wifi network comes into range you will need to manually stop the Access Point and select the desired Network. 

So the AccessPopup script is not required if you are only using a Desktop environment.

AccessPopup is most useful for setups without a desktop (headerless) or where the wifi signal is inconsistent as the wifi connection will be remade every time it is strong again. 
If you are using the AccessPopup script and Network Manager desktop menu, then AccessPopup will switch from any Access Point back to a known Wifi network every 2 minutes unless the following command is used in a terminal screen window.
sudo accesspopup -a

This will also stop the timer and the script from running.

Using the "Advanced Options" and "Edit Connections" the AccessPoint settings for the profile AccessPopup can be changed, by selcting the profile and then the cog icon.

RPI NetworkManager EditConnectionRPi NetworkManager edit profile

The AccessPopup profile will be removed from the Network Manager menu if option "7 Uninstall" of this script is used. Unless the profile name has been changed.

On re-installing AccessPopup the default options will be setup. Any other AccessPoint that has been setup, will be ignored in favour of the AccessPopup one.

If you find this guide useful and wish to show your appreciation then you are welcome to make a donation or share a link to this article. There is no obligation to do so, this guide is free for use and support is available to everybody as long as I know the answer :)

I am the single developer of this script and website. Any support towards the costs are welcome.

RaspberryConnect.com

 

  

Considerations:

The Access Point disconnects every 2 minutes.

If a WiFi network is setup but the password is not correct, then the connection will fail. Once there is an attempt to connect to a WiFi network, it is added to the list of known networks by Network Manager.
When an Access Point is active, every 2 minutes it will be deactivated to connect to the bad WiFi network when it is in range. This will disrupt any connections to the Access Point.
The Access Point will be re-enabled once the connection to the Wifi network has failed.
If you experience this, then correct the password with option 5 or the Desktop interface. Otherwise delete the bad Wifi network entry.

Ethernet connection to the Pi

If an Ethernet cable is connected to the Pi and the Access Point is available, any device on the Access Point can ssh/vnc/ping etc the other devices also connected to the access point and the network the Ethernet is connected to. This includes the internet, if it is available.
No device on the Ethernet's network can connect ssh/vnc/ping etc to the devices connected to the access point. The Ethernet network can access the Pi, as it is on both networks.

 Using a Second WiFi Device

 When a second Wifi device is setup such as a USB Wifi dongle, no device connected to the access point can ssh/vnc/ping etc the network that the second Wifi device is connected to. Devices connected to the Access Point can only access the internet or other networks through a connected Ethernet cable.
To do this through a second wifi device requires additional configuration.

 Loss of Connection when a Switch Happens

 Any connection to the Rpi from another device will be lost when the RPi switches from a Wifi Network connection to an Access Point and back. 

If you are using ssh then programs such as tmux will keep your session running while you connect back to your RPi on the new wifi connection. 

VNC will reconnect if you are using a Hostname as the server connection. If you have connected with an IP address then you will need the new IP adress from the network you have connected through. 

 


Add comment

Comments  
Raspi turning off AP after using "sudo accesspopup -a"
This is awesome. The AP works nicely, but it appears there's some problem with the timer. I tried activating AP until the next boot both using the "sudo accesspopup -a" and the option 4 from the script, I was able to connect to the AP and access the Raspi through SSH using my tablet. But the connection ended after some time (probably 2 min) and the raspi reconnected to my home wifi.
Am I missing something? I am using a clean bookworm installation, just updated with "full-upgrade" command. No other change to any config.
Again, thanks for the tutorial and the script.
Raspi turning off AP after using "sudo accesspopup -a"
Hi Filipe.
Thank you aim glad you like it.
No you are not missing anything. the -a arg sets up the AP and switches off the timer, so it should not switch back after 2 mins.

You can check if the timer is running with;
sudo systemctl status AccessPopup.timer

You will get a line with the time remaining;
Trigger: Wed 2024-09-18 14:58:00 BST; 1min 25s left
repeat to see its progress.
When sudo accesspopup -a is used you will no longer get the countdown, so you should get
Trigger: n/a

Can you check that the timer is being disabled.
As you have a fresh install there shouldn't be any issues. Though my test system is up to date, I haven't done a fresh install lately. So if you are not getting the situation above then I will test it on a new setup.
AccessPopup issues with configuring Rasp Pi 4B as upper computer
Hello,

I am attempting to set up a Rasp Pi 4B as the 'upper computer' for the Wave Rover following the instructions in the link: https://github.com/waveshareteam/ugv_rpi . The AccessPopup module's README took me to this site. And I followed all the instructions on both websites. I am using a newly flashed card for the Rasp Pi with the 64-bit Bookworm recommended installation.

I am having trouble connecting devices to the AccessPopup network. Initially, using just the instructions present in both documents, and launching the connection with 'sudo accesspopup -a', the Pi disconnects from its current Wifi server, attempts to connect to the AccessPopup server, but after a few seconds it times out and connects back to the original Wifi connection. The error I saw was related to the IP address configuration, and after some advice from ChatGPT, I assigned AccessPopup a static IP with the following commands, "sudo nmcli connection modify AccessPopup ipv4.addresses 192.168.50.5/24
sudo nmcli connection modify AccessPopup ipv4.gateway 192.168.50.5
sudo nmcli connection modify AccessPopup ipv4.method manual". After this, I also configured the hostapd.conf file because I was running into an error saying that that file was missing. After some of these tweaks I was able to get the AccessPopup connection to stay up, but I was never able to connect to it with my phone, as it was always saying "wrong password" even though i was typing in the correct defaults password "1234567890", which I attempted many times.

Please let me know what other configuration is needed, or what else I am missing. Thank you.

Am I on the right path? Do yo
AccessPopup issues with configuring Rasp Pi 4B as upper computer
Hello Varvara

It's good to see how the script is being used, looks like a fun project.

The issue where the access point stops after a few seconds switches back to a nearby network even with the -a switch suggest there is a wider issue. I think this is because hostapd is being used as well. Hostapd is not required and should be disabled with;
sudo systemctl stop hostapd
sudo systemctl disable hostapd

The changes to the ip where not required as they are part of the AccessPopup wifi profile that is created the first time the access point is generated. For future reference the gateway needs to have a different ending number than other ip's used, often it will be .1 or .254.

Firstly I would delete the profile for the access point so the script will create a new one next time it runs.
run; nmcli con show
the output will list all the profiles on your system. AccessPopup should be listed.
Delete this with; nmcli con del AccessPopup
then recheck with; nmcli con show

The script in the link is older so download and install the latest version of the AccessPopup script from this page and follow the instructions.
When you run sudo ./installconfig.sh uninstall your existing setup first with option 7.
Then install the updated script with option 1 and reboot.

Hopefully that will sort the issue. If not let me know what happens and I will look into it further.
Follow up rasp pi upper computer for wave rover
Hello,
Thank you so much for your response. It was super helpful installing the latest version from this page. I was able to get the Wifi server to work by doing just that. Unfortunately, after cloning the Github repos for the car and configuring it (which contains the outdated AccessPopup folder), it is having the same error, even after following your instructions of deleting the profiles, uninstalling existing setup and installing the updated script. I know that this seems to be an issue with the Car repos, and out of the jurisdiction of the AccessPopup package, but do you have any idea what could help? Do you think I should replace the outdated AccessPopup folder from the car repos with the updated folder before configuring it in installconfig.sh? I thought I tried that but it produced the same error. Also is there a difference between configuring that file from the AccessPopup directory in the car software package and the AccessPopup directory that is made from unzipping the new software package from this website? Let me know if you have any suggestions for making this implementation work. Thank you so much for your patience and help.
Follow up rasp pi upper computer for wave rover
Hi Varvara

Thanks for the response, I can't see anything that stands out in the repo the would cause an issue with the accesspopup script.

The installconfig.sh script can be used from anywhere so. It will install the accesspopup script into /usr/bin/ and then sets up a systemd service. So as long as the latest installer script is used, it should work. What seems odd is when the Accesspoint is started with 'sudo access popup -a' it reconnects back to the local network. I only get that if the network manager profile is not correct and the accesspoint can't be created.

Things to check.
Activate the AccessPoint manually and see what happens.
nmcli con up AccessPopup
It should say 'Connection successfully activated' and stay connected. Anything else shows there may be an issue with Network Manager not being able to create an access point.

Check hostapd (if installed) is not active.
sudo systemctl is-enabled hostapd

also check for
sudo systemctl is-enabled dnsmasq
this should either not exist or be disabled.

This bit will have been done on the installation but best to check:
check dnsmasq-base is installed
sudo dpkg -s dnsmasq-base
The first lines should say
"Package: dnsmasq-base
Status: install ok installed"

Is the Wifi device called wlan0
enter: ip a
is there an entry for
"wlan0: " or does the wifi device have a different name?


Try these, let me know what happens and I can see if anything stands out.
Captive Portal
Good day. I've set this up on a pi zero 2 w bookworm and seems to work great! Is there a way to add a captive portal to this? I have a project that i set up on a pi, then want to take it to a friends house and on boot, connect to the pi via wifi, then have a portal open that allows me to search and connect to a nearby network.

Thanks!
Captive Portal
Hi Owen

At the moment you need to connect via ssh/vnc and run the installer script with option 5 to connect to a network. I am working on a new version with additional features that will include a config portal so that it is possible to add a new network via a webpage.

Currently with a VNC connection you can also create create the new connection in the Wifi GUI. That won't cause an issue with the function of the script.

Any webserver that interacts with network manager to setup new connections should also be fine if you need something sooner.
password failure
Hi Henrik

Thank you for the comment, that will be useful. I haven't been able to reproduce this issue previously. I will have another look at it on a Pi Zero W as there is obviously something going on. I will reply to the comment on my findings.

I know what you mean about the comment box, unfortunately that's how the comments module presents it with no options to change it without changing the code.
password failure
Hi Henrik

I have found the cause of the connection issue when a Raspberry Pi Zero is used with Bookworm OS 32bit. It seems just the PiZeroW doesn't like the encryption but the same SD card works on a Pizero2 and Pi3 without an issue.

I will do some further testing before I update the script but if you enter the following command, it will remove the issue from the config file and allow you to use the access point.

sudo nmcli con mod AccessPopup 802-11-wireless-security.group "" 802-11-wireless-security.pairwise "" 802-11-wireless-security.proto ""

best to reboot straight after. Then you should be able to connect via your phone.
Could you let me know if it works for you as well. Thanks
password failure
I'm having the same issue as Guido and presumably bjebb. Using a Pi Zero W, Bookworm Full 32-bit, installed this - marvellous, once it works! - script and left the ssid and password default (the second time, and changing them the first and finding that SSH over serial stops working too, presumably it pretends to be Ethernet, thankfully a reboot resets everything or I'd be reflashing for the second time today).

After running "sudo accesspopup -a" the AccessPoint appears just fine on my phone, but the password 1234567890 is repeatedly rejected as wrong. It is correctly stored in /etc/NetworkManager/system-connections/AccessPopup.nmconnection

"sudo journalctl" gives me logs that look similar to bjebb's. Let me know if you want more testing or logs - but I'm running the zero headless, so I can't monitor it real time - I tested this with a short python script to run first with "-a", sleep 5 minutes while I try connecting again, then without "-a".

Also - when leaving a comment here, if I see "Name" I assume the *following* box is where I put it, not the previous one! That had me momentarily confused.
Will not work :-(
I'm running a PI zero and did install the script like described. The hotspot will come up, and ask me for a password ... some second later it will ask for password again ... and so on. The WAP is caught in a loop asking for password. I'm pretty sure, the if've set up identical password due to my attempt. Any idea?
Will not work
Hi Guido When your wifi device selects the AccessPopup wifi profile the password it requests will be 1234567890 unless it has been changed with option 2. If that is not working then I would view the profile in desktop view with the Wifi icon by the clock to check the entry. If you edit the AccessPopup profile you can view the password their. Otherwise you can view it with sudo cat /etc/NetworkManager/system-connections/AccessPopup.nmconnection and look for the psk= entry This will be part of NetworkManager normal functions that are not affected by the script.
Will not work
I have the same issue. Problem is that the AP shuts down seconds after it has started. From the Logs:

15:22:29 device (wlan0): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'managed')
15:22:29 device (wlan0): state change: secondaries -> activated (reason 'none', sys-iface-state: 'managed')
15:22:29 manager: NetworkManager state is now CONNECTED_LOCAL
15:22:29 device (wlan0): Activation: successful, device activated.
15:22:29 audit: op="connection-update" uuid="15a328b0-1534-4004-9f0f-1216826a8143" name="AccessPopup" args="ipv4.gateway,ipv4.addresses,connection.timestamp" pid=760 uid=0 result="success"
15:22:30 audit: op="connections-reload" pid=785 uid=0 result="success"
15:22:30 agent-manager: agent[7e1be7ccd70a3784,:1.44/nmcli-connect/0]: agent registered
15:22:30 device (wlan0): state change: activated -> deactivating (reason 'new-activation', sys-iface-state: 'managed')
15:22:30 manager: NetworkManager state is now DISCONNECTING
15:22:30 device (wlan0): disconnecting for new activation request.
15:22:30 audit: op="connection-activate" uuid="15a328b0-1534-4004-9f0f-1216826a8143" name="AccessPopup" pid=790 uid=0 result="success"
15:22:31 device (wlan0): supplicant interface state: completed -> disconnected
15:22:31 device (p2p-dev-wlan0): supplicant management interface state: completed -> disconnected
15:22:31 device (wlan0): state change: deactivating -> disconnected (reason 'new-activation', sys-iface-state: 'managed')
Will not work
Hi bjebb

Thanks for the log info.
Could you let me know what it does if you activate the access point with the command
sudo accesspopup -a
this will create the access point which should stay running.
If that works as expected them run
sudo accesspopup
to go back to the two minute checks. This will also give some feedback about what it is doing.
You can run this command anytime to get it to check the wifi status.

Also what Pi are you using and OS Bookworm Full or Lite and 32bit or 64bit.

If you could let me know what happens then I can try and replicate the issue and look into it further.

Thanks
How to keep the 4G network of usb0 normal?
My pi5 also has a 4G module with port USB0. When there is no wifi, it can provide the Raspberry Pi with network data sending and receiving.

I hope this port will not be affected by the running of your script. When a hotspot is generated, the 4G module of usb0 can provide the Internet to the Raspberry Pi; what do I need to do?
How to keep the 4G network of usb0 normal?
Hi

I have not tried a 4G USB device with the script but if it shows as a wifi device in infrastructure mode then it will be considered in the same way wifi on wlan0 is, so the AccessPoint won't be available. If it is not Wifi Infrastructure then it will be ignored and stayed permanently connected and the AccessPoint will also be available.

If you run the command: nmcli con show
it will list all the network profile NAMEs and their TYPE. If your usb0 device shows as wifi then use the command

nmcli dev show NAME-of-profile-here | grep wireless.mode
if it responds with
802-11-wireless.mode: infrastructure
then it will stop the accesspoint from automatically activating. If it returns nothing then the USB0 profile will be ignored.

You can force it to be ignored by giving it a priority of less than minus 900, but that may stop it from starting as you would want. This has not been tested.

nmcli con mod NAME-of-profile-here connection.autoconnect-priority -910

The default priority is zero, so you can reset it afterwards.

If your 4g device is connected at the same time as the accesspoint, the devices connected to the accesspoint won't have access to the internet over 4G. Only the Pi itself will.
Doesn't seem to be automatically starting up
I installed your fantastic script, And it seems to be exactly right for my applications (We are building scientific devices to be deployed in the field and sometimes in the field if it can't find any Wi-Fi we needed to create its own Wi-Fi that people can connect to for debugging).

And I can go in, add new ssids turn on and off the hotspot manually. And that all works great, But I can't seem to get it to automatically do the pop-up and access point if it hasn't detected any Wi-Fi.

Is there something I need to add to like cron or something to make sure it does that? I bring it to a place that doesn't have any Wi-Fi and I expect after turning it on within 2 minutes it should be popping up and access point but it just never does. I'm using a pi 5 with bookworm from March 1st.
Doesn't seem to be automatically starting up
Hi Andy

If you have a setup that includes a vpn or uses a virtual device then that may be the issue. I have just fixed a bug which would act as you describe.

The script is run every 2 minutes by a systemd timer, so the issue will be around what Network Manager profile it has chosen to use.
To get manual feedback on what connections it is trying to make use "sudo accesspopup -a" to activate the AccessPoint and then "sudo accesspopup" to go back to a network connection. This will show what profile it is trying to connect with.

I have updated the website with the newer version so if you uninstall the current setup. Then download and install that version hopefully that will do the job. If not let me know what the feedback you get from the commands above and I will look into it.

Its good to hear that the script is being put to good use.
Doesn't seem to be automatically starting up
Thanks for your response. I uninstalled and installed a fresh one just now. The behavior seems the same. I can manually make it make a hotspot, but have yet to see it automatically do it.

I have a pijuice installed, but that shouldn't be blocking anything i can think of.

the only other thought i have, is that I run a python script upon rebooting that schedules the rpi to shut down in 1 hour
https://github.com/Digital-Naturalism-Laboratories/Mothbox/blob/main/Software/Scheduler.py
and it uses a timer I think. Can our timers be conflicting?

I also have a cronjob that runs every minute to take photos.
Doesn't seem to be automatically starting up
Update: I turned off all my own timer scripts and any cron jobs i had made, and still I don't have any automatic hotspots popping up.

Do i need to manually set something in cron to make it run the install command and run option 8? installconfig.sh
Doesn't seem to be automatically starting up
Hi Andy

Thanks for the feedback. The other software and timers won't conflict with this setup, so it's fine to have them running.
If you run "sudo systemctl status AccessPopup.timer"
there is a line that says "Trigger" this shows the countdown timer. If you run it a couple of times you should see the time change.

I suspect the timer is fine. The script will check your setups wifi profiles in Network Manager and decide if one is in range.
This issue maybe around what profile it is selecting, if that is not a wifi profile for wlan0.

The command "nmcli con show" will give you a list of the profiles setup on the Pi. The ones with TYPE wifi are the ones that are available for selection.

Now if you run sudo accesspopup -a
it will force a switch to the access point.

Then run sudo accesspopup
this will show the scan of the local wifi and how it compares them to your Pi's wifi profiles.
The line "Checking the Connection for:" will show what profile it is trying to connect to.
Is that profile the one you are expecting?

If it isn't what you are expecting, can you give me some info about that connection?
and also any output of
nmcli con show THE_PROFILE_NAME_HERE | grep 'wireless.mode'

I will then have a further look into it.
I have this running ok on a standard Pi5 setup with the latest OS Bookworm. There may be some configurations that have the correct criteria but are not what is expected, that I need take account for.
no access point on boot
Hi, I'm having a similar issue where the access point doesn't show up on boot if WiFi is not available. Here is the output of nmcli con show preconfigured | grep 'wireless.mode': 802-11-wireless.mode: infrastructure
no access point on boot 2
Hi Frank

This issue turned out to be that OS Bookworm was being used with X Window rather than the default Wayland and VNC was enabled.
Looking at the logs RealVNC was showing lots of errors which somehow was stopping the AccessPopup.timer from starting.

The workaround was to either disable VNC or to move the timer to the cron with crontab -e
and add the line
*/2 * * * * sudo /usr/bin/accesspopup >/dev/null 2>&1
(there is a space between each star)

The accesspopup script will keep re-enabling the service file so there is no advantage in disabling that.

My development Pi5 has developed a fault so I am can't look into a better fix until the replacement arrives.

If this doesn't help I am happy to look into the issue further.
raspap conflict?
hello. this is wonderful. will this conflict with raspAP? i already setup my pi with raspAP and then found this script. im pretty new to this and dont want to break my setup right now
raspap conflict?
Hi Billie It looks like RaspAP use there own network configuration so I would expect that it is not compatible with their setup. The installer on this article is for use with setups using Network manager such as PiOS Bookworm. I have another script that uses dhcpcd for networking if an Older OS is being used such as Bullseye called Autohotspot Both scripts have an uninstall option. RaspAP has an uninstall option so you can try them out if you wish to without too much hassle. I would back up your SD card first, then if it all goes bad you can just go back to your current setup.
Ing
Hello, thank you for this great utility. I have just installed it on a CM4 Raspi using Bookworm. The Issue i am having is the following: My home network has 3 SSID's The Raspi with Autohotspot is setup to connect to a Access Point with the SSID "C" Raspi connects nicely after start to SSID "C" If I power down the AP with SSID C, the Raspi comes up with its own SSID "D" I can connect to it. If I power up the AP with SSID C the raspi does not reconnect back to C. It is still broadcasting his SSID D. I can connect to it. Q: how can I debug this problem?
Ing
Hi Jakob

The script is triggered by a systemd timer. Check the status of that with "sudo systemctl status AccessPopup.timer"
This should be active with the time left until it triggers again.
You can also check the service for any error messages. "sudo systemctrl status AccessPopup.service"

Otherwise you can run the script manually with
"sudo accesspopup" and you will get feedback on what it is doing while it is trying to connect to your network again.
then use "sudo accesspopup -a" to switch back to the Pi's access point.

If that doesn't give any clues the let me know what details you see and I will take a closer look.
reply to Roboberry2024-03-22 13:09
Did you got my answer about the interface created by zerotier which blocks switching back to WLAN
reply to Roboberry2024-03-22 13:09
Hi Jakob No haven't received any new comments. You can email me if it is easier admin @ this site, and I will take a look.
Ing
Hi, thank you for this great work. I just installed it on Bookworm and a CM4 Module. I am faced with the following issue. The Raspberry hooks up nicely on the Home WLAN Access point. If I switch this AP off, the Raspi with the autohotspot comes up correctly as a Hotspot. If I switch the Home WLAN AP on again, autohotspot is not changing back to the Home AP. Its still showing up and i can connect to it. I have to say, there are other two other SSID on the Home Network. How can I debug this problem? Thanks Jakob
Armbian bookworm install
Good morning,
First of all, again a wonderful job done, thanks for that.
I have an Banana Pi M2 Zero, with OS Armbian 24.2.1 bookworm Linux 6.6.16
The installation of your program accesspopup 0.8-3 went without errors.
I could change the IP address to 192.168.50.10 without a problem and the my SSID "clearview" get broadcasted too.
On the BPi side, ip addr is showing the broadcasted ip address 192.168.50.10
I can connect to the access point with my windows 10 laptop (with ExpressVPN) but when trying to run PUTTY, Putty cannot connect. Not with hostname and not with pi@192.168.50.10, or hostname "clearview.local"
I also switched off ExpressVPN but that didn't help.
Is there anything I can check/change to make your program to work.
I understand fully the fact that original your software in not build for the exotics of BPi and Armbian bookworm :-)
Kind regards
Ed
Armbian bookworm install
Hi Ed

Thank for the feedback. I do plan on testing it with various OS's including Armbian but only got as far as Ubuntu and Arch so far. In theory it should work with any system with Network Manager but other factors may need configuration depending on the OS.
Going by my previous scripts, if you can get a connection and your laptop has been issued an ip address then the issue will be with other setup.
When the Hostname is changed, it will need rebooting for it to take full effect.

Check that dnsmasq-base is installed. If that is not available as a package then just dnsmasq as the accesspoint won't work properly without that.

If you have a desktop available and can check if VNC desktop sharing is working then the issue will be with the ssh server rather than the accesspoint. Are you able to ssh from a different device/software.

If you have no luck I am happy to check out Armbian soon as the next OS to look at.
Add a wi-fi adapter selection menu.
I have a raspberry pi4b, and the raspbian bookworm OS is currently installed. I am using an external dual band wifi adapter RT3572 ( https://www.ebay.com/itm/293129730857 ). How do I set up your script so that I can use both the built-in and external wifi adapter? That is, so that I can choose which wifi adapter (wlan0 or wlan1) was used to access the Internet, and the other was used as an access point? Scenario number 1: The RPI is relatively close to the WiFi router, and the clients are far away. In this mode, it is better to use wlan1 as an access point. Scenario number 2: The RPI is far from the WiFi router, and the clients are nearby. In this mode, wlan0 is better as an access point. Thanks!
Add a wi-fi adapter selection menu
Hi Lopen

The the device that is used for the AccessPoint can be edited at line 11 of the accesspopup script.
The best way to do this is to edit the accesspopup script in the downloaded and un-archived folder.
Then uninstall the currently active script and then install the new one.

You can only have one device set for the AccessPoint with this script though. You can't easily swap the device as the AccessPoint profile is set to use the same device. The script expects only one profile with the name AccessPopup and if it detects another AccessPoint setup on the default wifi device (in line 11) it will deactivate it and re-enable the AccessPopup profile.

If you are using the desktop then you can manually create a "Hotspot" for wlan1 with a different name and then manually select it from the list of networks. Using the wifi GUI by the clock. You would have to manually change the selected network that wlan0 is set to. So unfortunately it's not that straight forward.

Also when you have both wlan0 and wlan1 setup. The devices on the AccesPoint won't be able to use the internet unless nftables are setup to route the data between wifi devices, which is not part of the current setup.

So unfortunately that is not possible with the setup.
Thanks for the detailed answer!
I will do as you wrote. To access the Internet for external devices, I will use a proxy server installed on raspbian (3proxy). Perhaps in the future, if you have time, if it doesn't bother you, you can refine the script for a more flexible application. Thanks again for the response in particular and for your helpful website in general.
Add a wi-fi adapter selection menu
Thanks, You are welcome.
This current script is the basic version to replicate my previous wifi script for Bookworm.
I am currently developing a more featured script, so I will take you comments into consideration. Thanks.
Adjust Wifi AP Transmission Power using Network Manager
Hey therer, I have an adjacent question on how to reduce the transmission power of the Wifi AP/hotspot using the Network Manager. Basically I want to reduce the radius of my hotspot, so you can only connect to the Pi when you are very close by. Within the NM GUI, you can edit the settings for the wireless hotspot and I see that it includes Transmission Power as an editable setting but it is set to 0mW by default. Changing and saving to a new mV value also doesn't actually update the setting either (ie. when you reopen the settings for the hotspot its back at 0mW). Maybe its just a place holder and yet to be implemented? Is there another way to do this?
Adjust Wifi AP Trans
Hi I have had a look at the NM Gui on my Pi and I can't see an option for transmission power and I can't see anything in the docs to change that setting. The only other place I know of a power setting is with IW dev set txpower [] phy set txpower [] to see your current setting use sudo iw dev Then to make the change there is a fixed option, but you have to bring the interface down to make the change. sudo ip link set wlan0 down sudo iw dev wlan0 set txpower fixed 15000 sudo ip link set wlan0 up Not sure if this helps as it will limit the wifi all the time. Other than putting a physical barrier round the Pi to reduce the signal I don't know what else to suggest.
Unable to connect to network
Hey,

this script is perfect for me, but it doesn't reconnect to my wifi at home. The accesspoint at the works perfectly, but when i want to switch back with (4), or (8) to my home wifi it always shows me the message:

Checking: *ssid name*
unable to confirm connection status
a network connection has not been made with any known ssid. activating acceess point

But, if i go back to nmtui and reconnect to my home wifi, it works. I have tried several ways to create the connection, with nmtui, with the script, but i won't reconnect.

Need help, thanks!
Pascal
Unable to connect to network
Hi Pascal

That's a bit odd, I will have a look into what is causing that. It will be detecting the SSID from your home network. After it activates the connection it waits for a response from NM. If it doesn't get the a valid response you get the message you see.
Could you activate your connection with the command 'nmcli con up Your-Network-Profile-Name'
and send me the feedback text please. Just to check it's not anything I haven't seen yet.

Does your NM profile name have any special characters or spaces in the name?
Unable to connect to network
Hi,
thanks for the reply. With sudo, the connection works. Output ist German, connection established, no errors occured.
Verbindung wurde erfolgreich aktiviert (aktiver D-Bus-Pfad: /org/freedesktop/NetworkManager/ActiveConnection/3)

My ssid is RaumschiffEnterprise, no spaces, nothing special there. It seems the Accesspopupscript doens't wait until NM has answered. It shows the message "unable to confirm" pretty quickly.

Another odd thing is, at the network list i always get all entries twice. Maybe it is confused about the doubled entries.

Add or Edit a Wifi Network
Add a new WiFi network or change the password for an existing one that is in range
1 FRITZ!Box 7530 AL
2 RaumschiffEnterprise Gastzugang
3 RaumschiffEnterprise
4 RaumschiffEnterprise
5 RaumschiffEnterprise Gastzugang
6 FRITZ!Box 7530 AL
7 FRITZ!Box 7530 AL
8 To Cancel

2 until 5 are mine, i have also 5GHz Wifi, but Rpi Zero W can only connect to 2.4GHz, so this is not the reason.
Unable to connect to network
Hi Pascal

Thank you for the information.
I think I have found the issue and tested it using a WiFi repeater and your SSID's.
I have updated the script and done some other updates as well
If you download the latest version. Then use option 7 to uninstall the old script and then option 1 to install the new script.
it should start using the changes.

The repeating SSIDs is because it picks up each antenna on the router. If you run the command

sudo iw dev wlan0 scan ap-force | grep -E "^BSS|SSID:"

you will see each Mac ID (BSS) is different for each entry.
It doesn't matter which one is selected though as the right one will be used when the connection is made.

Please let me know if this solves the problem, if not I will look into it further.
Thank you & Question
Hi Wolfgang,
Thanks for the feedback and how you have use the script. That is always interesting to know.
For the issue; the AP should be getting generated. It is on a 2 minute timer so it will check if a known SSID is in range and try to connect to it. As your Network is in range the AP will be stopped, the connection to your router will fail due to the wrong password and the the AP will be setup again. about 1 min 30 seconds later it will do it all over again.
To check if the script will switch when your router ssid is not available you need to change the SSID rather than the password.
nmcli con mod "Profilename" ssid "newssid"

Then the script won't find any known ssids and create the AP.

If you just want an AP while at home you can use
sudo accesspopup -a
as well, and
sudo accesspopup
to go back to normal use.

I hope that helps, let me know if you have any issues
Happy New Year
Forgot to add my question
So, here is a little test I made: I entered
sudo nmcli radio wifi on
sudo nmcli dev wifi connect password ""
with a fake password for my network, which subsequently interrupted the valid wifi connection.

In this case, it should default to the access point, right? Because it doesn't. The wifi network is not shown on my Mac or iPhone.
Am I missing something?
Thank you & Question
Great update, thanks much! I find the menu also clearer than the previous version. I am working to include this in a picture frame application. When you give family members a homebrewed picture frame (www.thedigitalpictureframe.com), the first problem is always the Wifi. Your app would make it easy to access the frame.
Install Bug: RPI 4, Bookworm
Error on the installconfig.sh

./installconfig.sh: line 563: -3: substring expression < 0
Install Bug: RPI 4, Bookworm
Thank you for that.

It is trying to display the ip address, so just info and not an issue to the function.
I will fix that.