Friday, November 30, 2012

LANforge Attenuator v1.0 is complete.

It took a bit longer than originally hoped, but today we release the LANforge RF Attenuator, version 1.0.  This system has 3 ATS0760-95 attenuator modules, with 0 to 95.5dB attenuation programmable in 0.5dB steps.  These modules support 0.7Ghz to 6Ghz frequency, so it handles all current WiFi frequencies.  It can be tightly integrated with the LANforge WiFIRE testing tools, and can be used standalone as well.

Full source code, including Arduino shield PCB files are released under GPL and CC-BY-SA licenses.

We are still waiting for the semi-rigid SMA cables (and hoping they will give us a bit better isolation), but even with just the standard double-shielded cable we feel the results are acceptable.  Here is a link to some test results using the LANforge WiFIRE test systems (based on ath9k NICs) and the attenuator.

If you have any questions, please send email to: greearb@candelatech.com

Monday, November 19, 2012

WiFi cable differences

In the previous post, I described how I tried to wrap some cables with copper tape to increase shielding.  That did not work as well as I had planned, and so new cables were ordered.  By now, I've taken to always ordering a few extra cables and I then cut one up to inspect it in more detail.  My first attempt at SMA to SMA patch cables used RG-316 cable, which is just a single-shielded cable.  It turns out this thing leaks RF like a sieve.



In a bit of paranoia, I also cut open one of the LMR-195 SMA to SMA patch cables, which I am using to connect the AP and Station machines to the attenuator.  Per spec, these are >90 dB shielding, and they are shielded with both aluminum foil and a wire braid.  But, in some testing, I found that just grabbing the 3 cables and gently lifting them up above the table they were hanging from took the maximum attenuation from around -86 dB to -65 dB.  This indicates to me that these cables must be leaking more than expected.



To improve the SMA to SMA patch cable performance, I ordered some new assemblies based on KSR-100 cable to connect the attenuator modules to the faceplate.  This cable has an inner aluminum foil shield and standard woven shield on the outside.  It claims >90db shielding, and it did seem better.  (The attenuator project can now go down to about -86 dB signal, and before it was tricky to go below -82).  I now have some supposedly even better SMA to SMA cables on order, for both inside the attenuator and to connect the attenuator to AP and Station machines....


My u.fl to SMA pigtails were also in bad shape.  I was also using pigtails made of RG-178, which is similar to RG-316 but smaller in diameter (and likely even leakier than the RG-316).



After looking and asking around, I found some vendors that would make pigtails wit double-shielded 1.32mm coax cable.  I have not been able to find any details on how well this shielding works, but on other stats, such as attenuation, it seems to perform better than most options that can handle u.fl connectors.  From what I can tell, it is likely that all '1.32mm coax cable' is double shielded, but I am not 100% certain this is the case.  While it seems you can always find a better SMA to SMA cable assembly, I have not found anything that looks better than the 1.32mm cable for u.fl to SMA pigtails.


For comparison, here is a smaller diameter single-shielded pigtail that came standard with a pci-e to mini-pci-e adapter card.


So, for now, I'm using 1.32mm coax for the u.fl to SMA pigtails, and have some 670-141 semi-flexible cable, that claims  > 100dB shielding....

Tuesday, October 23, 2012

RF Signal leakage

The attenuator project has been going well, but we are still working on getting the signal isolation secure enough to take the WiFi signal level to less than about -80 dB.  After a bit of research, we realized that our single-shielded SMA cables inside the attenuator were not really up to the task.  They are made with RG-316 cable, which is only single shielded.  It's hard to get solid numbers on how well it actually shields, but some similar cable was reported to shield at only -50 dB or so.  For the attenuator to work well, we need shielding at > 90 dB.

It is actually fairly easy to order SMA to SMA cables that have double-shielded cable, I had just not realized the importance when ordering the previous batch.  I put in an order for some cables using KSR-100 cable, which has an aluminium shield as well as woven shield, and claims > 90 dB shielding.

But, that will take a week or two to arrive...  I had previously ordered a roll of copper tape, and thought wrapping my existing single-shielded cables with copper tape would add some much needed signal shielding.  After a bit of fairly tedious work, all 6 cables were done and back in the attenuator.




