B4R Question ESP8266 . How starting project? Help.

jvrh_1

Active Member
Licensed User
Good afternoon, I would like starting a new project with a board: "Fafeicy ESP8266 10A WIFI ESP-01S DC 5V". Link below.

I have used B4A and B4J in several Apps for private and commercial usages. However, I have never used B4X and I am confused. I have also used "Cebek" boards with relays but without programming.

My question is linked to know if is possible to make an App for management the board from an android phone sending the order to activate or turn off the relay of this board. I’ve been researching on the forum and it looks like that B4X is compatible with the ESP8266 micro, but I’ve never used it. I don’t know to start.

Would I have to do the App with B4A for the phone interface, and to develop something with B4X for the board or… is it all done with B4X? Can it be done without using any broker type "mosquitto mqtt broker"? I want to communicate directly with the board because I always will be in the same wifi network (I don’t want to handle it from outside my Lan).

I’m waiting for your help to start the project. I wish know some references, examples or codes with the same boad of this type to get started it. Thank you very much. Have a good day.

 

mcqueccu

Well-Known Member
Licensed User
Longtime User
The language is B4X and so far as you have developed for B4A and B4J for a long time, simply you have been programming in B4X.

For Arduino (ESP8266) you need B4R IDE. Start from there and make sure the board is communicating and run some few simple examples.
 
Upvote 0

XorAndOr

Active Member
Licensed User
Longtime User
Upvote 0

jvrh_1

Active Member
Licensed User
Thanks you for you help.
I am reading the "B4RExampleProjectsV2_4" and the documents says "The biggest difference is that there is no user interface in B4R". I want to to develop an app for my Android mobile to switch on or switch off the relevator of the ESP01 board. So, If B4R has not got any grafic interface, How can I do this app? with B4A? I can not understand.
Thanks again.
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
You would create the interface on the android phone, this would communicate with the esp board via wifi to send the turn on / turn off commands. The B4R program would listen for your instruction, via wifi, then act on the pins to either enable are disable the relay.
 
Upvote 0

jvrh_1

Active Member
Licensed User
You would create the interface on the android phone, this would communicate with the esp board via wifi to send the turn on / turn off commands. The B4R program would listen for your instruction, via wifi, then act on the pins to either enable are disable the relay.
Perfect,
The interface on the android phone would be develop with B4A at this case?
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
Yes you would use B4A for the phone side, incorporating all the fancy graphics you want to control the esp.

