Michael Altfield's gravatar

The test of three antennas

I just got the wireless working on my new laptop in ubuntu (thank god for forums), and I was disgusted to find that from my room I got ~20% signal quality. I knew the problem could be with the laptop or the wireless router, but since I can’t do anything about the laptop I did some tests with my router by using three different antennas.

The Antennas

The Parts

The Client (laptop)

  • HP tx1000z tablet
    tx1000z

The Server (wireless router)

  • eHome

The Antennas

  • Small Antenna – This is the antenna that comes with most routers by default. It’s a long, thin stick that can bend 90 degrees on one end.
    Small Antenna
  • Medium Antenna – I think I got this antenna with a NIC purchase. It’s a standing antenna, and looks much more bad-ass than the little stick antenna.
    Medium Antenna

The Test

The concept is pretty basic. Use the same router and same laptop; keep both stationary. I hooked up each antenna, connected my laptop to the network, and recorded the signal strength every 10 seconds for 10 minutes. At the end of the test, I grabbed the min, max, and average signal strength that each antenna produced.

The Scripts

You didn’t actually expect me to use pen and paper for this, did you? I wrote two simple bash scripts. The first one records the data and the second analyzes the data.

signal.sh

#!/bin/bash
i=0
while [[ i -lt 60 ]]
do
s=`iwconfig wlan0 | grep "Link Quality"`
echo ${s:23:2} >> small
sleep 10
i=`expr $i + 1`
done

In case you don’t know bash, I’ll lay this down for you:

It iterates 60 times.

Every iteration, it preforms the “iwconfig wlan0 | grep “Link Quality” command. “iwconfig” is a command in linux that allows you to interface with your –well– interfaces (wireless networks). The “wlan0” bit tells it to grab data only from that specific ethernet card (otherwise it’ll try every ethernet card, including lo (the loopback adapter) and eth1 (my WIRED network card). If I were to preform the “iwconfig wlan0” command from the terminal, I’d get the following output:

$iwconfig wlan0

wlan0 IEEE 802.11g ESSID:"eHome"
Mode:Managed Frequency:2.412 GHz Access Point: 00:00:00:00:00:00
Bit Rate=11 Mb/s Tx-Power:32 dBm
RTS thr:off Fragment thr:off
Power Management:off
Link Quality:28/100 Signal level:-78 dBm Noise level:-96 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:21542 Invalid misc:91971 Missed beacon:0

Notice that the only information we need is located on the line that says “Link Quality”. That’s what the ‘ | grep “Link Quality” ‘ bit is about in the script above; it ignores all lines except ones that have the phrase “Link Quality” in them.

So, “s=`iwconfig wlan0 | grep “Link Quality”`” makes the variable “s” equal to ” Link Quality:29/100 Signal level:-77 dBm Noise level:-96 dBm”.
Next, I grab the first 2 characters after the 23 character that the variable s is equal to, and append the result to a file named “small”.

Every time I switched antennas, I modified the output file. First it was “small”, then “medium”, and finally “large” in respect to the antenna was recording information about.

The next script was responsible for analyzing the data I collected in the three files: “small”, “medium”, and “large”


#!/bin/bash
echo "SMALL"
num=`cat /home/guttersnipe/small | wc -l`
qty=0
start=1
for i in `cat /home/guttersnipe/small`; do
qty=`expr $qty + $i`
if [[ $start -eq 1 ]]
then
start=0
min=$i
max=$i
fi
if [[ $i $max ]]
then
max=$i
fi
done
echo "average"
echo `expr $qty / $num`
echo "max"
echo $max
echo "min"
echo $min
min=0
max=0

echo "MEDIUM"
num=`cat /home/guttersnipe/medium | wc -l`
qty=0
start=1
for i in `cat /home/guttersnipe/medium`; do
qty=`expr $qty + $i`
if [[ $start -eq 1 ]]
then
start=0
min=$i
max=$i
fi
if [[ $i $max ]]
then
max=$i
fi
done
echo "average"
echo `expr $qty / $num`
echo "max"
echo $max
echo "min"
echo $min
min=0
max=0

echo "LARGE"
num=`cat /home/guttersnipe/large | wc -l`
qty=0
start=1
for i in `cat /home/guttersnipe/large`; do
qty=`expr $qty + $i`
if [[ $start -eq 1 ]]
then
start=0
min=$i
max=$i
fi
if [[ $i $max ]]
then
max=$i
fi
done
echo "average"
echo `expr $qty / $num`
echo "max"
echo $max
echo "min"
echo $min

This script does the same thing three times. It calculates the total lines in the data file, and adds all the values (they are separated by line). Wala, you have the average. The min and the max are pretty self explanatory.

The analyze.sh Results

OK, so I’ve run the signal.sh script 3 times (once for each antenna), and the data is stored in the three files. Without further adu, here’s the output of analyze.sh:


SMALL
average
30
max
34
min
26
MEDIUM
average
29
max
34
min
26
LARGE
average
15
max
20
min
14

There you have it folks, true proof that size doesn’t matter. Honestly, I couldn’t believe it myself, but the numbers don’t lie.

Conclusion

Don’t waste money on low-grade wireless antennas, they actually work WORSE than the mini stick that comes with the router!

Related Posts

3 comments to The test of three antennas

  • Shanif Dhanani

    Hi,

    Pretty cool post… I had an off-topic question for you though. I’ve been trying to configure my tx1000z with wireless on Ubuntu for a while, and I was just wondering which wireless card you have that it worked for you. Mine’s a Broadcom 4321 a/b/g/draft-n and I haven’t had much luck with it recently.

    Congratulations on getting everything working on your machine!

  • guttersnipe

    There’s a really good ubuntu thread in the forums here:
    http://ubuntuforums.org/showthread.php?t=442483

    I got touchscreen, sound, and wireless all configured thanks to that link.

  • ok

    good site qozrjt

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>