between 2 esp

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
hestia
Normal user
Posts: 90
Joined: 06 Mar 2021, 08:27
Location: Paris

between 2 esp

#1 Post by hestia » 22 Apr 2021, 21:37

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?

TD-er
Core team member
Posts: 8638
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: between 2 esp

#2 Post by TD-er » 22 Apr 2021, 21:49

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.

User avatar
Ath
Normal user
Posts: 3413
Joined: 10 Jun 2018, 12:06
Location: NL

Re: between 2 esp

#3 Post by Ath » 22 Apr 2021, 22:07

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.
/Ton (PayPal.me)

chemmex
Normal user
Posts: 92
Joined: 15 Feb 2019, 16:18

Re: between 2 esp

#4 Post by chemmex » 22 Apr 2021, 22:18

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

TD-er
Core team member
Posts: 8638
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: between 2 esp

#5 Post by TD-er » 22 Apr 2021, 22:24

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.

hestia
Normal user
Posts: 90
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: between 2 esp

#6 Post by hestia » 22 Apr 2021, 23:14

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...

hestia
Normal user
Posts: 90
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: between 2 esp

#7 Post by hestia » 22 Apr 2021, 23:57

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 5832 times
Screenshot 2021-04-22 235253.png
Screenshot 2021-04-22 235253.png (108.07 KiB) Viewed 5832 times
Screenshot 2021-04-22 235229.png
Screenshot 2021-04-22 235229.png (99.47 KiB) Viewed 5832 times

User avatar
chromo23
Normal user
Posts: 821
Joined: 10 Sep 2020, 16:02
Location: germany

Re: between 2 esp

#8 Post by chromo23 » 23 Apr 2021, 01:12

"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

TD-er
Core team member
Posts: 8638
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: between 2 esp

#9 Post by TD-er » 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...

hestia
Normal user
Posts: 90
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: between 2 esp

#10 Post by hestia » 23 Apr 2021, 09:22

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...

TD-er
Core team member
Posts: 8638
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: between 2 esp

#11 Post by TD-er » 23 Apr 2021, 10:00

good to know it works :)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest