Compliance Mode for Ubiquiti AirMax Radios

Sometime after “AirOS 5.3.3.9634.110726.1142” Ubiquiti took out what was called “Compliance Mode” that enabled frequencies outside of the Part 15 bands.  This was handy if you wanted to run these radios in Part 97 or Amateur or “Ham” Bands.   There was a simple way of doing this right after they took this out by just doing a …

 touch /etc/persistent/ct
 save
 reboot

Alas, this was taken out after a while.

After googling around and banging on this a bit, the “Country Code” for “Compliance Mode” that had an ID of 511 is now called “Licensed”.  You can find it in /var/etc/ccodes.inc.  The trick is to set the Atheros chipset on startup to the county code you want.   This would be done with a custom script that runs when the radio boots up.  You will need firmware that supports that that has “cs” in the file name.  Go to:

https://community.ui.com/questions/airOS-5-6-with-Custom-Script-Support-/4bd71c6b-7e9c-43ee-9d9d-666a7a9708fd#comment/e6d675ef-2e50-46f4-bf2a-7ef94dd12068

and find the firmware for your board (eg XM, XW or TI).  Upgrade the radio with this firmware.

After the upgrade and reboot, you can use this script that you should call “/etc/persistent/rc.poststart” with the following:

#!/bin/sh
# This is dependent on v6.3.0 of the firmware.  You may need 
# to point to the ubnt_spectral module someplace else if you
# have a different firmware version.
insmod /lib/modules/2.6.32.71/ubnt_spectral.ko
iwpriv wifi0 setCountry Ub
ifconfig ath0 down
ifconfig wifi0 down
sleep 5
rmmod /lib/modules/2.6.32.71/ubnt_spectral.ko
ifconfig ath0 up
ifconfig wifi0 up
echo "countrycode=511" > /var/etc/atheros.conf
# '840' is the Country Code for the US
sed -i 's/840/511/g' /tmp/system.cfg
echo "<option value="511">Compliance Test</option>" >> /var/etc/ccodes.inc

After creating this script, make sure you “chmod a+x /etc/persistent/rc.poststart” and the type “save” and “reboot”.

Once the radio has rebooted, you should be able to go to the “WIRELESS” tab and see that the Country Code is set for  Licensed.  If you select the “Frequency Scan List”, you should see a bunch of frequencies you can now select (see below).  Alas, the script does not survive the reboot, but that is fine as the change to “License” will survive reboots.  You can confirm this by ssh’ing into the radio and running the commands:

XM.v6.3.0# iwpriv wifi0 getCountry
wifi0     getCountry:UB 
XM.v6.3.0# iwpriv wifi0 getCountryID
wifi0     getCountryID:511 
XM.v6.3.0# 

I guess the Country “UB” is “Ubiquiti” 🙂

Ubiquiti Rockets and a 50Km Path Over Water…

FarallonsThis last fall, we put in a 50Km 5.8Ghz link from the center of San Francisco (Twin Peaks) to the South East Farallon Island lighthouse using Ubiquiti Rockets. At first the link was unusable. This was mainly due to the fact that the long distance and shooting over water causes the received signal to vary wildly. This cased the radios to frequently and rapidly try to change the MCS (modulation scheme) and would make the link very lossy. Here are some settings I had to settle on to get the links to work.

  • Do not enable auto-negotiate for the signal rate on long links. The radios will auto negotiate data rates when the receive signal level changes. This will momentary drop the link while the ends sync up. If the signal is bouncing frequently this will make the link pretty lossy or not usable at all.
  • Long links or links that are being interfered with will likely have problems with modulation schemes that have an amplitude component such as QAM. If so, use a modulation scheme that doesn’t have an amplitude component like BSFK where you can leverage “Capture Effect“. This would be MCS0 (1 chain) and MSC8 (2 chains).
  • Fix the distance of the link to about 30% over the calculated distance. The auto-magic calculation that AirOS does typically is wrong with long links.
  • Turn off AirMax on Point to Point links. AirMax is used to manage multiple clients on one AP more fairly. Not needed for P2P.
  • Use as narrow of a channel you can support for the bandwidth you need. As per the AirOS manual…
