The use of the ESP8266 in the world of IoT

User avatar
By fred7
#64327 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?
User avatar
By martinayotte
#64382 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.
User avatar
By oasuria
#64430 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!!!