Internet connected devices and web pages residing in a home computer needs a static (stable) IP address to allow access from a remote location.
ISPs will provide a static IP address at an additional cost.
An alternative is to use a Dynamic Domain Name Server (DDNS) service to associate a chosen domain name to an IP address.
A dynamic IP address provided by a router’s DHCP function can be used with a DDNS if you can maintain / update the DDNS entry with the current IP address.
Here’s how to do this with an Arduino and a web pgrogram (HTML/PHP).
- Write an Arduino sketch to query a web page periodically. Do not flood the website with queries. Once every 15 minutes is sufficient.
- Write a web page (PHP/HTML program)
- Receive the query
- Capture the remote IP address
- Compare it to the last captured IP address saved in a file.
- if equal:
- write the IP address to the last IP address file
- exit.
- If not equal:,
- write the IP address and current to the last IP address file.
- update the DDNS service with the new IP address and associated domain name.
- exit.
- if equal:
- (Optional) Write a web page to query the last IP address file and display the latest IP address and date/time changed.
Note: to prevent unintentional updates to the DDNS; add a parameter to the URL and check it for validity. Ignore and exit if not valid.
ex: http://myhost.net/ddns-synch.php? youare=forsure