ESPEasy: Extending Wifi range through data routing between multiple ESPEasy units?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Wookbert
Normal user
Posts: 132
Joined: 06 Nov 2020, 03:17

ESPEasy: Extending Wifi range through data routing between multiple ESPEasy units?

#1 Post by Wookbert » 22 Nov 2020, 19:09

NOOB question: Can the ESP8266 (Wemos D1 Mini 4MB) running ESPEasy set up so it re-transmits commands/data from one unit to another, and thus extend the Wifi range?

My problem: I have a Wemos D1 mini 4 MB with relay shield which has an unreliable Wifi connection to my router. My plan B is to mod the on-board antenna and attach an external antenna. But perhaps there is an alternative option to create a kind of mesh network between all my ESPEasy units!?

I saw that the ESP8266 can be also set up as Wifi Extender, but my idea would be that those units already in use talk to each other. Does this option exist?

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

Re: ESPEasy: Extending Wifi range through data routing between multiple ESPEasy units?

#2 Post by TD-er » 22 Nov 2020, 19:23

Not yet, but it is a feature that will be added as I'm working on it.
It is a rather extensive new feature, so I'm already working on it for a while so don't expect it this year.
Hopefully at the beginning of next year.

Wookbert
Normal user
Posts: 132
Joined: 06 Nov 2020, 03:17

Re: ESPEasy: Extending Wifi range through data routing between multiple ESPEasy units?

#3 Post by Wookbert » 22 Nov 2020, 19:41

Excellent, 👍🏻 thumbs up!

Saw that the D1 mini now’s available on AliExpress with antenna connector. Ordered a few these days and waiting for them to arrive.


1PCS-ShengYang-D1-mini-Pro-16M-bytes-external-antenna-connector-ESP8266-WIFI-for-WEMOS (1).jpg
1PCS-ShengYang-D1-mini-Pro-16M-bytes-external-antenna-connector-ESP8266-WIFI-for-WEMOS (1).jpg (86.08 KiB) Viewed 11545 times

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

Re: ESPEasy: Extending Wifi range through data routing between multiple ESPEasy units?

#4 Post by TD-er » 22 Nov 2020, 20:05

On the image you can see a small 0 Ohm resistor near the antenna connector.
The default orientation is to connect it to the "ceramic antenna".
If you try to use the small IPEX connector for an external antenna, make sure to also remove that resistor and short the pads pointing to the IPEX connector (rotate the resistor 90 degree CCW)

Wookbert
Normal user
Posts: 132
Joined: 06 Nov 2020, 03:17

Re: ESPEasy: Extending Wifi range through data routing between multiple ESPEasy units?

#5 Post by Wookbert » 22 Nov 2020, 23:11

TD-er wrote: 22 Nov 2020, 20:05 On the image you can see a small 0 Ohm resistor near the antenna connector.
The default orientation is to connect it to the "ceramic antenna".
If you try to use the small IPEX connector for an external antenna, make sure to also remove that resistor and short the pads pointing to the IPEX connector (rotate the resistor 90 degree CCW)
Thanks for the hint! Do you know this particular board? Is the ceramic on-board antenna any better than the printed PCB on-board antenna usually found on the Wemos?

asuz
Normal user
Posts: 175
Joined: 31 Oct 2018, 18:22

Re: ESPEasy: Extending Wifi range through data routing between multiple ESPEasy units?

#6 Post by asuz » 22 Nov 2020, 23:52

TD-er wrote: 22 Nov 2020, 19:23 Not yet, but it is a feature that will be added as I'm working on it.
It is a rather extensive new feature, so I'm already working on it for a while so don't expect it this year.
Hopefully at the beginning of next year.
That would be a magnificent feature. :idea:

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

Re: ESPEasy: Extending Wifi range through data routing between multiple ESPEasy units?

#7 Post by TD-er » 23 Nov 2020, 00:20

Wookbert wrote: 22 Nov 2020, 23:11
TD-er wrote: 22 Nov 2020, 20:05 On the image you can see a small 0 Ohm resistor near the antenna connector.
The default orientation is to connect it to the "ceramic antenna".
If you try to use the small IPEX connector for an external antenna, make sure to also remove that resistor and short the pads pointing to the IPEX connector (rotate the resistor 90 degree CCW)
Thanks for the hint! Do you know this particular board? Is the ceramic on-board antenna any better than the printed PCB on-board antenna usually found on the Wemos?
I know the boards... as in plural, because the "Wemos D1 mini pro" boards have been copied over and over by several suppliers.
So it is hard to say what the quality is of that specific board.
But in general they are quite OK and popular (there should be a relation between those 2 ;) )

Those "Chip antennas" are often better compared to the "PCB trace antenna" designs.
But still a proper external antenna should beat the ones on a board.
If only because you are more likely to have the external antenna mounted such that it will have the same polarity as your access point.
Also you tend to place an external antenna outside an enclosure which may attenuate the signal and sometimes even de-tune your on board antenna.

But just try the on board antenna's first, just to see if it is already near good enough.

Wookbert
Normal user
Posts: 132
Joined: 06 Nov 2020, 03:17

Re: ESPEasy: Extending Wifi range through data routing between multiple ESPEasy units?

#8 Post by Wookbert » 23 Nov 2020, 01:34

Thank you again. While I have you attention:

Does the CPU Eco mode have any negative impact on Wifi reachability?

It really lowers power consumption significantly, from something 0.7 Watt to 0.25 Watt idle on a Wemos D1 mini on an Hi-Link 5 Volt PSU, according to my measurements. Sounds little but adds up, when looking at 24/7/365 and multiple units.

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

Re: ESPEasy: Extending Wifi range through data routing between multiple ESPEasy units?

#9 Post by TD-er » 23 Nov 2020, 09:30

Yep, it really does, but it depends on your use case whether that's an issue.

This is what happens;
The ESP does turn off the radio for longer amounts of time.
Normally an access point does send out a beacon at every so called "beacon interval".
A typical beacon interval is ~100 msec (102.4 msec).
When you try to send data to a connected WiFi station, your access point first tries to send directly to the node and if it doesn't immediately reply, the access point includes a notification for this node in such a beacon package.
Meaning, if you send a ping (or just any package) to a WiFi connected node, the first reply typically takes half this interval. (later ping replies may receive a response more quickly as the radio may be on continuously)

If the ESP (or any other WiFi device in "power save mode") is not listening to each beacon interval, it may take longer to reach the node.
Such a "listen interval" is called a DTIM interval and is often set between 1 and 3 for almost all WiFi devices.
I'm not entirely sure what the ESP uses when consuming ~80 mA, but I think it has the radio on all the time, effectively receiving packets before the next beacon interval.

Here a quick test I performed on 2 of my ESPEasy nodes.
One with "Eco mode" enabled and one disabled:

Code: Select all

gijs@DESKTOP-QLB7N8I:~/GitHub/letscontrolit/ESPEasy$ ping 192.168.10.92
PING 192.168.10.92 (192.168.10.92) 56(84) bytes of data.
64 bytes from 192.168.10.92: icmp_seq=1 ttl=254 time=6.51 ms
64 bytes from 192.168.10.92: icmp_seq=2 ttl=254 time=4.24 ms
64 bytes from 192.168.10.92: icmp_seq=3 ttl=254 time=104 ms
64 bytes from 192.168.10.92: icmp_seq=4 ttl=254 time=3.01 ms
^C
--- 192.168.10.92 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 3.007/29.329/103.562/42.876 ms
gijs@DESKTOP-QLB7N8I:~/GitHub/letscontrolit/ESPEasy$ ping 192.168.10.211
PING 192.168.10.211 (192.168.10.211) 56(84) bytes of data.
64 bytes from 192.168.10.211: icmp_seq=2 ttl=254 time=885 ms
64 bytes from 192.168.10.211: icmp_seq=4 ttl=254 time=40.9 ms
64 bytes from 192.168.10.211: icmp_seq=5 ttl=254 time=34.8 ms
64 bytes from 192.168.10.211: icmp_seq=7 ttl=254 time=85.6 ms
^C
--- 192.168.10.211 ping statistics ---
13 packets transmitted, 4 received, 69.2308% packet loss, time 12323ms
rtt min/avg/max/mdev = 34.788/261.588/885.111/360.524 ms
As you can see, one of them did not reply on all ping packets and the first ping took quite some time to get a reply.
N.B. both are connected to the same access point.

What happens if you try to reach any host on your network?

