Control an LED (or anything connected to a GPIO pin on your Arduino ESP 8266) from a website. This turns your ESP into a server, which hosts a website to receive user input.
- ESP8266 First Web Server
- Control ESP8266 Over the Internet (from Anywhere)
- ESP8266: Get MAC address
- Not Sure What Your Router's Public IP Is?
The hardest part of this whole project was making it publicly viewable to the rest of the internet. It's quite easy to host it on your local network.
In order to get the rest of the internet to see your website on your ESP 8266 you'll need to tell your router to always assign a specific IP Address to your ESP 8266. This is due to how routers occassionally will need to switch IP addresses of a device. Bind the MAC Address of your Arduino to an IP address of your choosing. For this step you'll need to look at some tutorials for your specific router.
You'll also need to figure out how to make a device on your local network public to the rest of the internet. Every router has different steps to achieve this.
You don't actually need a domain name. You could just point people to an IP address such as: http://69.172.169.8:801
69.172.169.8
is the public IP address for my router.
801
is the port I specified in the Arduino sketch.
However, it is cleaner if you have a domain name. I recommend Name Cheap for buying a domain name.
Once you have a domain you'll need to point it to the public IPaddress:port
It is not good practice to store your WiFi Password in plaintext like it is shown in the Sketch, but this is another whole topic. You can look up separate tutorials on Arduino server security.