Notifications
Clear all

WiFiMnager-Integrating WebServer Code

21 Posts
3 Users
1 Reactions
1,478 Views
ronpenrose
(@ronpenrose)
Member
Joined: 2 years ago
Posts: 27
Topic starter  

I am trying to figure out how to display an HTML page after implementing AugoConnect using WiFiManager. I am using the code from the DroneBot video that discusses the WifiManager. I am unable to find any code examples that show me how to implement a webpage. I am wanting to allow users to connect to to their wifi without entering a password. In otherwords I do not want to hard code a wifi SSID and password.

Ron Penrose


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

Posted by: @ronpenrose

I am trying to figure out how to display an HTML page after implementing AugoConnect using WiFiManager. I am using the code from the DroneBot video that discusses the WifiManager. I am unable to find any code examples that show me how to implement a webpage. I am wanting to allow users to connect to to their wifi without entering a password. In otherwords I do not want to hard code a wifi SSID and password.

If you just want them to be able to connect with the AP, that much is built into the WiFiManager, but if you want more then a course on HTML may be in order. I don;t think Bill has ever done a video on that and I have never done any either.Β 

Perhaps if you could explain why the WiFiManager isn't doing what you want maybe we can offer more assistance.

Β 

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: 7641
 

@ronpenrose Bill did a video on WiFiManager, it is at HERE Β and the accompanying article is at HERE

EDIT: OOPS, I see that maybe you already studied that, in which case I do not know what it is you need. No password is simple (Bill explained it), but if you don't want them supplying SSID then you will need to hardcode that to whatever the one and only router they will be connecting to.

Β 

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
Inq
 Inq
(@inq)
Member
Joined: 3 years ago
Posts: 1904
 

Are you under the impression the WiFiManager serves web pages?Β  It is my understanding it only exposes its custom pages for you to enter SSID/Passwords and storage of those on the EEPROM or Flash depending on MPU you're working with.Β  It is not a full featured web server.Β Β 

It might be possible to poke around in WiFiManager's code base and modify the custom page to your goals.Β  Otherwise, you'll need to build your own webserver and build custom pages either in code or offload them to a file system like LittleFS.Β  Searching on-line for "web server on xxxx"Β  where xxxx is your MPU of choice and you'll find dozens of tutorials.

Posted by: @ronpenrose

I am wanting to allow users to connect to to their wifi without entering a password. In otherwords I do not want to hard code a wifi SSID and password.

I'm not sure I understand these two sentences.Β  You can either hardcode the SSID/Password or you can let users key it in.Β  Are you're trying to implement WPS?Β  I don't see where WiFiManager has that feature working.Β  Besides, WPS is not secure anymore and to my knowledge, its being phased out and not replaced.Β  Too much hacking risk with it.Β Β 

VBR,

Inq

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
ReplyQuote
ronpenrose
(@ronpenrose)
Member
Joined: 2 years ago
Posts: 27
Topic starter  

This is to clarify my Post. Based on commentsΒ 

I have watched Bill's WiFiManager video and have implemented the code he presented.

I have developed a WebServer web app which is a BBQ Smoker Controller. It works fine but currently depends on operating on my wirless connection that has the SSID and Password hard coded in the web app code but I want to get away from the hard coded so other users can use the web app.

Using WiFiManager to create the AaccessPoint, how can I implement the WebApp.

Hope this provides better clarity to my question.

Ron Penrose


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

