Building a wireless testbed... with wires!
The university lab I keep my testbeds in had to be reorganised a few months ago, and everything moved into a smallish server room (where before it was in a larger office space). Since my wireless testbed was carefully setup using the very scientific method of “moving computers further away from each other until the signal is just right”, the move of course meant that my testbed now behaves somewhat differently. And because of the space constraints in the new room, I did not have the same freedom to move things further apart as before; and besides, I’d wanted to find a way to make results more consistent anyway. So I went off in a search of a way to do this.
My WiFi testbed
I’m using a fairly simple testbed setup, where one access point communicates with three client devices, as seen in the figure above. All these devices are regular desktop PCs, equipped with PCIe Qualcomm Atheros AR9580 network adapters (which are 3x3 MIMO devices supported by the ath9k driver in Linux). The clients are set up so one runs at a very low rate, while the others are running at a high rate (to test things like airtime fairness when rates differ). This was achieved by the above-mentioned method of simply moving the slow station to the other side of the room.
While this setup has worked well (and was the basis of our paper on the Linux WiFi changes), it is obviously pretty dependent on the exact placement of the devices, and so quite brittle; which was exactly the problem when things had to move. So what to do instead? Well, instead of having the WiFi signal propagate over the air, we could wire things up so it propagates through cables instead, and attenuate the signal to emulate the environment we want. So that was exactly what I set out to do.
Wiring things up
The idea is simple enough: Simply remove the antennas from the wireless cards and connect the antennas from all four computers with wires, repeating the process for each of the three antenna connectors on the 3x3 wireless cards; and then install the appropriate electrical attenuators to give us the signal strength we want.
I’ve previously tried to get my hands on one of the really fancy Candelatech programmable attenuators, which would be perfect for this (and also allow me to do things like simulate mobility by dynamically varying the attenuation). However, that turned out to be a wee bit out of my budget range, so I had to turn to the manual solution: Fixed signal attenuators, which are fairly standard electrical components. Luckily, I wasn’t planning on doing any mobility experiments anyway.
First off, figuring out how much hardware I would need. A bit of googling turned up this calculation which puts the baseline attenuation needed at around 60 dB. So I decided I’d need at least that much for each client, and a bunch more for the “slow” station. I initially put the “bunch more” at another 30 dB and came up with this drawing of my setup:
I figured I’d roughly double the number attenuators from the twelve needed for the base setup on the drawing, and buy 20. That would leave me some flexibility in the future, without having to go back and order more. I also decided to add the same number of attenuators rated at 10 dB and 3 dB, which will allow me to adjust the exact total attenuation by simply combining them.
Finding a supplier
Thus equipped with a plan, I began scouring the internet for somewhere to buy appropriate attenuators and the cables needed to connect everything. Ebay turned up a few hits, but it was difficult getting everything in one place. Which led me to Alibaba, where I found Zhenjiang Voton Machinery Co., Ltd, an actual manufacturer of all kinds of connectors and accessories for wireless applications.
I must admit that the thought of ordering from an unknown Chinese supplier on Alibaba was somewhat unsettling at first. I’ve sort of gotten used to Ebay, but this was something completely new. But Voton had all the items I needed in their product catalogue and so, I reasoned, at least asking for a quote couldn’t hurt (and besides, I wasn’t sure they’d even want to do business with me, since what I needed was on the low end of their stated minimum quantities).
Writing them a message with a list of the things I need (Alibaba is no pointy-clicky web shop; it’s simply an online product catalogue for suppliers and a contact platform) resulted in prompt and positive response. Voton’s sales person assured me that they could deliver everything I needed, and since they charged $6 per attenuator and $1.5 per cable and T-connector, I’d end up paying just over $500 for the whole package including fees and shipping to Sweden.
While that correspondence had been going on, I’d been doing a bit of googling about how to avoid being defrauded on Alibaba, and looked at Voton’s certification and verification data, which all seemed to check out. So I decided (with a bit of trepidation) to venture into the unknown and go ahead with the order.1
In the meantime I had discovered that the TP-link access point I am contemplating adding to the testbed at a later date (for ath10k testing) uses RP-SMA connectors, while the WiFi cards in the testbed use regular SMA connectors. So a last-minute amendment to the order of 20 RP-SMA-to-SMA-connector patch cables was made, to go along with the 20 male-male and 20 male-female regular SMA connector cables I had already ordered (which was no problem). So satisfied with the offered price and specification, I decided to go ahead and place the order.
Once the order was placed and the money transferred, it only took a little more than a week before the package arrived. This was the contents:
Everything was up to specification, in the right quantity and looking pretty much as I had expected them to. So far so good. Now I could finally find out whether things would actually work as I expected.
For an initial sanity test, I decided to wire up a single client to the access point, with the 60 dB baseline attenuation my initial googling had suggested was needed. This ended up looking like this:
With this setup, the driver reported a signal strength of around -35 dBi, which corresponds pretty well to what I was getting from the fast stations before. And indeed, Minstrel consistently picked one of the two highest MCS rates when transferring data between the two devices. So far so good!
Tweaking and final setup
Wiring in the rest of the clients with appropriate use of T-connectors, and adding extra attenuation to the last station, I was soon able to replicate the setup I wanted, with two fast and one slow station. The total attenuation for each of the clients turned out to be a bit different from what I initially planned, though, which I attribute to loss in cables and connectors, including attenuation from splitting the signal at the T-connectors.2 I simply experimented with attaching attenuators of different strengths until the reported signal strength was what I wanted it to be (around -35 dBi for the fast stations and -75 dBi for the slow station).
In the end, my testbed ended up looking like this, all wired up:
And an updated diagram of the setup, with the right attenuator values and less squiggly handwriting looks like this:
I have yet to run extensive tests on this setup, but an initial test run with one TCP flow to each station looks like this:
Taking this journey through the jungle of Alibaba and Chinese suppliers was certainly both interesting and educational, and I’m pleasantly surprised at how well things went. I’m also pleasantly surprised that everything works more or less as I expected it to (after a bit of inevitable tweaking).
I realise this is not going to be the most dynamic of testbeds (SMA connectors are not exactly the easiest to connect and disconnect), but that is not really the point either. The point is having a setup that allows me to repeat experiments and get the same result (or as close to it as is possible with WiFi) every time. Which I hope this will allow me to do.
That being said, it may of course be the case that I have completely missed something obvious, or that my setup is flawed in a way that is likely to completely invalidate my results. If anyone reading this believes that to be the case, please do drop me a line… :)
I initially wanted to use the Alibaba Trade Assurance programme as an extra insurance against fraud. But Alibaba refused to accept credit card payment for this order (for “security reasons”), so in the end I gave up and paid via PayPal. I suspect part of the reason for that refusal was that I created my Alibaba account and did most of my browsing over the Tor network. However, the customer service people at Alibaba I spoke to were unable to do anything about this, even though I offered to verify my account by other means.[return]
A wonderfully detailed explanation of this is linked from the post where I originally found the 60 dB value.[return]