B4R Tutorial ESP Configurator based on B4RSerializator

Discussion in 'B4R Tutorials' started by Erel, Jul 9, 2017.

  1. Erel

    Erel Administrator Staff Member Licensed User


    This tool replaces the browser based solution (https://www.b4x.com/android/forum/threads/esp8266-wifi-remote-configuration.68596/). It is simpler and much more powerful.

    B4RSerializator, which converts objects to bytes and vice versa, is used for the communication with the B4J app and to save the settings in the EEPROM. B4RSerializator is also compatible with B4A and B4i so you can also create a mobile app.

    In this specific example the data includes MQTT related settings. It should be simple to change it to store other fields. Just make sure to set the field types correctly.

    If the ESP is not connected to the local network then you should connect the PC to the ESP access point and set the ip address to, which is the default ip.
    If it is connected to the network and you know its ip address then you can use it instead. The ESP local ip is printed in the logs.

    Now click on Get to get the stored parameters or click on Set to send the parameters to the board.
    In this example it is configured to connect to the network and then connect to a MQTT broker.

    Note that the Get and Set features start a new connection and close it when done. This is a simpler and safer approach compared to maintaining a continuous connection.

    Attached Files:

    ocalle, f0raster0, JordiCP and 9 others like this.
  2. inakigarm

    inakigarm Well-Known Member Licensed User

    rbghongade likes this.
  3. Peter Simpson

    Peter Simpson Expert Licensed User

    This is absolutely brilliant @Erel, I'll test it later when I'm back home from my bike ride. I'm about 28 miles away from my home and having a quick 10 minutes rest before heading back :)

    I'm thinking about attempting to modify your code so that I can also set subjects through the B4J app separated by commas, "sub1, sub2, sub3" etc. I'm not sure if it possible but nevertheless I'll attempt it.

    Thank you again @Erel, great work as usual...
    Cableguy likes this.
  4. rbghongade

    rbghongade Active Member Licensed User

    Fantastic! Erel. Just checked the code and it works flawlessly on Wemos D1 R2. Erel is a genius!
    This feature overcomes the greatest difficulty of connecting the sensor node at customer premises.
  5. Erel

    Erel Administrator Staff Member Licensed User

    It is possible, but it is better to update the Record type and add more fields. This way you will not need to parse the stored data.
    Peter Simpson likes this.
  6. Peter Simpson

    Peter Simpson Expert Licensed User

    Thank you Erel and btw great work as usual :)
    Johan Hormaza likes this.
  7. Johan Hormaza

    Johan Hormaza Active Member Licensed User

    Incredible, extraordinary. God bless you @Erel !
  8. viriato

    viriato Member Licensed User

    Is this example valid also for ESP-32 ?

    Johan Hormaza likes this.
  9. Erel

    Erel Administrator Staff Member Licensed User

  10. Hanspeter

    Hanspeter New Member Licensed User

    Isn't lovely when your meal is cooked for you?
  11. Johan Hormaza

    Johan Hormaza Active Member Licensed User

    That's right, and I'm very grateful for Erel.
  12. ma7tin

    ma7tin Member Licensed User

    Hi guys, what might be a reason for - Failed to connect .. message in ESP Configurator
    My module is in my local network when I ping it .. but cannot GET any information when I try to use B4J ESP Configurator.
    Module is connected to external 3.3V power supply not to PC USB, doesnot work either cases.
    Any ideas ?
  13. Erel

    Erel Administrator Staff Member Licensed User

    You are running the B4R program on the ESP board, right? Are there any messages in B4R logs?
  14. ma7tin

    ma7tin Member Licensed User

    I did basic IP and password setup on NodeMCU ESP8266 12-E board using B4R ESP Configurator.
    Log was AP-1 and IP: so I've use android phone to setup IP to my local network using ../set/SSID/password.
    Than I try to use B4J ESP Configurator to read/write info from board but not succedd with connection as I finished with - Failed to connect - message.
  15. Johan Hormaza

    Johan Hormaza Active Member Licensed User

    [QUOTE = "ma7tin, post: 545943, member: 94014"] Hice la configuración básica de IP y contraseña en la placa NodeMCU ESP8266 12-E usando B4R ESP Configurator.
    El registro fue AP-1 e IP:, así que he usado el teléfono Android para configurar el IP en mi red local usando ../set/SSID/password.
    Luego, trato de usar el Configurador ESP4 de B4J para leer / escribir información de la placa, pero no tuve éxito con la conexión, ya que terminé con - No se pudo conectar - Mensaje. [/ QUOTE]
    Lo que tienes que hacer es conectar tu computadora al punto de acceso de la red WIFI ("esp") y listo.

  16. Erel

    Erel Administrator Staff Member Licensed User

    It seems like you are running the old http based configurator. You should run the B4R program attached to the first post.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice