sendTo UDP reliability

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
mrh_icb
Normal user
Posts: 11
Joined: 08 Oct 2020, 04:15

sendTo UDP reliability

#1 Post by mrh_icb » 08 Nov 2020, 02:43

I am running into an issue with Inter-ESPEasy UDP packet drops. About 1 in 20 SendTo commands get dropped.

This is my setup:
- 5 ESP8266 (Wemos D1 minis) in Inter-ESPEasy Network, controlling 10 roller shades
- each ESP controls 2 roller shade motors, the Wemos board is powered via buck converter from the motor's 12V supply
- unit 0 in the network is the master, and accepts events like "All_Up", "All_Down" from an external client via http
- it then relays those events to the individual units in the network via sendTo events like "unit1_up", "unit2_up", etc.

I am not sure yet, what causes the packet drop. I could think of:
- WIFI interference from the running motors - I think I ruled this out, as I added a delay between UDP communication and starting the motors.
- WIFI instability due to power issues, although the buck converter has a 220uF capacitor on the 5V side
- unstable core library - I found with ESPEasy builds post 2018 wifi got more unstable in general

I did enable the "Gratuitous ARP" option. What seems to help is to simply execute all sendTo commands twice.
So my question: Is there a way to increase reliability of sendTo? 5% packet drop seems high to me.

A TCP based ESPEasy network would be nice.

I was also thinking about using SendToHTTP since it is TCP based - but how do I find the IP addresses of all the units
in the ESPEasy network? The main config page lists the IP addresses of all detected units, is there a way to access those
in variables from rules?

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: sendTo UDP reliability

#2 Post by ThomasB » 08 Nov 2020, 03:23

You didn't say which ESPEasy version you're running. That's usually an important thing to know.
- unit 0 in the network is the master, and {snip}
I believe unit 0 (and 255) numbering should be avoided. Anything in between those values is OK.
I found with ESPEasy builds post 2018 wifi got more unstable in general
Yes, stability was horrible from mid-2018 to Early 2020. Constant reboots and lost WiFi connections. But the recent Mega releases are very stable, thank goodness. So upgrade all the nodes if you're running an older release.

- Thomas

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

Re: sendTo UDP reliability

#3 Post by Ath » 08 Nov 2020, 14:03

mrh_icb wrote: 08 Nov 2020, 02:43 - unit 0 in the network is the master, and accepts events like "All_Up", "All_Down" from an external client via http
As ThomasB already stated, unit numbers 0 and 255 should not be used.
mrh_icb wrote: 08 Nov 2020, 02:43 I am not sure yet, what causes the packet drop. I could think of:
- WIFI interference from the running motors - I think I ruled this out, as I added a delay between UDP communication and starting the motors.
- WIFI instability due to power issues, although the buck converter has a 220uF capacitor on the 5V side
- unstable core library - I found with ESPEasy builds post 2018 wifi got more unstable in general

So my question: Is there a way to increase reliability of sendTo? 5% packet drop seems high to me.
UDP is by definition an 'unreliable' protocol, in that is doesn't guarantee the message will actually be delivered. It's Fire & Forget.
If available you could use an oscilloscope to inspect the actual 'steadyness' of the power provided to the ESP, don't forget to measure the dc voltage either, anything below 5V may cause less reliable working of WiFi on the Wemos's, especially those sourced directly from China.

Packet loss/network stability is related to the load of the ESP's and the network. If your network is very busy and the load of the (receiving) ESP is quite high, it is not uncommon to loose that percentage of UDP messages, but it could be lower. Signal strength may also be a factor here, low signal strength/quality will make UDP less reliable.
mrh_icb wrote: 08 Nov 2020, 02:43 A TCP based ESPEasy network would be nice.

I was also thinking about using SendToHTTP since it is TCP based - but how do I find the IP addresses of all the units
in the ESPEasy network? The main config page lists the IP addresses of all detected units, is there a way to access those
in variables from rules?
I've given my ESP's the same unit number as the 4th part of the (fixed) IP address, so this would be quite easy for me to implement, AFAIK there is no way to lookup the IP address of a unit, but you can ofcourse use UDP to send an event (twice?) to the receiving ESP to return the 4th part of their IP address (%ip4%) to the master ESP (send the %ip4% of the master as an argument where it should be returned for better reliability), store them either in an internal variable using let or a Dummy device using TaskValueSet (easier to monitor), so you can then send the payload using SendToHTTP.
/Ton (PayPal.me)

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

Re: sendTo UDP reliability

#4 Post by Ath » 08 Nov 2020, 18:44

I made a pull request PR #3365 to add a conversion for Unit number to IP address.
/Ton (PayPal.me)

Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests