# 06-05 Signal Diversity in Wireless Communications
# 1.1 Problem
My real time RSSI correction algorithm only works when the client and gateway measurement streams are influenced equally by advertising power fluctuations. Previous tests have shown that the streams fluctuations are far from same.
# 2 Solutions
# 2.1 Related Work
Jessamyn Graves, my physics teacher suggested that the antennas might be inaccurate due to manufacturing faults during mass production. I cannot exclude this possiblity, but am unwilling to buy more RPis to cherry pick the ones with best antennas. Brian Dorey introduces the idea of using an external antenna to increase the signal quality of the Raspberry Pi and improve the effective range. This seems like a lot of work and increases fragility of the devices. A thread started by Kugelblitz discussed the ESP32 and RF antenna power spikes. The fact that my tests contacted the same server eliminates this as a possible culprit. Thus concludes that the differing measurement streams must be caused by software misconfigurations on my side.
# 2.2 Reduce traffic at 2.4 GHz
People online have mentioned WiFi and BLE interference in some forums I checked.
- https://www.raspberrypi.org/forums/viewtopic.php?t=151300
- https://github.com/raspberrypi/linux/issues/1444
{ width=80% }
For RSSI advertising, my C++ code enables all advertising channels with ADV_CHNL_ALL;. According to the ESP GAP API correspond to the channels 37, 38 and 39. These have a huge frequency separation as can be shown in the image above. The advertising channels do a good job of avoiding the WLAN bands, but still come close.
# 5 GHz
Perhaps moving the frequency of the WiFi connection from the polluted 2.4 GHz range to 5 GHz can improve the RSSI. The switch wouldn't be as simple though, since the Raspberry Pi Zero W does not support this frequency range. The only 5 GHz RPi I own is a Model 4B, so I would have to buy one to work as a gateway and make new stand mounts.
# Ethernet
With a cabled connection there obviously is no Wireless RF traffic at all. The question is if this even is necessary, since 4 mobile phones and 2 laptops are connected to the router at 2.4 GHz. I dislike this idea, since it reduces the portability of the devices and once again the Raspberry Pi does not support ethernet. Furthermore, the advertising channels do not directly overlap with the Wifi frequency bands.
# 2.2 Time and frequency diversity through averaging
Averaging values increases the diversity order of measurements in time and frequency. Small scale fading is a huge issue when there is little signal diversity as in my case. Passing every single received packet to the backend has a diversity order of 0. RSSI fluctuations between measurements can be reduced significantly through averaging over multiple advertising packets. To reference section 2.1 above, anti-aliased packets will also reduce network traffic and possible BLE-Wifi interference. This will possibly yield similar red and blue curves for real time corrections.
# 2.3 Spatial Diversity with multiple antennas
The ETH's wireless communications group suggests adding a second antenna at least half a wavelength apart. This increases complexity for me, since I need to design a new case to allow for a separate raspberry pi to be mounted to a stand. In the backend there are no necessary changes, since measurements are grouped by mac address. Setting a fake MAC for each dual-pi unit has the same result as creating a relation between to separate ones.
# 3 Further actions
I will first see what difference the averaging method makes. If it is positive, I will buy some more Raspberry Pi Zero W to create spatial diversity as well. Simultaneously I can have a look at using the RPi 4 Model B at 5 Ghz to see what difference it makes. Then I will do the same as above using a different frequency channel.