Perhaps someone can help with a esp / arduino question

Yes, the ESP stores the ID of the connection in flash and tries to reconnect at startup and anytime the connection drops. But all of that can be controlled. If you are playing around with ESP and WiFi, I suggest you give this guy $10 and download his book. It’s a treasure trove and addresses these questions.
Kolban’s Book on ESP

Id look at ESP-NOW as a possible cause if it happens when you put two in range of each other. I have three or four running pretty much continuously and have not experienced this problem.

are you running a mix or lua and arduino coded devices or purely arduino coded devices. my issues appeared only when arduino wifi was introduced . my previous LUA coded devices were running rock soild for months. until I started with arduino and esp , now the LUA stuff crashes. recently I pulled all my arduino stuff and all the LUA stuff is rock solid again. and I am pretty sure it the redundant AP that being created. that causing my issues. as I can eliminate the issue by putting it on separate AP . - but in either case I would like to stop the creation of the redundant AP when running as a client

I don’t understand how to put an AP on a separate AP. All of my devices are coded using Arduino/ESP826. Try reading up on Arduino WiFi in Kolban’s book. It is very helpful.

the arduino devices built are all CLIENTS , - they only create a redundant AP under arduino IDE all on the same channel as what ever client connects at( i do not want this AP it just created by default for some reason by arduino IDE and I can not figure out how to stop it it from doing so- as it also poses a high security risk as it creates unsecured backdoor to your network) - there within is the problem. it creates a channel saturation that LUA does not like.

I will admit my 2.4ghz spectrum is fairly congested already. as my connection to the internet is 2.4ghz backhaul to an AP 5 miles away. then that is bridge from there to my house by 2.4ghz( 200 metre) then with in my house there are 2 APs one for my internet usage and one for my devices that all connect to orange pi that is an AP

Once again, read Kolban’s book. He explains how the ESP WiFi works and the system calls to start and stop the AP. My impression of the way it works is that the SDK underpinns all of the layered implementations, including the LUA and arduino/ESP8266. The WiFi runs under that and the SDK has an API set to control it. Most of the Arduino WiFi methods that I have looked under the hood at use those APIs, as I believe the LUA environment does.

You can call any of those functions from the Arduino/ESP8266 environment. You can call any of the SDK functions, you can manipulate the hardware registers (I do that a lot), and I believe you can even insert assembler code.

If you want to get to the bottom of your problem, put together a short sketch that causes this unwanted AP to be created, and make it available so I can see what’s going on. You may be invoking something implicitly that is causing your problem. I’m dubious that it’s a flaw of the Arduino/ESP8266 environment per-se or some reaction to “channel saturation”.

hi bob
here something for you to try. take a brand new esp - in my case it a wemos d2
hook it up

scan your wifi for avalible APs
out of the box it will display default SSID of AI thinker_XXXXX( chip id) it will have not DHCP but you can connect to it but no ip will assigned

no open up arduino IDE grab any the default example for esp wifi as a client sketch i used MQTT and esp Example>PubSupClient > mqtt_esp8266

insert your Wifi details and MQTT server - upload to your ESP.
now check your wifi again. the “AI-THINKER_XXXXX” AP is still there now log onto it it again you now have DHCP enable and you will be assigned 192.168.4.X and a gateway of 192.168.4.1 .

Now I have not checked out how vulnerable this is but in either case you now have a unsecured backdoor to your network.

it a flaw in what adruino and esp works as if you program with LUA you are not left with such a gaping security flaw. I’ve ask at both arduino forum and esp8266 forums it falls on deaf ears as to how to correct this issue

I use nodeMCU 1.0 with the brand Amica. They have AI-Thinker ESP -12. I tried three of them, all brand new just out of the package. If I power them up with a 5V USB supply, they do not broadcast an SSID and do not appear in a scan by either an IOS device or a Windows 10 laptop.

well that weird yet every one I buy out of the box i scan and they all have SSID’s just open a new batch wemos today and did the same. I plugged also in a generic and an esptoy they all scan with a SSID out of the box for me with a windows 7 computer and I did a scan from a commercial radio too in case of a particular quirk of my computer
the ones on corresponding channels relates to the AP it is connected too… I can add more ESP and everyone will display a SSID and I have close 10 different brands from 10 different vendors

