~bfiedler/website

318007554e062134ff0e46cce1fe44978ee4e8a3 — Ben Fiedler 5 months ago 2afc6d9
update antenna article
M content/blog/build-your-own-wi-fi-antenna.md => content/blog/build-your-own-wi-fi-antenna.md +52 -54
@@ 39,32 39,27 @@ antenna, so the parabola is cut off at some point, resulting in a diameter $d$
and height $h$. These parameters are important when printing the design, since
they impact the stability and feasibility of the print.

{{< figure class="invertable resizable" src="/blog/img/antenna-schema.png" >}}
{{< figure class="invertable resizable" src="/blog/img/antenna-schema.png" caption="Optimal parabolic antenna equation" >}}

Such a parabolic antenna has a theoretical gain $G$ of $η * (π * d / λ)²$, where
$λ$ is the wavelength of the measured signal and $η$ is the so-called *aperture
efficiency*, commonly between $0.5$ and $0.7$. It is a catch-all for uneven dish
surface, poor antenna placement and other blemishes.

We chose a focal length of 100mm and diameter of 200mm. Since we are interested
in building a Wi-Fi antenna, the wavelength is 125mm[^2], which gives us a
theoretical gain of $η * 25.26$ or about $10 * log10 η + 14 dBi$, a promising
start.
Such a parabolic antenna has a theoretical gain of $η * (π * d / λ)²$, where $λ$
is the wavelength of the measured signal and $η$ is the so-called *aperture
efficiency*, commonly between 0.5 and 0.7. It is a catch-all for uneven dish
surface, poor antenna placement and other errors.

