Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP32 Won't Connect To My WiFi AP #517

Open
prairietech opened this issue Mar 19, 2023 · 9 comments
Open

ESP32 Won't Connect To My WiFi AP #517

prairietech opened this issue Mar 19, 2023 · 9 comments

Comments

@prairietech
Copy link

The ESP32 won't connect to 3 different wifi APs I have tried but will connect to my cellphone when it's used as a wifi hotspot tether. Those wifi APs are all the same room as the ESP32.
Otherwise, I get the WiFi Failed! error. My internet wifi AP ssid/password are entered under the FIXEDWIFI setting. Running the latest V2 download using Platformio.

When the connection fails, the ESP32 then goes into it's own AP mode which I can connect to using a laptop. I am able to submit changes from the web interface and they are accepted with the Serial Monitor confirming the action. From the web interface Config page, my Internet wifi AP is listed as available. I have also entered it under wifi_00 on the Config page, saved, then restarted only to have the connection still fail.

I can upload a simple wifi test sketch to the ESP32 and it will connect to the same Internet wifi AP entered under FIXEDWIFI. I have other ESP32s doing other tasks around the house and wifi connection has never been an issue.

I've tried everything I can think of, so looking for ideas and suggestions of what to try next?

@Edzelf
Copy link
Owner

Edzelf commented Mar 19, 2023

Maybe you can replace the wifi connect routine with a one that works on your other ESP32s. It's only a few lines.

@prairietech
Copy link
Author

As you can tell, I'm a long ways from a programmer. Could you tell me where in the code those lines are?

@Edzelf
Copy link
Owner

Edzelf commented Mar 19, 2023

Search for "connect".

@prairietech
Copy link
Author

1687 results in 88 files......may take awhile

@Edzelf
Copy link
Owner

Edzelf commented Mar 19, 2023

Start at line 3431.

@prairietech
Copy link
Author

Below is starting from line 3431 of main.cpp
Doesn't look like wifi commands?

static bool connected = false ; // Connected to host or not

if ( xQueueReceive ( radioqueue, &radiocmd, 0 ) ) // New command in queue?
{
dbgprint ( "Radiofuncs cmd is %d", radiocmd ) ;
switch ( radiocmd ) // Yes, examine command
{
case QSTARTSONG: // Start a new station?
if ( sdqueue )

@Edzelf
Copy link
Owner

Edzelf commented Mar 19, 2023

I had the wrong version. It is 1611:
WiFi.disconnect ( true ) ; // After restart the router could WiFi.softAPdisconnect ( true ) ; // still keep the old connection vTaskDelay ( 1000 / portTICK_PERIOD_MS ) ; // Silly things to start connection WiFi.mode ( WIFI_STA ) ; vTaskDelay ( 1000 / portTICK_PERIOD_MS ) ; if ( wifilist.size() ) // Any AP defined? { if ( wifilist.size() == 1 ) // Just one AP defined in preferences? { winfo = wifilist[0] ; // Get this entry WiFi.begin ( winfo.ssid, winfo.passphrase ) ; // Connect to single SSID found in wifi_xx dbgprint ( "Try WiFi %s", winfo.ssid ) ; // Message to show

@prairietech
Copy link
Author

I did not modify the wifi code but had a strange development.
I noticed that the softAP of the ESP32 was operating from channel 1. So I locked my Internet wifi AP onto channel 1, hit the reset button on the ESP32 and got a connection!?!?

Anyone know why the ESP32 isn't scanning AP channels to find the correct SSID? This is the first time I have ever had to change the channel on an AP to match what the client is needing.

@Edzelf
Copy link
Owner

Edzelf commented Mar 20, 2023

Channel 1 to 11 should be acceptable. I am using 2 and 7 at home.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants