# FreedomBox for Communities/Point-to-Point Wireless Link

An Internet connection from an ISP is not always available in the area where a community lives. In these cases, one of the ways to receive Internet connectivity is by wirelessly connecting to a nearby point where Internet connectivity is available. This connectivity can be over large distances of more than 10 km. It can either share the bandwidth of an existing Internet connection or obtain a new connection from an ISP to a point where they are able to provide the connectivity. Other alternatives include using Internet connections over 4G when available or laying out a community owned optical fibre cable to a point that can provide Internet connectivity. This section describes how to evaluate and setup a long distance point-to-point wireless connection. The reader should be able to do their own evaluations and if feasible, setup their own wireless links following the instructions provided here.
The technical knowledge for the setup is drawn from various sources and the reader is encouraged to read those sources. The primary among these sources is the book Wireless Networking in the Developing World. Other sources are provided as references in each subsection. This entire section is described with the example of a 2.6 km long wireless connection that the authors have established between the villages of Geesukonda and Gangadevipally in Telangana, India. This connection provides Gangadevipally with Internet connection from the neighboring village of Geesukonda.

## Requirements

To establish a wireless link, the following conditions have to be met:
* There is no need to have a radio license. The link described here uses the technology and radio frequencies of a typical home Wi-Fi access point. In pretty much all countries there is no need to obtain a license for this. Check with your local regulations, just in case.
* There is typically a limit on how much power a Wi-Fi access point is allowed to emit. Lookup your local regulations and note the maximum power that can be emitted. For example, in India, 4 Watts of transmission power is allowed for Wi-Fi frequencies of 2.400 GHz to 2.483.5 GHz and 5.825 GHz to 5.875 GHz. This translates to a maximum power of 36 dBm. Many times there are safeguards in the Wi-Fi access point configure interface to not exceed the power output of a given region assuming the region has been configured properly.
* Access to two tall points on each side of the connection are required to install the Wi-Fi access points. These could be existing structures such as radio towers, water tanks or tall buildings. Alternatively, one may setup a tower of required height on both sides.
* The connection can only be established if there is a clear line of sight between the two points being connected.
* You will need to purchase two Wi-Fi access points with directional antennae such as dish antennae. This could cost as little as USD 150.
* You will need additional equipment to setup the Wi-Fi access points such as Ethernet cables to run down from the towers, hardware to fasten the access points to towers, etc.

## Evaluation

Evaluate if the link between the two points is viable. Each of the following steps are described in more detail later.
* Determine the distance between the two points of connectivity.
* Calculate the height of the towers based on the height of the obstacles in between them and the curvature of the earth.
* Calculate the loss of signal strength for a Wi-Fi signal transmitted between these to points assuming just vacuum between them.
* Decide on whether to use 2.4Ghz frequency or 5Ghz.
* Choose a commercial Wi-Fi access point to use.
* Compute the miscellaneous loss that this link can tolerate. If this value is high enough, say 20 dBi, then the link can be thought of as viable. Otherwise, choose better equipment and repeat the computation.

### Distance Measurement

Measure the aerial distance between the two points using mapping software. Use OpenStreetMap. There are several web based tools that use OpenStreetMap that let you measure the aerial distance between two points. If it is not helpful enough, use Google Maps.
In the example case, the aerial distance between the chosen points in Gangadevipally and Geesukonda villages is about 2.6 km.

### Fresnel Zone Calculations

Point-to-point wireless transmission needs to have more than just line of sight. Depending on the frequency used, it also needs to have an ellipsoidal volume between the two connection points to be completely vacant (ideally) or at least 60% vacant. This ellipsoidal volume is known as a Fresnel Zone. There are multiple Fresnel Zones with varying importance but for the purpose of our wireless connection it sufficient to take into consideration only the first Fresnel Zone. Performing these calculations gives us the height of Wi-Fi towers on each end of the wireless link.
The radius of the ellipsoid $r$ at a point $d_{1}$ distance from first tower and $d_{2}$ distance from second tower is given by
$r={\sqrt {\frac {n*L*d_{1}*d_{2}}{d_{1}*d_{2}}}}$
Where:
$n$ is the number of Fresnel zones being calculated. First first Fresnel Zone, $n=1$.
$L$ is the wavelength of wave $={\frac {c}{f}}$
$c$ is the speed of light
$f$ is the frequency of the wave

#### For 2.4 GHz

* Considering only the first Fresnel zone, $n=1$.
* Distance between points = 2.6 km
* Height of earth due at mid point due to earth's curvature: 0.13 m (negligible).
* Frequency = 2.44 GHz
* At mid point: $d_{1}=1.3km,d_{2}=1.3km$
** No obstruction within 100% of Fresnel radius $r$= 9 m (30ft)
** No obstruction within 60% of Fresnel radius $r_{60\%}$= 7m (23ft)
* Near houses on both sides: $d_{1}=200m,d_{2}=2.4km$
** No obstruction within 100% of Fresnel radius $r$= 5m (16ft)
** No obstruction within 60% of Fresnel radius $r_{60\%}$= 4m (13ft)
* Minimum height of the towers
** For having no obstruction within 100% in Fresnel radius $h$= 10 m
** For having no obstruction within 60% in Fresnel radius $h$= 9 m

#### For 5GHz

* Considering only the first Fresnel zone, $n=1$
* Distance between points = 2.6 km
* Height of earth due at mid point due to earth's curvature: 0.13 m (negligible).
* Frequency = 5 GHz
* At mid point: $d_{1}=1.3km,d_{2}=1.3km$
** No obstruction within 100% of Fresnel radius $r$= 6 m (20ft)
** No obstruction within 60% of Fresnel radius $r_{60\%}$= 5m (16ft)
* Near houses on both sides: $d_{1}=200m,d_{2}=2.4km$
** No obstruction within 100% of Fresnel radius $r$= 3m (10ft)
** No obstruction within 60% of Fresnel radius $r_{60\%}$= 3m (10ft)
* Minimum height of the towers
** For having no obstruction within 100% in Fresnel radius $h$= 8 m
** For having no obstruction within 60% in Fresnel radius $h$= 8 m

#### References

* Fresnel Zone: http://www.wirelessconnections.net/calcs/FresnelZone.asp
* Fresnel Zone Calculator: https://www.everythingrf.com/rf-calculators/fresnel-zone-calculator

### Free space path loss

When a signal is send from one point to another there will be loss in strength of the signal as it travels distances even in perfect vacuum. This is known as free space path loss. We need to compute this value based on the distance between the points.
$FSPL(dB)=20\log _{10}(d)+20\log _{10}(f)+32.45$
Where:
$d$ is the distance of the receiver from the transmitter in km
$f$ is the signal frequency in Mhz
For the example case:
* Distance $d$ is 2.6 km
* For Wi-Fi frequency $f=2.44GHz$, $FSPL(dB)=48.48726dB$
* For Wi-Fi frequency $f=5.8GHz$, $FSPL(dB)=56.00803\ dB$

#### References

* Free Space Path Loss Equation: http://www.radio-electronics.com/info/propagation/path-loss/free-space-formula-equation.php
* Wikipedia: Free-space Path Loss: https://en.wikipedia.org/wiki/Free-space_path_loss

### Wi-Fi Access Point Hardware

A commercial Wi-Fi access point must be selected for establishing a point-to-point Wi-Fi connection. These access points are very similar to typical access points used in homes. They use the same Wi-Fi technology and frequencies to transmit and receive data. However, they are different in following ways:
* These access points can withstand outdoor weather and can be installed without and additional weather protection.
* They can be powered using Power-Over-Ethernet technology so that power supply need not be provided to the top of the building or tower where they are installed.Instead the Ethernet cable that carries data from the access point also carries power for the access point.
* Access points meant for point-to-point links come with a directional dish antenna instead of a typical omni directional antenna. This to facilitate focusing the radio signal in one direction rather than spreading it over an entire area such as a home.
When choosing an access point, the following factors may be of help.
* The higher transmission power the better. In India, 4 Watts of transmission power is allowed for 2.400 GHz to 2.483.5 GHz and 5.825 GHz to 5.875 GHz. This translates to a maximum power of 36 dBm.
* The higher the antenna gain, the better. 23 dBi to 30 dBi are typical.
* Dish antennas are better than sector, omni, patch etc. antennas.
* Dish antennas have optional weather proof covers.
* Dish antennas with a grill can tolerate more wind than completely covered plate ones.
* Antennas sold with radios may work out to be cheaper than buying antenna and radio separately.
Some of the commercial products suitable for point-to-point links evaluated by the authors at the time of the writing are:
* Ubiquiti AirGridM
* Ubiquiti LitebeanM5
* Ubiquiti NanobeamM
* Ubiquiti Powerbeam
* Ubiquiti Nanobridge
* TP-Link TL-ANT2424B
* TP-Link TL-ANT2424MD
* TP-Link TL-ANT5830B
* TP-Link TL-ANT5830MD
* TP-Link WBS510
* TP-Link WBS210

#### Places to Buy

The following could be a place to buy the point-to-point radios and antennae:
* http://www.multilinkonline.com/Ubiquiti-LiteBeam-M5_p_810.html
* http://kc-india.com/

#### References

* Watts to dBm converter: http://www.rapidtables.com/convert/power/dbm-converter.htm

### Link Budget Calculation

Link budget calculation must be done to determine if the link is viable. When a radio signal originates from the transmission radio, it under goes various losses and gains before it reaches the receiving radio. If the receiving radio has as a sensitivity greater than the signal strength received, the data can be understood by the receiver. Otherwise, the link won't work and is unviable. After the transmitting radio transmits the radio signal with power $P_{TX}$, it suffers loss at transmission due to the cable $L_{TX}$, gains due to transmitting antenna $G_{TX}$, suffers free-space path loss $L_{FS}$, suffers losses due to fading $L_{FD}$, suffers other miscellaneous losses $L_{M}$, gains due to receiving antenna $G_{RX}$ and finally losses some in the receiving cable $L_{RX}$ and finally results in the receiving power $P_{RX}$. During our computation we will assume that receiving sensitivity of the access point is the minimum power it can receive. Then will be compute the miscellaneous $L_{M}$is small enough. If it is, then we can assume that the link is viable.
$P_{RX}=P_{TX}+G_{TX}-L_{TX}-L_{FS}-L_{FD}-L_{M}+G_{RX}-L_{RX}$

#### Ubitquiti Litebeam LBE-M5-23

Link budget calculation for Ubitquiti Litebeam LBE-M5-23 for the example case:
* Transmission power (802.11n, MCS7, 150 Mbps) $P_{TX}$= 19 dBm
* Receiver sensitivity (802.11n, MCS7, 150 Mbps) $P_{RX}$= -75 dBm
* Transmission antenna gain $G_{TX}$= 23 dBi
* Transmission antenna gain $G_{RX}$= 23 dBi
* Loss at transmission (< .5m cable) $L_{TX}$= < 2 dB (LMR 200 cable, a low quality coaxial cable has properties of 85 dB for 100 m of cable)
* Loss at receiving (< .5m cable) $L_{RX}$= < 2 dB (same as for transmission)
* Free space loss for 2.6 km distance for 5.8 GHz signal $L_{FS}$= 56 dB
* Fading loss margin $L_{FD}$= 15 dB
* Miscellaneous loss $L_{M}$= ?
Link budget equation:
${\begin{array}{lcl}P_{RX}&=&P_{TX}&+G_{TX}&-L_{TX}&-L_{FS}&-L_{FD}&-L_{M}&+G_{RX}&-L_{RX}\\-75&=&19&+23&-2&-56&-15&-L_{M}&-2&+23\end{array}}$
$L_{M}=65dB$
The value is very high and the link is comfortable viable. We have increased the distance by an order of magnitude and the link would still have been viable.

#### Ubitquiti AirGrid AG-HP-5G27

