CongducPham / LowCostLoRaGw

Low-cost LoRa IoT & gateway with SX12XX (SX1261/62/68; SX1272/76/77/78/79; SX1280/81), RaspberryPI and Arduino boards
694 stars 352 forks source link

Can't connect to a different Wifi? (only possible to connect with fresh install?) #301

Closed RickerStem closed 2 years ago

RickerStem commented 3 years ago

Hi there!

First what a great project! We are already using an ethernet gateway for around 2 years now! We want to expand with some more gateways, but we want to connect them over Wifi. The issue is we can only connect to a Wifi access point with a fresh image? So only with a fresh clean install, we are able to connect to a Wifi access point. But if we change the SSID we want to connect to it doesn't work? It just says:

"Gateway is normally configured as WiFi client. Connected to: "OurOldConfiguredWiFiAccespoint". Use RaspAP to manage WiFi networks"

So it doesn't switch.. Also sometimes it just says .... Connected to: "Nothing Between The Quotes" ......

Also in RaspAP it says wlan down? and it shows an unknown wifi access point (can't do anything with it)

So only it only works the first time changing the wifi settings, if we want to change the settings it just doesn't work anymore :(

We tried all kind of things:

We're a little bit lost, maybe somebody has suggestions?

Thanks in advance!

Rick

RickerStem commented 3 years ago

Some pictures

wlan_issue (2) wlan_issue (3) wlan_issue (4) wlan_issue (5) wlan_issue (6)

CongducPham commented 3 years ago

Changing wifi can be problematic because the /etc/wpa_supplicant/wpa_supplicant.conf keeps information about old wifi networks. I believe the simplest way is to delete old wifi line in this file. See some infos here: https://github.com/CongducPham/LowCostLoRaGw/blob/master/gw_full_latest/README.md#make-your-gateway-a-wifi-client

RickerStem commented 3 years ago

Hi,

Thank you for your quick response,

Indeed the wpa_supplicant.conf file was filled with different network settings. I tried to keep only 1 network and then rebooted. But that didn't work. Also tried to remove all the network settings and reboot, also didn't work. after clearing all the network settings and configuring the wifi through your admin web interface, it says it's connected in the WiFi tab, but it's not saying online at the top of the page. also, the test internet connection button still says offline. If I run "iwgetid" it says that I'm connected with "myWiFiSSID" and it shows up in my router and I'm able to ping it?. (I'm also not able to browse the web..)

When running your prepare_wifi_client.sh script I get the following errors. Is this normal? wificlienterror

So still not able to switch to another wifi.

Rick

CongducPham commented 3 years ago

I will try to test this evening. I havent' touch the wifi client part for a while as we are mainly using ethernet dhcp.

CongducPham commented 3 years ago

Well, I tested the wifi and it seems to work fine. image

CongducPham commented 3 years ago

The web interface shows that the gw is acting as wifi client and it is online through the wifi connection. image

CongducPham commented 3 years ago

I have only 1 wifi network indicated in /etc/wpa_supplicant/wpa_supplicant.conf

CongducPham commented 3 years ago

RaspAP can show the information. image but actually has some issue to scan other wifi networks.

RickerStem commented 3 years ago

That's really strange, which raspberry version are you using? (does this maybe matter?) I'm using the Pi 3 Model B V1.2. Also are you able to easily switch to another network? And does it still works?

Thanks for testing!

RickerStem commented 3 years ago

I also noticed that it connects to my hotspot when it's booting up? and after a few seconds, it disappears (see video) . Also, some raspberry are really slow with booting up and are hanging a while on raspi-config.service?

https://user-images.githubusercontent.com/58143786/111181360-2ff01900-85ae-11eb-9b90-564bee2c3d3a.mp4

RickerStem commented 3 years ago

systemd-analyze blame show 6 minutes for networking service... strange..

systemd-analyze_blame

CongducPham commented 3 years ago

Wifi on RPI can be problematic. It has been reported that when wifi signal is lost then the RPI has some difficulty reconnecting. I'm using an RPI3 B so sale configuration than yours.

RickerStem commented 3 years ago

Indeed a bit problematic.

I'm now running your gateway on the same Raspberry, but now on the newest version of Raspberry OS. Everything is working correctly at first glance, it's now easy to switch from WiFi SSID.

Thank you for your time and testing!

Going to set up multiple WiFi gateways and add around 30+ Lora sensors!

CongducPham commented 3 years ago

Great to hear. regards,