Spectrum sensing at w-iLab.2¶
There are several ways to do spectrum sensing at w-iLab.2.
Using the WiFi cards¶
Scanning for access points
The simplest form of spectrum scanning involves searching for other wireless access points. Log into a WiFi node (ZOTAC/DSS/APU) and run the following commands:
ifconfig wlan0 down
iwconfig wlan0 mode managed
ifconfig wlan0 up
iwlist wlan0 scan
If everything went well, then you should now see all the access points which are in range of the sniffing WiFi node. The Signal strength of the access points is expressed in dBm and will vary somewhere between -40dBm (signal is strong) to -90dBm (signal is very weak).
If you prefer a fancier representation of the info, you can use the following commands:
apt-get install wavemon
ifconfig wlan0 down
iwconfig wlan0 mode managed
ifconfig wlan0 up
wavemon -i wlan0
# type 's' to start scanning , type 'q' to quit
Energy detection using the ath9k wireless driver
The ath9k driver can be used to do energy detection with the WiFi cards installed in ZOTAC nodes (both phy0 and phy1), DSS nodes (only phy1) and MOBILE nodes (only phy1). More information on the spectral scan functionality of ath9k.
If you are not running your experiment on w-iLab.2, then you first need to compile the source code:
apt-get install libnl-genl-3-dev
git clone https://github.com/WirelessTestbedsAcademy/BasicSensing.git
cd BasicSensing/wilabt/ath9k_spectral_scan
make
To start the scanning:
sudo iw phy phy0 interface add mon0 type monitor
sudo ifconfig mon0 up
sudo iw dev mon0 set channel 11
sudo /share/upload/omf6/wifitests/ath_spec_scan -p phy0 -t -70
You should now see the Channel Occupancy Ratio (COR) of channel 11 (2462MHz). Try setting up an iPerf stream between 2 wireless nodes near the sniffer node and see what the impact is on the COR.
The output looks like this:
current_time sniffer_mac frequency COR previous_dur
- current_time: Starting unix epoch timestamp (milliseconds)
- sniffer_mac: sniffer node mac address
- frequency: sniffing frequency
- COR: Channel Occupancy Ratio
- previous_dur: measurement duration (milliseconds)
To show all options of the spectral scan tool:
./ath_spec_scan -h
There is also a more advanced version that is capable of displaying RSSI values of WiFi and ZigBee. This version is compatible with OML and can thus easily store its data in an OML server (or just a local file if no OML server is available).
apt-get install libnl-genl-3-dev
git clone https://github.com/WirelessTestbedsAcademy/BasicSensing.git
cd BasicSensing/wilabt/ath9k_spectral_scan/oml
make
sudo iw phy phy0 interface add mon0 type monitor
sudo ifconfig mon0 up
sudo iw dev mon0 set channel 11
sudo ./ath_spec_scan -p phy0 -t -70 --oml-id test1 --oml-domain ath_spec_scan --oml-collect file:test1.log