Link budget calculation for Ubitquiti AirGrid AG-HP-5G27 for the example case:
* Transmission power (802.11n, MCS7, 150 Mbps) $P_{TX}$= 19 dBm
* Receiver sensitivity (802.11n, MCS7, 150 Mbps) $P_{RX}$= -75 dBm
* Transmission antenna gain $G_{TX}$= 27 dBi
* Transmission antenna gain $G_{RX}$= 27 dBi
* Loss at transmission (< .5m cable) $L_{TX}$= < 2 dB (LMR 200 cable, a low quality coaxial cable has properties of 85 dB for 100 m of cable)
* Loss at receiving (< .5m cable) $L_{RX}$= < 2 dB (same as for transmission)
* Free space loss for 2.6 km distance for 5.8 GHz signal $L_{FS}$= 56 dB
* Fading loss margin $L_{FD}$= 15 dB
* Miscellaneous loss $L_{M}$= ?
Link budget equation:
${\begin{array}{lcl}P_{RX}&=&P_{TX}&+G_{TX}&-L_{TX}&-L_{FS}&-L_{FD}&-L_{M}&+G_{RX}&-L_{RX}\\-75&=&19&+27&-2&-56&-15&-Lm&-2&+27\end{array}}$
$L_{M}=73dB$
The value is very high and the link is comfortable viable. We have increased the distance by an order of magnitude and the link would still have been viable.

#### References

* https://en.wikipedia.org/wiki/IEEE_802.11n-2009#Data_rates
* https://dl.ubnt.com/datasheets/LiteBeam/LiteBeam_DS.pdf
* https://en.wikipedia.org/wiki/Link_budget
* https://dl.ubnt.com/datasheets/airgridm/airGrid_HP.pdf

### Choosing 5GHz vs. 2.4GHz

Most of the Wi-Fi access point equipment support both 5Ghz frequency range and 2.4Ghz frequency range. In general, lower frequencies are better for penetrating walls, buildings and vegetation. Higher frequencies are better for direction beams like in case of point-to-point links.
* 5 GHz does not interfere with 2.4 GHz already used to provide Wi-Fi hotspots.
* 5 GHz has a smaller Fresnel zone requiring shorter towers.
* 5 GHz is more prone to losses with cables and connectors.
* 5 GHz antennas are smaller for same sensitivity.
* 5 GHz radio beam is more focused requiring better alignment.
* 5 GHz can't penetrate obstacles (trees, buildings, fog, rain, smoke, etc.) as well as 2.4 GHz.
* 5 GHz band in Wi-Fi supports higher throughput.
For the example case, given that there is good line of sight, 2.4 GHz is being used for hotspots and has a high tower for installation, 5 GHz is better choice.

## Setup

Setup the link between the two points:
* Install and secure the two Wi-Fi access points both ends while making the antennae face each other approximately. The clamps needed for fastening are typically provided along with access points. Take precautions when scaling heights with safety equipment and employing trained and experienced personnel.
* Configure one of the access points in Wi-Fi access point mode and setup the SSID with a password. The access point should be configured in repeater mode so that it does not interfere with the IP address allocation in the network. This task is performed by FreedomBox. The access point should be given a static IP address in the same range as the rest of the hosts in the network.
* Configure the other access point in client mode and connect to the previously configured SSID with the password. The access point should be given a static IP address in the same range as the rest of the hosts in the network.
* Align the antennae to provide the maximum signal strength. Use the antenna alignment tool that is available in the web administration interface of the Wi-Fi access points. While observing the signal strength indicated in the antenna alignment tool, first move the antenna along the horizontal axis and find the point with the best signal strength. Then, fix the horizontal position and move the the antenna along the vertical axis and find the point with the best signal strength. Repeat the process with the second antenna.
* Test the setup to ensure that the access point on either end is able to ping the other using the ping tools provided in the Wi-Fi access point's web administration interface.
* Connect the WAN port of one of the access points to the Internet connection provided by the ISP. This means connecting a long Ethernet cable between access point at the top of the tower to the Ethernet switch of the ISP or to the ADSL modem if the ISP provides ADSL connections.
* On the other access point, connect the WAN port to the Internet port of the FreedomBox server.
* Test the setup by ensuring that FreedomBox server is able to ping both the access points, the ISP servers and the servers on the Internet. Debug accordingly if something does not work.
* Run a bandwidth test to determine that the speed of the Internet connection received by FreedomBox server. Compare it with the speed on the other side without the wireless link setup. Also compare it with ISP advertised speed for the subscription.