Reducing spectral width provides 2 benefits and 1 drawback.
  • Benefit 1: It will increase the amount of non-overlapping channels. This can allow networks to scale better
  • Benefit 2: It will increase the PSD (power spectral Density) of the channel and enable the link distance to be increased
  • Drawback: It will reduce throughput proportional to the channel size reduction. So just as turbo mode (40MHz) increases possible speeds by 2x, half spectrum channel (10MHz), will decrease possible speeds by 2x.

Great tool for checking Line of Sight…

Google Maps has opened up access to resources that would take considerable work and expense to access. Just purchasing software that can do ray tracing over a geographic area 10 years ago would have cost tens of thousands of dollars. Now “HeyWhatsThat” has leveraged Google Maps to do just this and it is free.

Now, why would I be so interested in this site? Being a bit of a wireless geek, it is a great starter tool to understand how much coverage area a mountain top has. In the example shown in the right you can see the coverage area from the Twin Peaks communications site in San Francisco. The orange/red overlay indicates area that this site can see. You can see the shadowing of some of the hills of San Francisco affecting the coverage area.

At the top of the frame, shows a panorama of the skyline seen from that site. The list on the right shows what mountain tops can been seen and distance to them.

HeyWhatsThat is a great starting point in checking out coverage area. I wouldn’t throw away your $50,000 coverage software just yet as that will be a bit more accurate using better algorithms to calculate coverage such as Longley Rice and TIREM as well as their own tweaks.

Homebrew GSM with OpenBTS

Unlike most of San Francisco who was at Burning Man, I was out this last week at the Strawberry Music Festival so there was another gap between postings. There are a couple of interesting stories from Strawberry I will get into later. But for now…

I was having lunch with John Gilmore who was freshly back from Burning Man. Stories abound the festival but one that I zeroed into was the experiment of one of the camps at Burning Man to build a GSM celluar service on a Software Defined Radio (SDR). John was certainly tracking this as he help start gnuradio which is an open-source SDR package that is currently lead by Eric Blossom. Matt Ettus is a another notable as he had created the default hardware platform that Gnuradio runs on.

SDRs are radios where the hardware is designed to be very general purpose so as to receive and/or transmit many different types of modulation and frequencies. The software for SDRs do all the work of setting the frequencies and what to do with the received signals. Hence the name of Software Defined Radio where the software models a hardware design that would create a building block such as single-sideband modulation or a quadrature FM detector. As such, a critical component in an SDR is an Analog to Digital (ADC) or a Digital to Analog Converter (DAC) where the software will do all the math in the digital domain of the analog wireless signal.

What was interesting to me with this deployment was the fact that OpenBTS project built an SDR radio that would transmit and receive on cellular GSM frequencies and become a base station for GSM cell phones. Not only that, they took an open source phone switch called Asterisk and, using VoIP and the Internet connection at Black Rock City, provide cell service to the public switched telephone network PSTN.

Providing service at Burning Man was a stroke of genius as the OpenBTS folks had a great test bench of almost no existing cell coverage there and thousands of attendees that have their cell phones turned on. In fact, this test site was a bit too successful as every GSM phone tried to associate with their setup in almost an inadvertent denial of service attack. Their rig, had a hard time keeping up with the cell phone requests. After they resolved this issue, they were experimentally passing phone calls from Black Rock City off to real telephone numbers around the world.

Now, this is all fun playing with Asterisk and OpenBTS in the middle of North America where wireless phone service is taken for granted. For instance, in the United States we usually have at least two or three base wireless phone carriers providing service to an area. Although these deployments are ubiquitous in first world countries, the current cell phone tower installation is expensive and financially prohibited in deploying in third world nations or even many lightly populated areas in the US. Using Asterisk that easily replaces a 10s or 100s of thousand dollar phone switch help reduce the cost of deploying wireless cell service. In the case of the Burning Man deployment, OpenBTS was able to put a rather effective Cell site for under $5,000. With this low cost of deployment and the combination of OpenBTS and Asterisk vast areas of the earth that are not covered by phone service now could be covered by open source cell phone deployments.