Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Selective connecting to WiFi access points #7279

Unanswered
dj-louw asked this question in Q&A
Discussion options

Hello,
I'm relatively new to microcontroller development and I'm fumbling my way through a couple of projects.

I have run into a very weird issue, and I would appreciate somebody shedding some light on it for me.

Background

  • Development Board: nodemcu-32s
  • Dev environment: PlatformIo running on VS code
  • OS: Windows 11 (if that matters)
  • WiFi Hardware: UniFi nanohd access points - 3 of them in my house. Also a mobile phone hotspot. My networks are configured as follows:
    • Main wifi: 2.5 and 5g, managed by unifi gear.
    • IOT wifi: 2.5g only, managed by unifi gear.
    • Mobile phone wifi: 2.5g only

High level overview of the problem:

I have 2 nodemcu-32s development boards in front of me. One appears to have no issue connecting to my wifi network at all, but the other one refuses to connect, or takes a very long time to do so, and sometimes connects instantly.

What's even more wacky is that this behaviour depends on the access point I am using. I summarize the behaviour below:

Dev Board 1

  • Main wifi: Connects no problem
  • IOT Wifi: connects no problem
  • Mobile hotspot: connects no problem

Dev Board 2

  • Main wifi: Refuses to connect. Events that fire are ARDUINO_EVENT_WIFI_STA_DISCONNECTED, reason 2, which is WIFI_REASON_AUTH_EXPIRE I think. I've sometimes also seen event reason 202 (WIFI_REASON_AUTH_FAIL) be given.
  • IOT Wifi: Refuses to connect, events that fire are ARDUINO_EVENT_WIFI_STA_DISCONNECTED with reason 201, which as I understand it is WIFI_REASON_NO_AP_FOUND
  • Mobile hotspot: connects no problem

Based on my massive sample size of 3, it's clear to me the board is not faulty, because it's actually connecting to a network successfully. But why won't it connect to my unifi gear, and more importantly, why is the other board not experiencing this issue?

It's worth pointing out that I had Board 2 running "in production" in my house for almost a year without issue, when all of a sudden it stopped connecting to my network. At first I thought the board died, but then when I investigated further I noticed this strange behaviour.

Could a firmware update in my access points perhaps cause this? Is there some "firmware" or something that I can update on my ESP board itself that might help?

Or is this a hardware problem, and if yes, is it possible to diagnose it further?

Your help in this grave matter will be greatly appreciated.

You must be logged in to vote

Replies: 4 comments

Comment options

I forgot to add, in case that helps, the code that I used to test the above scenarios can all be found here: https://github.com/dj-louw/wifi-playground/blob/master/src/main.cpp

You must be logged in to vote
0 replies
Comment options

Before your wifi begin() in setup try the following.

WiFi.disconnect(true);
delay(100);
WiFi.persistent(false);
delay(100);
WiFi.mode(WIFI_OFF);

delay(2000);
WiFi.setSleep(false); //#2396
delay(100);
//WiFi.config(INADDR_NONE, INADDR_NONE, INADDR_NONE);
delay(1);
//delay(1);
WiFi.mode(WIFI_STA); //This is important to be called for setting hostname.

You must be logged in to vote
0 replies
Comment options

@dj-louw There have been some WiFi reconnect improvements in this project. Have you tried the latest release? Also sounds like possible bad antenna on module 2. Try the WiFi Scan example on both boards and see what kind of signal strength you are getting.

You must be logged in to vote
0 replies
Comment options

Thanks for the suggestions, I will try them when I have a chance and report back.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /