Skip to content
Home » Articles » Remote access to ESP32

Remote access to ESP32

  • by

Below is one way to set up remote access to Samovar. All the settings can be done in a couple of minutes.

Warning icon — safety precautionsNote: This method is easy to implement, but it has one limitation: to connect remotely this way you will need a computer that stays powered on. Any low-power computer will do, for example, you can run it on Raspberry Pi.

To create a tunnel to ESP32, you can use the free service ngrok.

Go to https://ngrok.com to create an account. Click the “Sign up” button.

A form will open – fill in your details.

Once the account is created, log in and go to the “Your Authtoken” section. Copy the string from the “Your Authtoken”  field to a safe place (we will need it later).

The token looks something like this: 69X1SnMSGqAz6qo9qDtHo_7hMsUHSb8tXCQaWQvzE5J

Installing ngrok

Go to the navigation panel and select the “Setup & Installation” tab.

Choose the ngrok version for your operating system and download it.

Running ngrok

Unpack the archive.

Now enter the command below in a terminal window, but replace the SAMOVAR_IP_ADDRESS and YOUR_TUNNEL_TOKEN parts with the IP address of Samovar and your ngrok tunnel authentication token:

ngrok tcp SAMOVAR_IP_ADDRESS:80 –authtoken YOUR_TUNNEL_TOKEN

If you use Windows:

ngrok tcp 192.168.1.11:80 –authtoken 69X1SnMSGqAz6qo9qDtHo_7hMsUHSb8tXCQaWQvzE5J

If you use Linux:

./ngrok tcp 192.168.1.11:80 –authtoken 69X1SnMSGqAz6qo9qDtHo_7hMsUHSb8tXCQaWQvzE5J

If everything was done correctly, the “Tunnel Status” field should show the value “online”, and the “Forwarding” field should show a URL.

Accessing the web server from anywhere in the world

Now for the most interesting part – accessing the web server from anywhere on the planet. To do this, type the URL into your browser. Mine is “http://0.tcp.ngrok.io:14626”, but yours will be different.

Warning icon — safety precautionsImportant: For the tunnel to stay “online”, your computer must stay powered on, and the ngrok application must be running on it.

Troubleshooting: If you followed the ngrok link and nothing happened, open the IP address of your ESP32 in a browser to check whether Samovar is working. If it is, make sure you entered the correct IP address and authentication token in the ngrok command above.

Warning icon — safety precautionsImportant: When you access the web server you will always be asked for the username and password you registered with on ngrok, so unauthorized access to your device is practically impossible.

Now you can control Samovar remotely!

Leave a Reply