Anywhere Internet Access to Arduino Controls

Anywhere Internet Access to Arduino Controls
Fixing the Dynamic IP Issue

Goal: Provide internet access for any internet-enabled device, anywhere, to my Arduino based control system.

Keywords: IoT, Arduino, control system, ESP8266, nodeMCU, dynamic IP

I needed to access my Arduino control system from anywhere via cell phone, tablet or computer. I get my internet access services from a cable TV supplier. No problem there except that they provide a dynamic IP address to my cable-modem and a fixed/static IP cost more money.

Home Setup:
My cable-modem is connected to a wifi-modem servicing the house and work shop (via a wifi-extender.) The control system accesses the internet via the wifi-extender>wifi-modem>cable-modem>cable supplier>internet. My development computer access the control system via my wifi-modem’s intranet or by a direct USB-cable. But when not at home or via my cell phone’s G4 network, access is problematic due to the cable-modem’s dynamic IP issue. Fixing my dynamic IP issue is the problem solved herein.

control-sensors>Arduino(s)>ESP8266 nodeMCU> …Internet… >my-website

I use a hosting service’s shared server for my website development. The website has a simple API providing read and write access to the Arduino(s). It can also provide control system analysis, historical data storage and alert/alarms notifications.

The ESP8266 nodeMCU acts as an internet gateway. It has a small API monitoring the gateway’s access-point and uses a bi-directional I2C interface for communications with the Arduino(s).

The website API is written as a single PHP Class. The nodeMCU’s small API is written entirely from within the Arduino IDE as if it was an Arduino board itself. I added a bi-directional LLC (5V - 3.3V) for the I2C connection - a must include for HiLetgo’s “ESP8266 NodeMCU LUA CP2102 ESP-12E Internet WIFI Development Board.”

Once initiated (plugged in) the nodeMCU starts polling the website’s API which simply stores locally the nodeMCU’s current IP. Valid user requests to the website’s API, then use the last stored IP to build an appropriate HTTP request for the nodeMCU’s API.

The polling and reuse of the last-current-IP enables a pseudo fixed-IP look and feel to the Arduino(s).

user request > website > control system > response to website > response to user


  • Arduino(s) and sensors as needed,
  • HiLetgo’s ESP8266 NodeMCU ESP-12E Development Board, (or like)
  • Logic Level Converter Bi-Directional Module 5V to 3.3V, and
  • Webspace w/ PHP.

Note: fabioc84, as you know, I tried this with the Arduino Uno-WiFi but without success. Argh!


Not quite what your looking for but the principle should be the same.
I use a Raspberry Pi Zero W to collect various reading and post them to Cayenne using Node-Red MQTT nodes. I also have a couple of back channels from Cayenne to the RPi and a couple of buttons in the Cayenne dashboard that allow me to force reading/sending data (normally happens every 10 minutes) and another to power off the RPi.
My IP address is dynamic but once data has been uploaded to Cayenne the buttons seems to work.
I think they have code/examples for both the Arduino & ESP8266 MCU's.

Thank you Riva.

I use ThinkSpeak's free services for historical analysis, trending and visualization among other things.

I also tried a free dynamic-to-static IP service, but it was too limiting really, returning HTML frames pages with advertising. Frames - argh!

The pi is nice but I was given an Arduino to start with and it grew into multiple Arduinos before long.

So the ESP8266 nodeMCU seemed a cheap addition for internet connectivity. I already had the website so adding a small API just made sense to me. And the ESP8266 is cheaper than the pi with less to learn since the nodeMCU is programable using the same Arduino IDE that I had already learned.

Also, like the pi, the nodeMCU can be used without the Arduino boards for small control system needs.

For existing Arduino control systems, adding an ESP8266 nodeMCU for internet connectivity is an easy and cheap solution, or so I think.

Thanks again,


The pi was cheap ($10 from Adafruit) and suited my needs.
I had originally written the code for the ESP8266 but it really struggles to connect to a corporate wi-fi network and the MQTT port is also blocked at work so I had to abandon that idea and run the thing from home.

As I had said above Cayenne supports Arduino & ESP but maybe another service to consider might be Blynk as they also support the same sort of devices and also no need to consider dynamic IP addresses as the device talks to Blynk service and the interface/app talks to the device through the service.

To live is to learn.

I've often said that "...a day without learning something new is a wasted day." - a bit much maybe.

But thank you for your comments Riva.