The use of the ESP8266 in the world of IoT
User avatar
By SurtrTech
#66103 Hello,
I'm working on a project using NodeMcu v1.0, It works fine in local network using my router, the project is that I have a temperature sensor wired to the board, then I get the value on my Android App whenever I press a button (Get data...).
Now I want to be able to do this over the internet (even if my phone and my board aren't connected to the same router).
I have no idea where to start, at lease I want to be able to do it from a webpage for now.
User avatar
By Luc Volders
#66114 It is not really very complicated, but involves some steps that are router dependend so I can only give you the general outlines.

I am doing the same using ESP-Basic.
Now ESP-Basic generally uses port 80 for communication with the outside world.
So that means that any command you send to the ESP (or from the ESP) is coming from the following local IP adress


now your local IP adress is not available from the outside world.

You can only find your global ip adress.
You can find that by pointing your web-browser at:

Now you have to dig into the setting pages from your router.
Look at something calledport-forwarding.

There open a new port for the outside world.

In my router I have to give it a name. Next I give it the IP adress of the ESP and the ESP's port number which is 80.
Next I instruct it to send all communication from router port no 8081 to the ESP's port.

The router will most likely ask for a starting port number and an ending port number for your local and global ports. In both cases use the same. So Start local 80, end local 80, start global 8085 and end global 8081. You can use many numbers for 8081 but there are some restrictions. This allows you to open many specific ports for all kinds of projects.

That is it.

Now the only thing left is to instruct your app or whatever you are using to crontrol the ESP to send or get the info from:

The YYY part is off course the global internet adress

Be aware however that opening a port in your router might bring some security issuses as you are opening your router to the world.

This way I have controlled my ESP from my work or many adresses on hollidays be it from a ESP-Web-page or a dedicated App adressing the ESP.
I am devellopping my apps with MIT Appinventor which is dead-easy.

I will be publishing some stories about writing dedicated apps for your ESP on my weblog shortly.

User avatar
By SurtrTech
#66119 Hello Luc,
Thanks for the reply, but the problem is that I will be always far from the NodeMcu board, which means if the router reboots I will not know about the board IP adress, also my project is about a door lock, so if someone know the IP adress of the board and have the same app he could send a command or something to break the security.
I want something like "Blynk": the board connect to a server and have an API key then I use that key on the Blynk app to control the board from anywhere.
User avatar
By Luc Volders
#66135 Hey SurtrTech,

SurtrTech wrote:Hello Luc,
Thanks for the reply, but the problem is that I will be always far from the NodeMcu board, which means if the router reboots I will not know about the board IP adress.

If you give your ESP a static IP adress (can be done in the router) then the board will always get the same IP adress even if the router reboots.

By building your own APP you can build in any security you want.
First they will have to know your IP adress. Second they will have to know which port is open. And then they will have to know your security code which you can build in. That is 3 steps....