B4R Tutorial ESP8266 - WiFi Remote Configuration

Edit: A simpler and more powerful tool is available: https://www.b4x.com/android/forum/threads/esp-configurator-based-on-b4rserializator.81452/

The attached project allows the user to configure the ESP8266 WiFi settings (SSID and password).

When the program starts it does several things:
1. Creates an access point named 'esp'.
2. Creates a WiFiServerSocket that listens on port 80.
3. Tries to connect to a network based on the last settings stored in the EEPROM (if such are available).

The ip address of the device in the esp network is known. It is
This means that we can connect to the esp network and then access the board with this ip address from any browser.

The server accepts two requests: - Shows the current status<ssid>/<password> - Sets the new ssid and password. Note that the password is optional.

Examples: (2)/12345678

The SSID and password are stored in the EEPROM so the values are kept after a restart.

Note that the #StackBufferSize attribute is set to 600 as the string related methods require a larger stack buffer.


  • ESP8266WiFiRemote.zip
    2.6 KB · Views: 5,058
Last edited:

Peter Simpson

Licensed User
Longtime User
I will prepare an example of using a B4J app with B4RSerializator (which can be easily converted to B4A or B4i) to configure the ESP8266.

It would probably be a good idea to also include the device name @Erel, you know for multiple devices.

I've already adjusted your original code to cater for the above MQTT request through a browser (but with a device name), but I need to rewrite it all as my coding for those particular routines are so messy that even I have problems reading what my own code is suppose to be doing. My code works fine but I'm not happy with it, actually I'm pretty disgusted with my coding that adds setting up an MQTT broker details through a browser to your original code and also the device name.

No it's not very often that I'll admit to messy terrible looking code, but this one time I will sadly do so :(
Last edited:


Licensed User
Longtime User
I know exactly what you feel... I have a tendency to (re)start projects over and over again because I'm not happy with the coding!