-->
Page 1 of 1

Control ESP8266 without static IP

PostPosted: Tue Mar 28, 2017 2:07 am
by fred7
Hello!
I would like to control ESP8266 (and relay) from the internet but I do not have static IP. Is there any webpage that can be used to communicate with ESP8266?

Re: Control ESP8266 without static IP

PostPosted: Wed Mar 29, 2017 2:53 pm
by martinayotte
First, you need to build a firmware on your ESP to provide such web page on your internal network.
Second, you need to configure your router to expose your ESP to outside network by using IP forwarding rules.
Third, if you don't have static IP for your ISP provider modem, you can use some free services such no-ip.org to get a subdomain name associate with your network, but the free services will need to be renewed every 30 days.

Re: Control ESP8266 without static IP

PostPosted: Thu Mar 30, 2017 3:04 pm
by fred7
Thanks a lot!

Re: Control ESP8266 without static IP

PostPosted: Thu Mar 30, 2017 11:15 pm
by oasuria
Hi,

I would suggest looking at ESPEasy platform. It provides connectivity to various relays, sensors and other devices and connect them with well known IoT platforms like Domoticz, OpenHAB, Thingspeak etc.

You can have a look at following GitHub link for their code.
https://github.com/letscontrolit/ESPEasy

Thingspeak version was quite limiting in their original code so I modified it to achieve more flexibility. You can view my modified plugins at following links:

_C004.ino - Modified Thingspeak Controller Plugin
https://github.com/omair-suria/ESPEasyP ... /_C004.ino

_P150_ThingspeakReader.ino - Thingspeak Reader Plugin
https://github.com/omair-suria/ESPEasyP ... Reader.ino

If you use both of these controllers together, you will have following feature:
- Controller Plugin publishes your data to 8 fields on the registered channel. It has the capability of buffering the data received and publishing together as a batch (original version did not provide buffering).
- Reader Plugin will read status from thingspeak to retrieve and execute commands. For example, we can send command like "RELAY,1, 0" (to close Relay 1) or "RELAY,1,1" (to open Relay 1).

I made these plugins for a smart thermostat project I am working on, but have made it available to public if anyone finds it useful.

Coming to your question about controlling the relay from Internet. Thingspeak connectivity will allow you to control your relay and also view the current status (and history) of the relay and other parameters if you are measuring them via Thingspeak channel fields. Thingspeak provides a HTTP API for writing data to its channel, so you can use that to write command to the status field of the channel.

This methodology will only involve creating a free thingspeak account and a channel, and use it directly.

I hope you find this useful.

Cheers!!!