I reconnected the AP and Station machines to the attenuator and ran some more tests.  Throughput was around 340Mbps at lower attenuation levels, which is great performance.  But, even when the attenuator was set to 95 dB attenuation, I still saw signal strength of around -71.  This was significantly worse signal leakage than before!  I then took some aluminium foil and wrapped the (fanless) AP and Station machines as completely as I could, being careful to crimp it in around the cables.  After wasting several yards of aluminium foil, I was disappointed to see that I had at most shaved 1 dB off the leakage.  I removed all the foil...

I knew that the SMA to U.fl pigtails inside the AP and Station were also single-shielded, and even thinner than the SMA to SMA cables.  So, I took those machines apart and copper-clad those cables a well.  While looking closely at the U.fl ends, I noticed that there is a small bit of cable that is without shielding.  I tried to wrap this part with copper tape as well.  I again connected everything together and ran some more tests.  Now the signal level would go a bit lower, around -76 dB with full attenuation.  This is still worse than before I copper-clad anything, but at least cladding the U.fl pigtails seemed to help a little.

At this point, I could only assume that adding copper cladding to the cables in the attenuator made them leak more instead of less.  Perhaps the small amount of signal that leaks out of the cable shielding is then amplified by the copper tape I had added.  I cut open a double-shielded LMR-195 cable and noticed that its foil layer was just under the woven metal shielding (and the woven shielding was under a rubber insulating layer).  Maybe that makes all the difference.  I removed all the copper clad cables and put the unmodified single-shielded cables back in place.

I directly connected some LMR-195 cables from the AP to the attenuator modules.  I had to leave the Station modules using the single-shielded cable since I had only 3 of the correct type of SMA adapters for the LMR-195 cables.  This brought total isolation back up to around -80 dB, right around where I started at the beginning of the day!



There are companies (such as rfmall.com) that sell double-shielded SMA to U.fl cables, so I ordered a few sets of pigtails from them.  I'll try this all again when the new cables arrive.

In summary:  WiFi signal isolation is not trivial.  You have to pay close attention to cable types and connector construction, and solutions that appear obvious may actually exacerbate the problem!

Monday, October 8, 2012

Programmable Attenuator: Rate v/s Attenuation

I spent some time over the weekend integrating the Attenuator with the LANforge hunt script logic.  The hunt script iterates through packet sizes and attenuation settings.  At each iteration, it runs tests and adjusts the transmit rate to find the highest rate that meets constraints (latency, packet-loss, etc).  The best run for each iteration is saved for reporting.

Here's the Hunt Script configuration for this run:



The graphs below are two views of the 3D graph that shows the relationship between UDP payload size, WiFi RX-Signal level, and RX-BPS.  The test case is an AP connected through the attenuator to a WiFi station system.  The test shows that at very low attenuation (less that you would see in over-the-air testing), throughput suffers, and it starts suffering again at around -55 signal quality.  Larger PDU sizes help throughput as well, but at least some of that is because the AP system has a fairly weak CPU and was running lots of other processes when this test was running.  I still need to work on better RF shielding, so the signal does not go below about -75 dBm.



Friday, October 5, 2012

Programmable Attenuator: Arduino Shields

I received the Arduino Mega shields back from OSH Park a few days ago.  I like they look and feel of the boards, and through some stroke of luck, it seems they actually work as designed.  Here are two of the boards, one partially populated with connectors that will be used to drive the Attenuators.




I soldered on the rest of the parts, stealing headers from an Arduino Mega proto-shield.  I put together another LCD Shield from Adafruit.  I don't yet have the front-panel board, so the LCD was wired directly into the headers.  When the front-panel board is ready, the 12-pin header should connect to it.  The front panel will connect to the two rotary encoders (one for menu selection, one for adjusting attenuator values) and the LCD panel.  Here's the new shield running, but without attenuators attached.


A few days later, I found time to install the new components in a new aluminium case.  Stamping the metal is quite costly, so I did it by hand with a hand punch, drill, and lots of quality time with a 'nibbler' to cut out the rectangular holes for LCD and USB plug.  I put the LCD panel hole too low, so it's been hacked a bit and is no longer level.   I need to move the attenuator modules closer to the panel mounting holes so that the cables don't have to stretch quite as far too.  Will be more careful measuring the next one!



