~bfiedler/website

994439e5cf4dc95ea11e2d5fab72f99c1c63a3a4 — Ben Fiedler 5 months ago 2953790
article update, add 3d model
1 files changed, 63 insertions(+), 48 deletions(-)

M content/blog/build-your-own-wi-fi-antenna.md
M content/blog/build-your-own-wi-fi-antenna.md => content/blog/build-your-own-wi-fi-antenna.md +63 -48
@@ 8,6 8,10 @@ tags: math, diy
Building a wireless antenna is not hard. While the underlying physics and
protocols are relatively complex, an antenna's job is very simple: it captures
or creates electromagnetic waves.
We built a basic parabolic receiving antenna using a 3D printer and a
female-female [N-connector](https://en.wikipedia.org/wiki/N_connector),
available in any well-stocked electronic parts store.


There exist a multitude of different antenna designs, each with different
characteristics. The simplest type is the *isotropic* antenna, which sends or


@@ 19,44 23,48 @@ often (close to) omnidirectional, as it would be really impractical if
orientation had an effect on signal strength!

Antennas which are sensitive to the angles of incoming radio waves are called
*directional*. Common uses of directional antennas are at space observatories
station, but also satellite TV antennas or military and civilian radars.
Directional antennas come in different forms. A well-known one is the
*parabolic* antenna, which uses a parabolic dish to focus the electromagnetic
waves to a single point.
*directional*. Common uses of directional antennas are at space observatories,
but also satellite TV antennas or military and civilian radars. Directional
antennas come in different forms, a well-known one being the *parabolic*
antenna, which uses a parabolic dish to focus the electromagnetic waves to a
single point.

We built a basic parabolic receiving antenna using a 3D printer and a
female-female [N-connector](https://en.wikipedia.org/wiki/N_connector),
available in any well-stocked electronic parts store. The most important part is
the form of the parabola: it is described by the equation $y = x^2 / 4a$, where
$a$ is the *focal length*, i.e.  the distance from the center of the antenna to
the *focal point*, at which the signal is concentrated. Of course it is
infeasible to build an infinitely large 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.
# The build

The most important part of a parabolic antenna is the parabola: it is described
by the equation $y = x^2 / 4a$, where $a$ is the *focal length*, i.e. the
distance from the center of the antenna to the *focal point*, at which the
signal is concentrated. Of course it is infeasible to build an infinitely large
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" alt="Plot of antenna parabola" >}}
{{< figure class="invertable resizable" src="/blog/img/antenna-schema.png" >}}

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.

A friend of mine helped us model and print the antenna using
[Fusion360](https://www.autodesk.com/products/fusion-360/personal) and his
[Prusa
MK3S](https://shop.prusa3d.com/en/3d-printers/181-original-prusa-i3-mk3s-3d-printer.html).
Of course, any decent 3D modeling software and printer will do here.
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.

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.

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

Unfortunately, the surface of 3D prints commonly has a rough texture, which
lowers the effectiveness of the antenna. We fixed 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.
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" alt="The finished antenna build" >}}
{{< figure class="resizable" src="/blog/img/antenna-build.png" >}}

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


@@ 69,8 77,8 @@ 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. Genereally the unit decibels-isotropic (dBi) is used,
which compares the received signal strenth to an idealized isotropic antenna.
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


@@ 89,32 97,37 @@ 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 adatper. We measured the signal strength using
connected to it from the Alfa adapter. We measured the signal strength using
`iwconfig`, which natively displays this metric.

# Distance measurements

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

Surprisingly, the omnidirectional antenna outperforms both our antenna (which
was probably to be expected), but also the professional cantenna. For our
antenna, 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 as good as shown
above. Furthermore our antenna dish is not a perfect parabola, but contains
blemishes from the underlying sponge rubber.
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.

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.

# Directionality measurements

{{< figure class="invertable resizable" src="/blog/img/antenna-angle.png" alt="Signal strength with varying angle" >}}
{{< figure class="invertable resizable" src="/blog/img/antenna-angle.png" alt="Plot of signal strength with varying 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, but the graph is less consistent. In addition to the
reasons listed above the copper wire may also be responsible: Since it extends
beyond the focal length in both directions signals which are reflected close to
the focal point hit the copper wire as well, reducing directionality.
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 focal point in both directions, signals which are reflected close to the
focal point hit the copper wire as well, reducing directionality.

# Conclusion



@@ 122,8 135,7 @@ 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,
maybe even negative.
that our antenna's gain is not even close to the theoretical maximum of 14 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


@@ 137,10 149,13 @@ 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 a 3D printer and some inexpensive hardware store/electronics,
and can be a fun side project! 
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).

[^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