Balz, a friend of mine, helped us model and print the antenna using
[Fusion360](https://www.autodesk.com/products/fusion-360/personal)[^1] and his
[Prusa MK3S](https://www.prusa3d.com/original-prusa-i3-mk3/). The 3D model can
be downloaded [here](/blog/static/antenna-model.stl). Of course, any decent 3D
modeling software and printer will do here.
modeling software and printer will do.

{{< figure class="resizable" src="/blog/img/antenna-render.png" >}}
{{< figure class="resizable" src="/blog/img/antenna-render.png" caption="Rendered antenna model" >}}

Unfortunately, the surface of 3D prints commonly has a rough texture, which
lowers the effectiveness of the antenna. We attempted to fix this by taping a
high-density rubber foam sheet in the dish and covering the now smoother surface
in aluminium tape. Both materials can be bought cheaply in a hardware store.

{{< figure class="resizable" src="/blog/img/antenna-build.png" >}}
{{< figure class="resizable" src="/blog/img/antenna-build.png" caption="The completed build" >}}

And all set! In order to measure how good our DIY antenna is we compared it
against a professional so-called


@@ 74,58 69,61 @@ WN722N](https://www.tp-link.com/us/home-networking/usb-adapter/tl-wn722n/) USB
wifi adapter as sending station, and the [Alfa
AWUS036NH](https://www.alfa.com.tw/products/awus036nh) USB adapter as receiver.
Getting the driver of the TP-Link stick to work was quite the pain, but we
managed and set out to measure the different antennas.

We are interested in the antenna gain, i.e. how much the antenna amplifies a
signal when receiving. Generally, decibels-isotropic (dBi) is used, which
compares the received signal strength to an idealized isotropic antenna.

When using a source transmitting with constant signal strength it suffices to
measure the received signal strength only - we can infer the gain from the
source strength and our measurements. This is measured in decibel-milliwats
(dBm), which measures the change in power level per milliwatt increase.

It is important to consider the right environment when measuring antenna gain:
there should be no reflective surfaces such as building walls, bridges or
similar close by. Also be sure to have line-of-sight between both antennas, as
any objects between them disturb the measurements. We chose an open field near
us.
managed and set out to measure the different antennas. For our test setup we
created a Wi-Fi network on the TP-Link adapter and connected to it from the Alfa
adapter. We measured the signal strength using `iwconfig`.

There are many effects which influence the signal strength at the receiver, such
as the sending and receiving antenna gains, the distance between sender and
receiver, the carrier medium, and so on. Except for the receiving antenna all
other properties stay the same. Thus it suffices to measure the received signal
strength only - we can infer the relative gain between the antennas that way.

We are interested in determining the recipient's antenna gain, i.e. how much the
antenna amplifies a signal when receiving. This is generally measured in
decibels-isotropic (dBi), which is the factor between this antenna's gain and an
idealized isotropic antenna.

Signal strength is measured in decibel-milliwats (dBm), which expresses the
change in signal power level per milliwatt increase. Both antenna gain and
signal strength are logarithmically scaled, which simplifies calculations: the
signal strength measured using an antenna is the actual signal strength at the
receiver (in dBm) plus the antenna gain (in dBi). It is important to consider
the right environment when measuring antenna gain: there should be no reflective
surfaces such as building walls, bridges or similar close by. Also be sure to
have line-of-sight between both antennas, as any objects between them disturb
the measurements. We chose an open field near our city.

We measured the signal strength once for increasing distances between 1m and
100m, and another time in a 360° radius at 20m, using 20° increments using three
antennas: Our DIY parabolic antenna, the professional cantenna, and the 5dBi
omnidirectional antenna which came included with the Alfa adapter.

For our test setup we created a Wi-Fi network on the TP-Link adapter and
connected to it from the Alfa adapter. We measured the signal strength using
`iwconfig`, which natively displays this metric.
antennas: Our DIY parabolic antenna, the professional cantenna, and the
omnidirectional antenna which came included with the Alfa adapter, which is
rated at 5dBi. Based on the omnidirectional antenna we can estimate the gain of
the other two antennas.

# Distance measurements

{{< figure class="invertable resizable" src="/blog/img/antenna-dist.png" alt="Plot of signal strength with varying distance" >}}
{{< figure class="invertable resizable" src="/blog/img/antenna-dist.png" alt="Plot of signal strength with varying distance" caption="Signal strength (dBm) relative to distance (m)" >}}

Surprisingly, the omnidirectional antenna outperforms both our antenna (which
was probably to be expected), but also the professional cantenna. In all
measurements the omnidirectional antenna receives at least 2dBm stronger than
our parabolic antenna, which implies that the antenna gain for our parabolic
antenna is at most 3dBi, or that our antenna efficiency $η$ is about 8% only.
Surprisingly, the omnidirectional antenna outperforms not only our antenna (which
was probably to be expected), but also the professional cantenna.

A few explanations come to mind: during transport I accidentally bent the copper
wire a bit, and we did not manage to bend it back perfectly, potentially
shifting the focus from the 100mm wire tip.  Furthermore, our antenna dish is
not a perfect parabola, but contains blemishes from the underlying sponge
rubber, diffracting signals instead of focusing them.
We have a few theories regarding the comparatively poor performance of our
antenna: during transport I accidentally bent the copper wire a bit, and we did
not manage to bend it back perfectly, potentially shifting wire from the focus.
Furthermore, our antenna dish is not a perfect parabola, but contains blemishes
from the underlying sponge rubber, diffracting signals instead of focusing them.

# Directionality measurements

{{< figure class="invertable resizable" src="/blog/img/antenna-angle.png" alt="Plot of signal strength with varying angle" >}}
{{< figure class="invertable resizable" src="/blog/img/antenna-angle.png" alt="Plot of signal strength with varying angle" caption="Signal strength (dBm) relative to angle (°)" >}}

Unsurprisingly, the omnidirectional antenna is not sensitive to orientation,
while the other two antennas are. The cantenna displays a beautiful profile of
directionality: Good signal strength when pointing directly towards the source,
then decreasing until hitting the minimum around 180°. Our parabolic antenna
is also directional, albeit less consistently. In addition to the reasons listed above
the length of our copper wire may also be responsible: Since it extends beyond
the length of our copper wire may also be responsible: since it extends beyond
the focal point in both directions, signals which are reflected close to the
focal point hit the copper wire as well, reducing directionality.



@@ 135,7 133,8 @@ Our DIY antenna is a success: while it is not as good as an off-the-shelf
omnidirectional antenna it is certainly good enough to receive Wi-Fi signals
over a range of 100m, comparable to a non-DIY cantenna. It displays some form of
directionality, if not a very good one. Coming back to antenna gain it seems
that our antenna's gain is not even close to the theoretical maximum of 14 dBi.
that our antenna's gain is not even close to its theoretical maximum of 14 dBi,
we estimate it to be closer to 2-3 dBi.

There are many possible improvements to this design. The easiest way to increase
antenna gain (and directionality) is to increase its diameter. While 200mm is


@@ 147,10 146,10 @@ significantly more complex model.

A variety of other DIY antenna models also exists, such as the
[cantenna](https://en.wikipedia.org/wiki/Cantenna),
[Wok-Fi](https://en.wikipedia.org/wiki/WokFi) (using woks or similar dishes),
and many more. Hopefully this post showed you that building a Wi-Fi antenna is
doable using only cans or a 3D printer, as well as some inexpensive hardware
store/electronics. and can be a fun side project! 
[Wok-Fi](https://en.wikipedia.org/wiki/WokFi) (using woks or similar kitchenware
as antenna dish), and many more. Hopefully this post showed you that building a
Wi-Fi antenna is doable using only cans or a 3D printer, as well as some
inexpensive hardware store/electronics. And can be a fun side project! 

If you have any questions or comments feel free to reach
out to me via my [public inbox](https://lists.sr.ht/~bfiedler/public-inbox).


@@ 158,4 157,3 @@ out to me via my [public inbox](https://lists.sr.ht/~bfiedler/public-inbox).
[^1]: See his [reddit
  thread](https://www.reddit.com/r/Fusion360/comments/ejg226/accurate_parabolas_in_fusion_360/)
  about parabolic antennas in Fusion360.
[^2]: for the 2.4 GHz bands

M content/blog/img/antenna-dist.png => content/blog/img/antenna-dist.png +0 -0
A content/blog/img/antenna-render.png => content/blog/img/antenna-render.png +0 -0
M content/blog/img/antenna-schema.png => content/blog/img/antenna-schema.png +0 -0
A content/blog/static/antenna-model.stl => content/blog/static/antenna-model.stl +0 -0