With my new attenuator in hand, I set about trying to test it.  I set up two Atom based systems with Atheros 9380 3x3 MIMO wifi adapters.  These each have three antenna, and I connected on to each of the attenuator modules.  After lots of fiddling around, I had the station uploading to the AP at what I believe is near maximum speed, about 330Mbps UDP throughput.  The download speed from AP to Station is only about 230Mbps, but I have not had time to figure out why there is such a discrepancy.  I updated our LANforge software to graph the rx-signal and wifi link speed and ran some tests with the Attenuator.  The attenuation starts at 20 and is adjusted in increments of 5 up the the max of 95.5.  Due to RF leakage in the AP and Station systems, the signal is never completely extinguished, but it does go to about -82 dBm signal, with noise at about -93.  It is still able to pass traffic reliably (at lower rates) at this attenuation.  Here's a graph of the results.  Note that the signal quality is on the left-hand axis, so it is not to scale with the other graph lines.  Overall, it seems that the system handled the test well.

Wednesday, October 3, 2012

Programmable Attenuator

We have been improving our LANforge WiFi traffic generator at work, and one of the things we were curious about is how the ath9k NIC/driver works over various distances.  One option would be to spend weeks walking around and taking various throughput measurements.  A second option is to use a WiFi programmable attenuator and some co-axial cables.  The attenuator diminishes the signal between AP and Station devices, acting similar to increased physical distance.

There did not seem to be any vendors providing affordable attenuators, so we decided to build one ourselves.  I quickly settled on the Arduino micro-controller as the brains of the attenuator.  There were other interesting systems that could have worked, like the Beagle Board, but the attenuator modules we are using need +5v TTL, and Beagle Board uses +3.  I have been very satisfied with the Arduino Mega.  After mucking with full operating systems all my professional life, it is a joy to work with such a simple programming environment, and at the same time have the ability to easily
sense and control the physical world.

I ordered the Arduino Mega, Arduino proto shield, starter packs and various other electronic goodies from Adafruit, digikey, local hardware stores, and various other places.  The attenuator modules come from Eubus Electronics.

After a few hours of learning curve, I had hello-world working on the Arduino, and shortly after, I had basic functionality controlling the attenuator modules.  Next, I needed some useful physical input/output, so I ordered the Arduino LCD shield from Adafruit.  It comes with a small set of directional buttons so I could select the different attenuator modules and adjust the attenuation up or down.

Since the Arduino Mega has plenty of pins, and there was some question of heat dissipation when the system is enclosed in a real chassis, I added a simple heat sensor.  It has only 3 pins, but I managed to wire it up backwards (+5 to ground, ground to +5).  It got hot enough to melt the plastic insulators on the wires and smoke a bit of my fingers before I got it disconnected.  Luckily, once I had it wired properly, it seemed to work just fine, so I guess it's one tough sensor.

One problem with the LCD panel is that there is no good way to get access to the buttons through the front panel.  We decided to use two rotary encoders (one to select menus, one to adjust values up/down) instead of buttons.  It took a while to get the rotary code working properly, much of which probably can be blamed on me not fully understanding the consequences of using pull-up v/s pull-down logic on the encoders.  Eventually I got it working, using interrupts and a 2ms de-bounce time.

At this point, I began worrying about how we could manufacture this (in small quantities) reliably.  There was quite mess of wires, even with efforts to use ribbon cables where we could, and as working with the Temp Sensor showed, it is way to easy to get pins mixed up.  Smoking a $2 sensor is one thing..but the Attenuator modules cost significantly more!  After poking around, I found an excellent guide for building your own Arduino Shield.  This guide suggests using the Eagle PCB design software, and it seems to work quite well.  After a few days of poking around, I had the first revision finished and ready to send off for printing.  I used OSH Park, as suggested by the Arduino Shield guide.  The price is right, and the web site is simple enough.  I've yet to receive the boards, but hope to do so shortly!

Here's a picture of the Rev-0 attenuator project!