running ESP8266 in AP and station mode together with webserver

Hi, my requirement is to use ESP8266 for fetching data from a website. this ESP8266 has to work on different physical loactions. Each location will have a different WI-FI SSID and password for connecting to internet.

therefore there is a requirement to change the WI-FI SSID and password using a webserver based client. user can change anytime the id and password from the webserver client.

I have decided to use the ESP8266 in AP and station mode together. so that both webserver and HTTP can work together.
individually both the codes work but when I combine them together WI-FI connection (AP mode) gets unstable and some time it opens the web page for changing the SSID and password and some times not. basically WI-FI connections gets disconnected.
has any used this type of application? if yes any hints or reference code can be provided?

You want to transport the same ESP8266 device between a number of locations. Each location has its own WLAN with a different WLAN/Password.

You are using the web server running on the ESP8266 (AP mode) purely to enter the credentials for the current WLAN. Once the WLAN credentials have been configured, the ESP8266 simply then fetches/sends data to/from (say) the internet. Is that all correct ?.

That is quite common and should all work. I have a number of examples, including clocks, which do this.
AP mode is needed to configure the clock, via its own web server, with things like Wlan credentials, NTP server, timezone etc. Once it has been configured, I can further update it via a PC browser via the WLAN and the device can update itself from internet based NTP servers.

Here is one example: https://forum.arduino.cc/index.php?topic=559652.0

thanks, You understood the requirement properly. Let me go through this document and code then I will get back to you.

You can also look at the wifimanager library for the ESP which appears to be doing what you are looking for, but won't keep the web server active after initial configuration.

By the way, if you want to run AP+station and a web server don't try https or you will run into memory issues and unpredictable crashes.

HI 6v6gt , I am trying to compile the example: https://forum.arduino.cc/index.php?topic=559652.0
there is a issue with LCD - in compiling, for the time being I have disabled all the display references, but now there is some issue with the WI-FI UDP.

Error I am getting is "cannot declare variable 'udp' to be of abstract type 'WiFiUDP'" I have tried many things which are mentioned on net, but this is not getting solved.

I am still working to solve it, it may take some time, if you have any hint for this do let me know.

hi wvmarle, thanks for the input, I will try that too.

chandupneja:
HI 6v6gt , I am trying to compile the example: https://forum.arduino.cc/index.php?topic=559652.0
there is a issue with LCD - in compiling, for the time being I have disabled all the display references, but now there is some issue with the WI-FI UDP.

Error I am getting is "cannot declare variable 'udp' to be of abstract type 'WiFiUDP'" I have tried many things which are mentioned on net, but this is not getting solved.

I am still working to solve it, it may take some time, if you have any hint for this do let me know.

This works correctly with release 2.4.0 of the Arduino ESP8266 core. You can change the release level in the Arduino IDE board manager. It does compile under the the latest core release (2.7.4) but there is then an issue with the audio part which I still have to fix.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.