Notifications
Clear all

Booting WiFi Access Point then starting Standard WiFi semi-automatically

10 Posts
3 Users
2 Reactions
767 Views
(@cjm3115)
Member
Joined: 3 years ago
Posts: 13
Topic starter  
 have been busy with my microcontroller web control interface and I am getting bogged down with trying to reboot the WiFi after the access point code. I am not using any WiFi manager and do not really wish to. The code needs tidying up quite a lot to standardise my coding style, but the thing is that it works well and is fairly fast. 
 
I would dearly love some help regarding the WiFi side of things and I had hoped that I would be able to login to the forum to discuss my problem. However, can you please tell me if you think that the forum is somewhere where I can get help with such issues ?
 
By the way the code for this project is in separate nested subdirectories which are roughly sorted out into order by their functionality within the code. I have not run the current versions on a Raspberry Pi Pico W but I guess that I should. It works really well running on a Arduino RP2040 Nano Connect and is fast whilst not taking up too many resources. Should you wish to try using it for a web control interface for one of your projects, just feel free to ask me for the code. Soon I will be adding some slider components for use with analogue controls.
 
I look forward to hearing from you in the near future.
 

C J MULLER


   
Quote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7326
 

@cjm3115 I am not very clear about what you are asking. Since I do not have a CONNECT I can't test. It took a while but I finally found the board manager for the CONNECT. Looking at the libraries then I see no WiFi library specific to that board. There are however a few custom libraries for WiFi including over a dozen examples for a WebServer. 

Perhaps if you could use one of the examples to point out where it is failing then we would have a common understanding.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1762
 

Hi @cjm3115,

  Like Ron (@zander), when I first read your message earlier, I was unclear about your question and delayed responding whilst I pondered what the question was. In particular you say:

I am getting bogged down with trying to reboot the WiFi after the access point code. I am not using any WiFi manager and do not really wish to.

By 'WiFi Manager', I assume you mean a router, which is often used as the central hub in a domestic WiFi situation, linking the local machines, possibly allocating IP addresses, etc, as well as connectingto the Internet. So, if your network is purely local, I can understand why you might decide to make one of your nodes an Access Point, so that it preforms this central hub task.

But I am still confused as to what you mean by " trying to reboot the WiFi ", in the context of the rest of the sentence. Perhaps you could explain please, including providing a description of the network you envisage.

At this stage, I am assuming all of your nodes are reasonably generic with regard to WiFi hardware provision, so that it could be something relatively commmon, such as a few ESP32s, as I doubt if anyone on the forum will have a exact match of boards to yours.

Best wishes and good luck, Dave


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7326
 

@davee WiFi manager is a library that Bill covered in 

It allows you to NOT hard code credentials in source plus some other functions.

Anytime you see a device start-up on 192.168.4.1 you can be fairly sure it is using one of the many WiFi Manager libraries.

It is simple enough not to use a WiFi manager, it just requires more detailed steps.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7326
 

@davee I just noticed your final comment re esp32. He is using the Arduino NANO RP2040 Connect which is defined in the "Arduino Mbed OS Nano boards". Check the attached screen shots for clarification. The key point here is that many of these 'special' boards have different WiFi libraries. Trust me I know first hand.

Screenshot 2023 10 19 at 09.36.09
Screenshot 2023 10 19 at 09.36.41
Screenshot 2023 10 19 at 09.35.07

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1762
 

Hi Ron @zander,

  Thanks for the clarification .. as you say, I  probably misinterpreted 'WiFi Manager' ... that is why we both asking for more detail!

  And my suggestion regarding hardware, was only as a 'model' to get a conversation started ... obviously the actual code will have differences. The chance of anyone else having a few of the Nano Connects mentioned, ready to try out, seemed rather unlikely, but maybe they have similar network using something more common, that could prvide some insight.

Best wishes, Dave


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7326
 

@davee The good news is that the CONNECT board does NOT have a WiFi sample so that means the 'normal' samples will work. Unfortunatly I checked the ESP32, NODE MCU, PICO W and UNO R4 WiFi and they all use board specific examples. The NANO 33IoT looks like it will work and I know I have one and maybe others do as well as it was more popular for IoT projects.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
(@cjm3115)
Member
Joined: 3 years ago
Posts: 13
Topic starter  

@zander I have added [ WiFi.end(); ] before disconnecting and setting up standard WiFi.

I also automated everything, so that the WiFi automatically reconfigures sending the data using ajax, after this and a 90 second timeout the JavaScript continues with a [ self.location= 'http://SW_ipa1.SW_ipa2.SW_ipa3. SW_ipa4';  call.]

Excerpt :-

-> WiFi.end();

    dump= WiFi.disconnect();

delay(100);
 
WiFi.config(IPAddress(SW_ipa1, SW_ipa2, SW_ipa3, SW_ipa4));

  // Connect to Wi-Fi network with SSID and password
if(WiFi.status() != WL_CONNECTED)done=false;

do
    {
if(ssid_num ==-1)WiFi.begin(WiFi_SSID, WiFi_PASSWD);
elseif(ssid_num >-1)WiFi.begin(SSID[ssid_num],PASSWD[ssid_num]);
elseif(ROUTER >0)WiFi.begin(SSID[ROUTER], PASSWD[ROUTER]);

    // wait 10 seconds for connection:
delay(3000);

      WiFi_currentTime =millis();

if(WiFi.status() == WL_CONNECTED)done=true;
    }
while((!done) && ((WiFi_currentTime - WiFi_previousTime) <= WiFi_TIMEOUT));
 
 
Problem solved.
 
 

C J MULLER


   
ReplyQuote
(@cjm3115)
Member
Joined: 3 years ago
Posts: 13
Topic starter  

@daveeI have added [ WiFi.end(); ] before disconnecting and setting up standard WiFi.

I also automated everything, so that the WiFi automatically reconfigures sending the data using ajax, after this and a 90 second timeout the JavaScript continues with a [ self.location= 'http://SW_ipa1.SW_ipa2.SW_ipa3. SW_ipa4';  call.]

Excerpt :-

-> WiFi.end();

    dump= WiFi.disconnect();

delay(100);

WiFi.config(IPAddress(SW_ipa1, SW_ipa2, SW_ipa3, SW_ipa4));

  // Connect to Wi-Fi network with SSID and password
if(WiFi.status() != WL_CONNECTED)done=false;

do
    {
if(ssid_num ==-1)WiFi.begin(WiFi_SSID, WiFi_PASSWD);
elseif(ssid_num >-1)WiFi.begin(SSID[ssid_num],PASSWD[ssid_num]);
elseif(ROUTER >0)WiFi.begin(SSID[ROUTER], PASSWD[ROUTER]);

    // wait 10 seconds for connection:
delay(3000);

      WiFi_currentTime =millis();

if(WiFi.status() == WL_CONNECTED)done=true;
    }
while((!done) && ((WiFi_currentTime - WiFi_previousTime) <= WiFi_TIMEOUT));

Problem solved.

C J MULLER


   
DaveE reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7326
 

@cjm3115 Good to hear, but in the future please learn how to post code so others can read it. Also post the complete code or if too big, post the file and/or more context so others may learn.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
DaveE reacted
ReplyQuote