ai-thinker_XXXXX wemos
esp_XXXXX esptoy
ESPAP generic

IOT is PI AP
Wii30 normal router AP
FRNetwork internet bridge

I would think most likely your computer is blocking OPEN SSID’s I know windows 10 will do that… do not play with ios that offen can not say for that one

I don’t think so. When I deliberately enable AP mode, it works fine. More likely it has to do with whatever software WeMos is pre-loading onto the boards. Seems like a cumbersome form factor anyway, but I guess it lets you plug your arduino shields directly? Since starting with the ESP, I have no interest in Arduino. Just seems like a toy.

yes you can use arduino shield on them( wemos D2), no use reinventing the wheel- but I have wemos d2, wemos mini, nodemcu v1, 2 and 3 , esptoy, random generics , witty cloud and probably others. and everyone has a SSID at initial boot some on purpose ( esptoy) other as empty boards. the thing is If I flash to LUA as client access ( no SSID is displayed) then later reflash to arduino core as client . it still has the same issue the SSID name will be different but it exhibits the same behaviour… so I do not know why you do not see the same issue. unless it related to my work station as it is a linux machine as I do not generally use windows for security reasons.

but i guess if I can not figure out how to shut that AP downs creation – I should start probing these APs and see how big of a risk they really are.- but really all one has to is most likely telnet in bridge the AP and the client and you have complete access to the internal network

Steven, I’ve been using ESP03s and have never experienced this. Although you have lots of different versions it might be worth going back to basics like an 01 or 03 and seeing if you still have the problem.

Also you could maybe try reflashing the base code as well as your app.

Simon

tried your suggestion - still the same
install newest version of ardunio IDE on window
newest esp core
and pubsubclient
all from with in arduino libary
no different either
still the AP is created when acting as a client
I NMAP the esp AP port 67 is open as expected dhcps- but 5 more come up as filtered so nmap could not determine if it was open or closed. 4 were service ports. 1 was at port 44000 listed as unknown. so there is the possibility that the esp can be compromised –

Is this issue related ?

@Paul – looks to be the same issue

I now even erased my esp using two different methods uploading a blank bin via espflash tool and used esptool.py

   ./esptool.py -p /dev/ttyUSB0 -b 115200 erase_flash

each give identical results. sure after flash it nolonger broadcast SSID at initial boot. but once you reflash with default setting as client you again have the AP but instead of AI-thinker_xxxxx ( chipID – in the case of wemos D2) it now broadcast as ESP_XXXXXX ( chipID)

@stephen do you mean @pb66?

Paul

sorry yes

While this looks to be a really good summary of everything ESP8266 related sadly the Arduino Core info is somewhat lacking in detail :persevere:

well I finally found the command to shut off the AP

for client mode only

WiFi.mode(WIFI_STA);

to turn AP on or off

WiFi.softAPdisconnect(true);

I don’t think this is a problem with the Arduino/ESP layer. As I’ve said before and is described in the book I mention, the ESP basically an IoT device and the native WiFi is at a lower level than the Arduino Layer. The book I reference points this out and also goes over the various APIs that are used, no doubt by the Arduino layer as well as others, to configure and control the WiFi services.

I did some basic experiments and it appears that when the ESP powers up, the WiFi tries to resume in the last mode that was set. (There is a system call to set these but I don’t see any evidence that is being used.)

Basically, if I put the ESP in AP or STA_AP mode, it will reboot in that mode, over and over again.

If I add:
WiFi.mode(WIFI_STA);
it turns off AP mode and will boot up in STA mode only in subsequent boots.

If AP is being activated implicitly by one of the WiFi methods that you are using, you may need to invoke WiFi.mode(WIFI_STA) again to clear it. You can find out what mode the WiFi is in using WiFi.getMode();

It’s all in that book. I did these experiments using a version of ESP8266SDWebServer, so everything seems to work as I have described with ESP8266WiFi, WiFiClient, ESP8266WebServer.