Android APP to send commands to ESP8266

I am a retiree who has discovered Arduino for two months, I also have a degree in electronics, I know very well electronic components and integrated circuits. With Arduino I realized the automation of a model of electric trains. My experiences with Arduino are visible at these links: How to use Oled to display temperature and humidity using Arduino - YouTube This video shows how to use an oled display to display an appropriate sensor, temperature and humidity How to transfer strings between two Arduinos Come trasferire stringhe tra due Arduino - YouTube This video shows how strings of data can be transferred between two Arduinos Data transmission with Arduino via RS232 Trasmissione dati con Arduino via RS232 - YouTube This video shows how a basic program on a PC can send data to Arduino via RS232 I purchased the esp8266 esp-12f WIFI module which works perfectly, executes the commands sent via browser both from the PC and from the mobile phone when they are connected via WIFI. My current request is to be able to send commands to ESP8266 via mobile phone when I'm not connected via WIFI, but I'm away from home. I would like to know how I can create an APP on the mobile that allows me to send data to the WIFI module. Thank you in advance if you have any suggestions.

A simpler solution might be to get the esp to act as an Access Point (AP) when it cannot connect to your home wi-fi. Then you can connect your phone directly to its wi-fi and access the page(s) in the normal way.

Thanks for your suggestion, unfortunately it is not clear to me, could you give me some other indications. Currently from my mobile phone when it is connected via wifi I send the commands in this way:
"192.168.1.88/on" to turn on the led
"192.168.1.88/off" to turn off the led
In what other way could I do. Thanks so much

There are many ways to do this. Have you tried searching for ESP8266 on the Play store? I believe there are already apps created just for this purpose, and they provide the code for you to modify on your ESP8266 to custom to your needs.

Another way is to search for "http request" apps. This is probably the simplest way. You can basically input your own http request in the app, and control your ESP8266 from it, or a widget. But you won't get status feedback/update on your LED.

But the first order of things, assuming you don't have static IP, is you need to get a DDNS service. It basically gives you a fixed domain name to connect back to your home network, instead of an IP address. There are free services online which you could use that provide this. You also need a router that supports the service, or a computer/device that supports it.

Thanks for the suggestion, I downloaded the "Smart Remote ESP8266" APP, it works perfectly if the mobile phone is connected to my WIFI, the address of my HTTP server is 192.168.1.148 which is active on the esp8266 esp-12f board made with a sketch Arduino, turns the LED on and off. If I disconnect the mobile from my WIFI the "Smart Remote ESP8266" does not send anything to the esp8266 esp-12f card. I also have a static IP example: 2.229.xxx.xxx, I tried to configure the "Smart Remote ESP8266" with this address, but the program on the esp8266 esp-12f board does not receive any command. What can I do. Thanks so much

If you are sure you already have static IP, meaning IP address that does not change overtime, then you won't need to use a DDNS service. The reason why it isn't working, is because port forwarding on your router hasn't been configured yet. What it actually does is to redirect traffic on an external(internet) port, to an internal IP and port. You need to login into your Wifi router's interface to do so.

For example, you can use say a random port number 52142 externally, and map that port number to your ESP8266's IP address, and port 80(http). So instead of typing "http://192.168.1.88/on" while you are on Wifi, you type "http://2.229.xxx.xxx:52142/on" instead on a mobile network.

I have a static IP, changed my router and assigned random port number 52142 to my ESP8266 card as you suggested. I typed "http://2.229.xxx.xxx:52142/on" and "http://2.229.xxx.xxx:52142/off", unfortunately both commands are not received. If you have any other indication, it is certainly welcome. Many thanks.

Have you also used the ESP8266e card and are you able to send commands from the mobile phone not connected via WIFI? If so, which APP on the mobile phone you used. Thanks and greetings from Italy

Perhaps you could post a screenshot of your port forwarding configuration. Yes, I have more than a dozen ESP8266s running, which have no trouble receiving data from the internet. I'm using my own self-written Android app. I'm not sure if you have tried "http://2.229.xxx.xxx:52142/on" using a browser on your phone, when you are connected to a mobile network. If not, try that first to confirm the issue does not lie with the app.

If your ESP8266 is already working fine with commands from your browser in your internal network, and you are already certain you have static IP, the issue most likely lies with your port forwarding configuration.

Thanks again for your suggestions, I did the test you suggested again, unfortunately I can't get my HTTP server to work using ESP8266. I used the command "http://2.229.xxx.xxx:52142/on" on my mobile browser but it doesn't work. I have a static IP, I think the problem is with my router not configured correctly like yours.

Which was why I suggested posting a screenshot of your port forwarding configuration here.

What steps should I take to get the screenshot of my port forwarding configuration ?
Thanks in advance

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