Page 1 of 1

between 2 esp

Posted: 22 Apr 2021, 21:37
by hestia
Hi,
I have 2 esp side to side and I'd like to send information or command from one to another, or get information from the other to the one ;-)
I'd like to avoid wifi and rather to set up a wired communication.
From a Wemos R1D2 to a Sonoff 4CHR3
As I use most of the GPIO for buttons and relays, and the LED, it seems that I have only 2 and 16 available.
Any suggestion?

Re: between 2 esp

Posted: 22 Apr 2021, 21:49
by TD-er
You can use WiFi and the p2p between nodes to send commands from one node to the other and also share task values among nodes.
See: https://espeasy.readthedocs.io/en/lates ... mong-nodes

This still needs an AP to function.
Never tried it, but I guess you could setup one ESP as AP and let the other one connect to it.
I think it may turn off the AP after a while, so you may need to restart the AP on one node from rules periodically.

Re: between 2 esp

Posted: 22 Apr 2021, 22:07
by Ath
Theoretically you could set up a serial connection between 2 ESP's, but I don't think that is going to be easy.

CAUTION: be aware that the Sonoff 4CH R3 is not safe to wire anything external onto, as the unit is directly connected to mains power, making it potentially very (electrically) dangerous.

Re: between 2 esp

Posted: 22 Apr 2021, 22:18
by chemmex
CAUTION: be aware that the Sonoff 4CH R3 is not safe to wire anything external onto, as the unit is directly connected to mains power, making it potentially very (electrically) dangerous.
In fact, 4CHR3 has a switching power supply inside, so all ESP circuitry is galvanically isolated from mains

Re: between 2 esp

Posted: 22 Apr 2021, 22:24
by TD-er
Better test that with a multimeter before connecting it, to make sure the GND of the ESP is not connected in any way to the mains input terminals.

In the past lots of Sonoff devices were not isolated, even if there was no need for a connection like with power measurement circuits.

Also when adding wires in a mains powered unit, you must make sure the isolation of those wires is enough to withstand mains voltage when the isolation of that (low voltage/signal) wire may touch a part of the wires carrying mains voltage.

Re: between 2 esp

Posted: 22 Apr 2021, 23:14
by hestia
Thanks again!
The wired option is too complicated and risky!
I'm going to stick with a standard wifi with an AP.
I'll try "p2p between nodes" instead of http
I've already read the docs, but I need to look better at it to understand...

Re: between 2 esp

Posted: 22 Apr 2021, 23:57
by hestia
I'll try "p2p between nodes" instead of http
I did the steps in the docs, but I'm not sure to understand that:
"Make sure the receiving node has the spot free which is being used on the ‘sending’ node (For example slot 12)"
Does that means that if I want the value of the task3, I need to have the task 3 free on the receiving node?
Also I have (IP unset) and port = 0 on the controller ESPEasy P2P Networking ; the port is set in Tools Advanced (and I did reboot)
Screenshot 2021-04-22 235458.png
Screenshot 2021-04-22 235458.png (85.93 KiB) Viewed 5966 times
Screenshot 2021-04-22 235253.png
Screenshot 2021-04-22 235253.png (108.07 KiB) Viewed 5966 times
Screenshot 2021-04-22 235229.png
Screenshot 2021-04-22 235229.png (99.47 KiB) Viewed 5966 times

Re: between 2 esp

Posted: 23 Apr 2021, 01:12
by chromo23
"Make sure the receiving node has the spot free which is being used on the ‘sending’ node (For example slot 12)"
Does that means that if I want the value of the task3, I need to have the task 3 free on the receiving node?
that is correct... and it should show the task on the receiving side wich needs to be enabled
Also I have (IP unset) and port = 0 on the controller ESPEasy P2P Networking ; the port is set in Tools Advanced (and I did reboot)
thats normal..looks the same in my setup..and mine works fine

can you show a sceenshot of the devices tab

Re: between 2 esp

Posted: 23 Apr 2021, 08:20
by TD-er
Yep, the task nr on both sending and receiving and need to be the same.
Please realize the sending node "pushes" the task definition to the receiving end, so it must be an empty slot. (will change this later as it is a bit counter intuitive)

Double check you have unique unit numbers (not being 0 or 255) of both nodes and use the same UDP port on both sides (preferrably 8266)

And use a build on both ends that both have the same plugin included...

Re: between 2 esp

Posted: 23 Apr 2021, 09:22
by hestia
Thank both of you
It works :-)
TD-er wrote: 23 Apr 2021, 08:20 Yep, the task nr on both sending and receiving and need to be the same.
Please realize the sending node "pushes" the task definition to the receiving end, so it must be an empty slot. (will change this later as it is a bit counter intuitive)

Double check you have unique unit numbers (not being 0 or 255) of both nodes and use the same UDP port on both sides (preferrably 8266)

And use a build on both ends that both have the same plugin included...
I had to "switch" 2 devices (not easy: delete and create), to put the sending device on a free place on the receiving end...

Re: between 2 esp

Posted: 23 Apr 2021, 10:00
by TD-er
good to know it works :)