(It's just like the wifi bulbs you get, the phone has the user friendly interface, the bulb has no display and just works on what you tell it to do)
 
Upvote 0

jvrh_1

Active Member
Licensed User
Yes you would use B4A for the phone side, incorporating all the fancy graphics you want to control the esp.

(It's just like the wifi bulbs you get, the phone has the user friendly interface, the bulb has no display and just works on what you tell it to do)
Are there any examples of how to do this? I have reviewed : "https://www.b4x.com/android/forum/threads/esp-01-with-relay.98984/#post-623394" and only B4R appears. How do I connect B4A with B4R? Some expample?. I want to do same simple. Switch on or Switch off the relevator using my android phone.
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
(At the edge of my knowledge here so I could be talking rubbish)

On the esp you would either connect to an existing wifi or run as hotspot. You would have a server running on the esp that listens for connections, and handles commands you send it.

On the android, you would have a wifi client running connect to the esp ip address and send the commands.

Beyond that you need someone with better knowledge to help.

Search the forum for "Getting started with esp8266" - Erel has an example of the esp talking to a B4J app - you would just use B4A in place of B4J (I guess).
 
Upvote 0

XorAndOr

Active Member
Licensed User
Longtime User
I want to do same simple. Switch on or Switch off the relevator using my android phone.
Creating an android app that commands an esp8266 isn't a big problem...
the real problem is your esp-01s which is very limited in terms of hardware
and also because it is assembled with a built-in relay, so you have to detach it from the slot and use a USB Serial Programmer to program it.
While there are esp8266 with built-in usb that you can program it easily, and also you have more pins as input-output.
I don't want to demoralize you with this, but it can also be done with your esp-01, you should have some knowledge on how to program an esp-01s,
since it doesn't have a built-in usb.
 
Upvote 0

jvrh_1

Active Member
Licensed User
(At the edge of my knowledge here so I could be talking rubbish)

On the esp you would either connect to an existing wifi or run as hotspot. You would have a server running on the esp that listens for connections, and handles commands you send it.

On the android, you would have a wifi client running connect to the esp ip address and send the commands.

Beyond that you need someone with better knowledge to help.

Search the forum for "Getting started with esp8266" - Erel has an example of the esp talking to a B4J app - you would just use B4A in place of B4J (I guess).
Thanks for you help.
 
Upvote 0

jvrh_1

Active Member
Licensed User
Crear una aplicación de Android que comande un esp8266 no es un gran problema...
el problema real es su esp-01s que es muy limitado en términos de hardware
y también porque va montado con un relé incorporado, por lo que hay que desmontarlo de la ranura y utilizar un Programador USB Serial para programarlo.
Si bien hay esp8266 con usb incorporado que puede programarlo fácilmente, y también tiene más pines como entrada-salida.
No quiero desmoralizarte con esto, pero también se puede hacer con tu esp-01, debes tener algunos conocimientos sobre cómo programar un esp-01s,
ya que no tiene un usb incorporado.
I haven't yet the board. I ask because I do not know which is the most adecuated board for this project (a board with a relevator that I can activated this using my custome android device, both of them in the same wifi). I want to start with this languaje and envioronment so I am asking advice. I already installed arduino and b4r and I have read some tutorials and information, but I am starting. Now I have to buy the board. Which board could be the most adecuated for this?. Thanks a lot.
 
Last edited:
Upvote 0

josejad

Expert
Licensed User
Longtime User
Please, take a look to this project, it has a B4A project that communicate with B4R through MQTT

 
Upvote 0

jvrh_1

Active Member
Licensed User
Thanks a lot!. I have reading the code and I think that I understand the B4R and B4A app, but I have two questions:

1- I want to use the board in the same local wifi in which my mobile phone is, so... Can I comunicate with the board without using mosquitto or another broker?. It is to say, directly (without internet conection).

2- In the B4R, I have to pass the ssid and password wifi writing in the code of B4R directly. Is there any way to pass this data using another interactive method. For example: Can I pass this data using the B4A app directly making a previus conection using Bluethoot conection?.

Your help is very important to me and I appreciate the time you take to help. I believe that this board can be the most apropiated to my project. Thanks.
 
Upvote 0

jvrh_1

Active Member
Licensed User
Please, take a look to this project, it has a B4A project that communicate with B4R through MQTT

Increíble proyecto. Veo que eres de Sevilla. Un fuerte abrazo. Te escribo en castellano porque es bastante más sencillo para mi ya que a la dificultad de comenzar a investigar sobre este tema, se suma que mi nivel de inglés no es del todo fluido. El proyecto es completísimo y bastante complejo para mi todavía. Enhorabuena. ¡Qué envidia me das!. El otro proyecto que ha referido XorAndOr es algo más asequible para el nivel en el que me encuentro ahora mismo y creo que lo entiendo bastante bien. Sin embargo, tengo las dos dudas que le expongo:
1- ¿No es posible hacer la comunicación B4A vs placa sin usar un Broker como mosquitto o cualquier otro?. La idea es que siempre estén en la misma red local y no necesito que ninguno salga fuera de la lan.
2- Según el código de ese proyecto, se tiene que pasar la configuración de la wifi (ssid y pwd) a la placa usando el propio código de B4R. Mi intención es que pueda llevarme esta placa a otras ubicaciones con otras redes y pueda conectar la placa a otros SSID sin tener que compilar el programa en ella usando B4R todo el rato. Es decir, ¿No podría pasar estos parámetros a través de B4A directamente?. Para ello podría usar otro método de conexión inicial entre el teléfono y el circuito como por ejemplo usando Bluethoot para pasarle la red.
Mil gracias por el tiempo que me estáis dedicando. Tengo gran ilusión y siempre me ha llamado esta parte de la programación, pero nunca había encontrado el momento para darle el primer impulso. Un saludo.
 
Upvote 0

XorAndOr

Active Member
Licensed User
Longtime User
1- I want to use the board in the same local wifi in which my mobile phone is, so... Can I comunicate with the board without using mosquitto or another broker?. It is to say, directly (without internet conection).

2- In the B4R, I have to pass the ssid and password wifi writing in the code of B4R directly. Is there any way to pass this data using another interactive method. For example: Can I pass this data using the B4A app directly making a previus conection using Bluethoot conection?.
1) Yes of course you can use the esp8266 as you like. Connected to the home router in (Station) mode, or in (Access point) mode, i.e. the phone connects to the esp card and sends the commands and then you disconnect.
2) I can't tell you in bluetooh, I prefer wifi. Maybe other users can tell you.

In my project I wanted to use MQTT because I use it even when I'm away from home, I could have used other connection methods, mqtt is very simple and functional.
 
Upvote 0

josejad

Expert
Licensed User
Longtime User
Te escribo en castellano porque es bastante más sencillo para mi ya que a la dificultad de comenzar a investigar sobre este tema, se suma que mi nivel de inglés no es del todo fluido.
Hola¡¡ Voy a contestarte en inglés ya que en esta parte del foro es el idioma en el que hay que hacerlo. Puedes hacer tus consultas en español en esta parte del foro

I've just made that project with the help of the people of the forum, and adapting the examples published in the it, so I've not too much experience with B4R or the boards.
so you have to detach it from the slot and use a USB Serial Programmer to program it.
I think this is important, if you don't need that board specifally, you should try with a board with USB and some relays.

Could I pass the parameters from B4A? ¿No podría pasar estos parámetros a través de B4A directamente?
I've never done, but you can try this example.

Without using MQTT? sin usar un Broker como mosquitto

You can run a mqtt server (broker) in your own lan. Anyway, not sure if you could send orders to the ESP using this.

 
Last edited:
Upvote 0
Top