@ronpenrose Ok, still confusing. At one point you say you have developed a WebServer that runs on your Android phone (can't be iPhone as getting an app approved is a very tedious and lengthy process if it is ever approved)

You mention WiFiMgr which is designed to eliminate hard coded creds, how can both of your statements be true?

Start over naming the physical hardware component and what software is running on it.Β 

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
Inq
 Inq
(@inq)
Member
Joined: 3 years ago
Posts: 1904
 

Posted by: @ronpenrose

This is to clarify my Post. Based on commentsΒ 

I have watched Bill's WiFiManager video and have implemented the code he presented.

I have developed a WebServer web app which is a BBQ Smoker Controller. It works fine but currently depends on operating on my wirless connection that has the SSID and Password hard coded in the web app code but I want to get away from the hard coded so other users can use the web app.

Using WiFiManager to create the AaccessPoint, how can I implement the WebApp.

Hope this provides better clarity to my question.

You need to give more facts before anyone can possibly help you.Β  You have not specified:

  • What MPUΒ Β 
  • You say you have a web server working (using hard code SSID/PW)
    • you wrote every bit of it from scratch (I have done this)
    • you used some library that does the full web server (I have done this too)
    • you used the Arduino Core WiFi library pieces to build it.Β  (I have done this too)
    • you used other 3rd party libraries pieces to build it like ESPAsyncWebServer.Β  (I have done this too)
  • You have then said you have implemented Bill WiFiManager code... presumably in a stand-alone project per Bill's video.Β Β 
    • you didn't say whether it is working.
    • you didn't say if you tried to merge the two projects
    • you didn't say what error messages you're getting
    • you didn't say what bad/strange behavior you're getting.

I see from a quick Internet search, people had trouble getting WiFiManager to work with other Web Server libraries or pieces of libraries.Β  I do not know if that has been fixed as I don't use either WiFiManager and/or other libraries any more.Β  I wrote my own that does both and a lot more from scratch on top of Espressif ESP8266 raw routines.Β 

The point being... I am very familiar with what you're trying to achieve, but not with the pieces you're using (especially the ones you haven't specified).

Be glad to help if you'd give something to go on.

VBR,

Inq

PS.Β  I have not subscribed to your thread.Β  I will not get notified if you don't specifically note me in your post.Β Β 

Β 

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


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

@ronpenrose Perhaps if I give a hypothetical example it will help.

I want to use a smartphone to use its web browser to connect to an AP on an ESP32 (or some other MPU) running WiFiMgr. No password is needed, but they will have to pick an SSID from a list.

That completes the technical connection from the phone to ESP32, but if you want to run some web app after that, you will need to put a web server on the ESP32 (free samples in the IDE) and then add some HTML code to manage whatever user interaction you imagine. If you are not conversant in HTML, then you will either need to take a course, hire a web developer or convince somebody here to work for free.

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
ronpenrose
(@ronpenrose)
Member
Joined: 2 years ago
Posts: 27
Topic starter  

@zander I may be missing something but here did I say built a webserver app on iPhone?

I coded the a webserver web app using html that runs on the ESP32. From my computer or iPhone I get to the wenpage with the IP address of the ESP. Just like you would with any webserver web page.

Ron Penrose


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

@ronpenrose My apologies, I totally misread your post.

If you have an esp32 webapp, just follow Bill's suggestions on how to convert that to use WiFiMgr. I keep that code as a model in one of my folders. In the video the instructions start at 23:59 and in the article it is section 5 in the TOC. I have attached pics to be sure.

Screenshot 2023 11 13 at 09.32.38
Screenshot 2023 11 13 at 09.32.13

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
ronpenrose
(@ronpenrose)
Member
Joined: 2 years ago
Posts: 27
Topic starter  

@zander Bingo! Thanks much. That should get me going.Β 

Ron

Ron Penrose


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

@ronpenrose Great to hear.

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
ronpenrose
(@ronpenrose)
Member
Joined: 2 years ago
Posts: 27
Topic starter  

@zanderΒ 

Okay, I modified code of a simple LED control web page to use WiFiManager.

After uploading then went to iPhone and connected to the AP, I was able to get the webpage just fine. All worked well.Β 

However subsequent attempts result in no internet connection.

  • I have attached he ino code file.Β 
  • I have also attached the Serial output.
  • Also attached is screenshot of the webpage on the iPone when it worked first time
iPhone LED Webpage

Ron Penrose


   
ReplyQuote
ronpenrose
(@ronpenrose)
Member
Joined: 2 years ago
Posts: 27
Topic starter  

@zanderΒ 

One other note on previous post. Attempting to connect to the AP I get message not connected to internet. The first attempt that worked, showed me connected.

Ron Penrose


   
ReplyQuote
ronpenrose
(@ronpenrose)
Member
Joined: 2 years ago
Posts: 27
Topic starter  

@zanderΒ 

I reinstalled WiFiManager and it now repeatedly is working. Does not make sense to me but will keep an eye on it.

Thanks much.

Ron Penrose


   
ReplyQuote
Page 1 / 2