Case 1, your PC does not know the MAC address of the ESP:
- Your PC tries to find the MAC address belonging to an IP address using an ARP packet (question is like: "Who has 1.2.3.4?")
- ARP packets gets broadcasted to the entire network
- If the ESP misses such an ARP request, you cannot route the IP packet to your ESP. -> fail

Case 2, your PR does know the MAC address of the ESP, but a switch or access point does not:
- Your PC sends out a packet for MAC belonging to your ESP
- Switch does not know how to rout and discards packet
- timeout on your PC.

Work around: Send Gratuitous ARP packets (answer to a question nobody asked)
- ESP sends "AA:BB:CC:DD:EE:FF has IP 1.2.3.4"
- All switches, access points and hosts on your network receiving this packet update their ARP table
- Roundtrip time of routing packet depends only on DTIM interval of the ESP.

TL;DR
If you only send data from your ESP to something like a broker, then using "Eco" mode does probably have little to no effect on WiFi performance.
If you need a swift response (e.g. turning on a light), then you should not use "Eco" mode.

Wookbert
Normal user
Posts: 132
Joined: 06 Nov 2020, 03:17

Re: ESPEasy: Extending Wifi range through data routing between multiple ESPEasy units?

#10 Post by Wookbert » 23 Nov 2020, 11:29

Thank you. As said above I'm a NOOB to ESPEasy. If the device is well within Wifi range, I haven't noticed any delays yet. Was the ESPEasy unit in your pin results within good reach to the Wifi router?

My worries regarding the CPU Eco Mode only relate to the mentioned EPSEasy relay switch which has very bad Wifi reception. It switches a multiple socket outlet with projector, audio amplifier, Bluetooth Audio Receiver, Apple TV. A minor delay wouldn't matter in this setup, as long as the single command sent is somehow repeated until the command has been received and executed by the ESPEasy relay.

Also regarding your mentioned ESPEasy mesh: Would/will this be ESPEasy-only command routing or will this include a general Wifi extender at the same time, something like this?

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

Re: ESPEasy: Extending Wifi range through data routing between multiple ESPEasy units?

#11 Post by TD-er » 23 Nov 2020, 14:38

The mesh functionality is about ESPEasy p2p communication.
So like forwarding messages to finally reach a MQTT broker, communication between ESP's, deployment of settings, etc.

It is not going to be a IP-forwarder or official WiFi mesh like some access points provide.
Maybe that's going to be implemented for ESP32, but for ESP8266 it has proven to be quite a hit on the limited resources.

The main use case for the mesh layer I'm working on is:
- Reachable nodes where no WiFi is available (using a different way of sending small packets, so you can dramatically increase the range)
- Very quickly dump sensor data so you can go back to deep sleep and thus saving battery power
- Allow communication between nodes even when the "network" is down (e.g. light still switches on when pressing a button)
- Sync data among nodes with very low latency, allowing for some special purpose measurements I plan to add.
- Keep time synced among nodes with very low drift. Currently the entire mesh can have the same time with an offset of less than 1 msec.

In test setups it has been proven to forward large messages over 6 hops with 50m between hops.

Thank you. As said above I'm a NOOB to ESPEasy. If the device is well within Wifi range, I haven't noticed any delays yet. Was the ESPEasy unit in your pin results within good reach to the Wifi router?
It really depends on a lot of factors whether the WiFi reception is reliable.

Using the following often improves reliability:
- Do not use Eco mode
- Use a fixed WiFi channel
- Force WiFi B/G in Tools -> Advanced (may be a bad idea if lots of other devices also use the same AP at 2.4 GHz)
- Try a different orientation of the ESP so its antenna may match the same polarity as the antenna in the AP.
- Use a dedicated AP for ESP nodes.

Wookbert
Normal user
Posts: 132
Joined: 06 Nov 2020, 03:17

Re: ESPEasy: Extending Wifi range through data routing between multiple ESPEasy units?

#12 Post by Wookbert » 27 Nov 2020, 19:41

I've disabled CPU Eco mode and forced Wifi B/G, but it didn't improve reachability. In the rare cases when I got a connection, the signal was -82dBm and worse (that the Wemos D1 mini with printed trace antenna).

Today the above shown Wemos D1 mini with ceramic antenna and optional external antenna arrive. The ceramic antenna seems to improve reachability already significantly (-77 dBm), so that the problem seems to be solved.

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

