“Important: you need to let your computer on and running ngrok in order to maintain the tunnel online.”
What is the purpose of accessing from anywhere if we have to on the computer and run ngrok in order to be online?
Isn’t there any other way?
Hello Joel, there are three methods to access the ESP from anywhere:
- Using ngrok or a similar secure tunnel service
- Connect your ESP to a free/paid cloud service (Blynk.cc, AdafruitIO, MyDevices, etc)
- Do router port forwarding (not secure)
I recommend using ngrok.com, because it’s more secure than port forwarding and you have full control.
I usually recommend for permanent solutions using ngrok running on a Raspberry Pi (the Raspberry Pi could also run Home Assistant, Node-RED, store a database, etc).
Yes, you just need to follow these instructions:
1. After creating your account, login and go to the “Auth” tab to find Your Tunnel Authtoken. Copy your unique Your Tunnel Authtoken to a safe place.
2. To install ngrok in the RPi, you need to have an SSH communication established with your Raspberry Pi. Type the following command to download the latest version of ngrok software:
pi@raspberry:~ $ wget http://randomnerdtutorials.com/ngrokARM
Unzip the ngrok software using:
pi@raspberry:~ $ unzip ngrokARM
3. After that, run the following command to run ngrok (replace the highlighted text with your own Tunnel Authtoken and ESP IP address):
pi@raspberry:~ $ ./ngrok tcp 192.168.1.70:8888 --authtoken 3V1MfHcNMD9rhBizf8TRs_2whamY91tqX4
4. You can access your web server from anywhere in the world by typing your unique URL (for example http://0.tcp.ngrok.io:54626/) in a browser.