ESP8266 Async Web Server With Port Forwarding

"The ESP8266 is a affordable development board the combines control of outputs, inputs and wificapabilities."

Good tutorials: https://randomnerdtutorials.com/projects-esp8266/

With Arduino programming, it's easy to add input sensors and output relays readily controllable through WIfi and apps.

Lets make an ESP8266 AsyncWebServer that serves up a webpage and forward it for access outside your home.


Have a ESP8266 loaded with Ardino programming capability and an Arduino programming app installed on your computer. Link


Download and unzip these files to your Arduino/libraries folder.

Github’s asynchronous TCP library: ESPAsyncTCP

HTTP and WebSocket Server ESPAsyncWebServer

File Wrapper ESP8266 File Wrapper

Open a new Arduino project and write, copy or adapt a code.

Here's a code that connects a ESP8266 to a router and serves up an internet web page. Replace the network credentials with you desired wireless network credentials and desired port#.

Basic web connect code. Now connect some sensors to monitor, or devices to control!

Reserve a port. Note your ESP8266 Host and MAC address

Start the Arduino Tools/Serial Monitor and push the reset button on the ESP8266. Note the host name and MAC address on the readout.

Enter that IP address in your browser address bar and view your webpage.

Reserve an IP

Logon to your router/gateway as admin and find your connected devices.

Note: The following examples are a comcast gateway, other router/gateways are similar.

Assign your device a desired fixed address.

If you would like to view away from home: Forward the Port

Find the Port Forwarding on your router and add a Port Forward.

Find out your routers IP address.

Internet Browse for “What’s my IPv4” from home, or look on your gateway data page.

Unless you are paying for a fixed IP, this address may change intermittently. Alternatively setup a DDNS server.

Now to view your webpage at home or at work, enter ipaddress:port#

ESP8266 myFishtank Sample Project

An ESP8266 provides a standalone webserver that measures and displays the temperature and PH using the Arduino IDE, a DS1826 OneWire underwater sensor, and a PH probe.