Re: ESPEasy: Extending Wifi range through data routing between multiple ESPEasy units?

#13 Post by Ath » 27 Nov 2020, 20:10

Installing a cheap (~€15,- to €25,-) WiFi repeater, that plugs directly into a wall outlet, around half-way between the ESP's and your router, could also be a cost-effective solution. Unless there is only open/outside space ofcource. I have spread a WiFi mesh system around the house, so WiFi coverage is pretty OK in most rooms of the house & the garden.
/Ton (PayPal.me)

Wookbert
Normal user
Posts: 132
Joined: 06 Nov 2020, 03:17

Re: ESPEasy: Extending Wifi range through data routing between multiple ESPEasy units?

#14 Post by Wookbert » 27 Nov 2020, 20:24

I hesitate installing WiFi repeaters. Not because of the purchase cost, but the power consumption: Electricity is insanely expensive in Germany these days. Depending on the city one lives in green power can be EUR 0,27/kWh and more. Many small consumers quickly add up (that's why I'm so eager about ESPEasy’s CPU Eco Mode, which saves 0,5 Watt 24/7/365).

I've began adding additional 2.4/5 GHz antennas to my FritzBox 6490 to extend range, but haven't finished that project yet.
TD-er wrote: 23 Nov 2020, 14:38 The mesh functionality is about ESPEasy p2p communication.
So like forwarding messages to finally reach a MQTT broker, communication between ESP's, deployment of settings, etc.

It is not going to be a IP-forwarder or official WiFi mesh like some access points provide.
Maybe that's going to be implemented for ESP32, but for ESP8266 it has proven to be quite a hit on the limited resources.

The main use case for the mesh layer I'm working on is:
- Reachable nodes where no WiFi is available (using a different way of sending small packets, so you can dramatically increase the range)
- Very quickly dump sensor data so you can go back to deep sleep and thus saving battery power
- Allow communication between nodes even when the "network" is down (e.g. light still switches on when pressing a button)
- Sync data among nodes with very low latency, allowing for some special purpose measurements I plan to add.
- Keep time synced among nodes with very low drift. Currently the entire mesh can have the same time with an offset of less than 1 msec.

In test setups it has been proven to forward large messages over 6 hops with 50m between hops.
Just had a discussion with a friend regarding your upcoming ESPEasy mesh functionality: He’s it wondering how that works, as to his knowledge the device can be either Client or Access Point, but not both simultaneously (one antenna only).

Does each ESPEasy unit have a list of all other known ESPEasy devices, switches from Client mode connection (to the main router) to Access Point mode, measure the signal strengths and accordingly connects to the ESPEasy unit with the strongest signal, before it switches back to the main router?

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

Re: ESPEasy: Extending Wifi range through data routing between multiple ESPEasy units?

#15 Post by TD-er » 27 Nov 2020, 21:00

The mesh system as I implement it does use a few tricks, so it can act as WiFi STA device and mesh gateway at the same time.
For the mesh layer I do use the ESP-now protocol.
There is one major drawback for which I don't have a fix right now.
It only works well on channel 1.
If I am forced by the access point to another channel, I cannot make ESP32 and ESP8266 work together.

ESP-now does have a limit of 10 (encrypted) or 20 (unencrypted) peers.
But that's also a limit which doesn't apply for ESPEasy :)
So you don't need to know the peer MAC addresses up front.
I'm still working on making the autodiscovery work completely autonomous.

In a test setup it is now running in a big apartment complex with 8 floors.
Around the middle floor there is a WiFi access point at each staircase.
There are several staircases (columns) and if a node can't reach an access point, it will forward the data to a node that is reachable and reports the shortest "distance" (nr of hops) to an access point.
Usually the used route is in the same column, but every now and then the route automatically hops over to the neighbor column if it provides a better route.
Right now the auto discovery and routing sometimes may need several minutes to find a new route, but I plan on having that instantaneous.

ESP-now does only allow very small packets, so if you need to send longer messages, they will be split into a number of smaller ones and merged at the next hop.
This is also something I'm quite proud of as it works very well and fast.
Round trip time of a message of 3 packets is less than 10 msec.

The nice side effect of the ESP-now packets is that they use a very narrow bandwidth, so the range is rather impressive.
Like I said, in an open field test setup hops of over 50 meter per hop also work, where WiFi connections are nearly impossible.

Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests