Notifications
Clear all

WiFiMnager-Integrating WebServer Code

21 Posts
3 Users
1 Likes
878 Views
ronpenrose
(@ronpenrose)
Member
Joined: 1 year ago
Posts: 25
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: 3 years ago
Posts: 6981
 

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.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


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

@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.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Inq
 Inq
(@inq)
Member
Joined: 2 years ago
Posts: 1900
 

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: 1 year ago
Posts: 25
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: 3 years ago
Posts: 6981
 

@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.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Inq
 Inq
(@inq)
Member
Joined: 2 years ago
Posts: 1900
 

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: 3 years ago
Posts: 6981
 

@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.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
ronpenrose
(@ronpenrose)
Member
Joined: 1 year ago
Posts: 25
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: 3 years ago
Posts: 6981
 

@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.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
ronpenrose
(@ronpenrose)
Member
Joined: 1 year ago
Posts: 25
Topic starter  

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

Ron

Ron Penrose


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

@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.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
ronpenrose
(@ronpenrose)
Member
Joined: 1 year ago
Posts: 25
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: 1 year ago
Posts: 25
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: 1 year ago
Posts: 25
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