Page 1 of 2
How to connect two esp8266 modules across the internet?
Posted:
Mon Feb 19, 2018 3:19 pm
by Jooooolian
What I am trying to do is have two modules on independent WiFi networks talk to each other. For example, some input on module 1 could activate a LED on module 2 and vice versa.
I have researched this and all I can seem to find are two alternatives that I don't want: 1) Connect two modules locally using server/client. (Local communication is not applicable here)
2) Control a module from anywhere (I need the input to come from another esp8266, not from a website.)
Any help would be greatly appreciated as I have failed to find how to do it myself. Thanks!
Re: How to connect two esp8266 modules across the internet?
Posted:
Tue Feb 20, 2018 7:21 am
by btidey
If you have control of at least one of the local network routers then you can use a server client model across the internet by using port forwarding.
ESP-A as server accepts requests on say port 80. Router for ESP-A port forwards incoming port 80 traffic to the local ESP-A IP.
ESP-B as client sends request to the WAN IP:80 of network A
This is helped if you set up a dynamic dns name (like freedns) to refer to the WAN IP
For full 2 way communication you can stick with a 1 server / client model (and poll for requests in 1 direction) or you could set up server /client in the reverse direction if you port forward network B
The alternative is to use some public cloud based solution where both ESPs talk to the cloud.
Re: How to connect two esp8266 modules across the internet?
Posted:
Tue Feb 20, 2018 2:45 pm
by martin_g
Quick and dirty, just a proof of concept?
Use two ESPs, an MQTT library and let them publish and subscribe to one or two distinct topics on test.mosquitto.org. This provides no security and it has no guaranteed QoS, but it will work even from local networks behind a NAT router.
Re: How to connect two esp8266 modules across the internet?
Posted:
Wed Feb 21, 2018 2:52 pm
by Luc Volders
Quick and Dirty #2
Use dweet.io
Let one ESP post a dweet and let the other collect it
No logins no registration just plain straight forward and easy to implement.
Luc