Message Boards Message Boards

WiFi Signal Monitor in WL

Posted 10 years ago

Inspired by this Stack Exchange answer from @rm-rf, and question of @dmurta , I created this simple WiFi signal monitor with Wolfram Language. It works just for MAC, but I believe that a Windows version would be not too hard to implement. It's a cool way to test your WiFi signal in different places of your house or office.

In this gif, I have moved to far and then to near from my WiFi base station. The Notebook is available below. Code suggestions/improvement are always welcome.

WiFi Signal Animation

Here is the code:

getSignal[]:=Module[{data},
    data=ReadList["!/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I","String"];
    data=Rule@@StringSplit[StringReplace[StringTrim@#," "-> ""],":",2]&/@data;
    data[[All,2]]=If[StringMatchQ[#,NumberString],Internal`StringToDouble[#],#]&/@data[[All,2]];
    data
]
(*dd=getSignal[]*)

plot[data_]:=ListPlot[Transpose@data
       ,PlotRange->{{0,10},{-100,0}}
       ,AxesOrigin->{0,-100}
       ,Joined->True
       ,PlotStyle->{Directive[Darker@Green,Thick],Directive[Darker@Red,Thick]}
       ,Background->Black
       ,AxesStyle->White
       ,DataRange->{0,10}
       ,AspectRatio->0.4
       ,BaseStyle->{FontFamily-> "Helvetica"}
       ,PlotLegends->(Style[#,White,FontFamily->"Helvetica"]&/@{"Signal Strength (dBm)","Signal Noise (dBm)"})
       ,PlotLabel->Style["Measuring WiFi Signal Strength",14,White]
]//Panel[#,Background->Black]&
(*plot[RandomInteger[{-100,0},{40,2}]]*)

wiFiMonitor[]:=DynamicModule[{data,runQ=False},
    data=ConstantArray[Null,{40,2}];
    Dynamic[
     Refresh[
        If[runQ,data=Most@Prepend[data,{"agrCtlRSSI","agrCtlNoise"}/.getSignal[]]] (*RSSI - Received Signal Strength Indication*)
       ;Deploy@Grid[{
           {Row@{Button[Dynamic[If[runQ,"Stop","Start"]],runQ=Not@runQ,Background->White,ImageSize->100],Button["Reset",data=ConstantArray[Null,{40,2}],Background->White,ImageSize->100]}}
          ,{plot[data]}}
          ,Background->Black
          ,Dividers->White
          ,Alignment->Left
         ]
    ,UpdateInterval->0.25
    ,TrackedSymbols->{}]
    ]
    ,SaveDefinitions->True
]
wiFiMonitor[]
Attachments:
POSTED BY: Rodrigo Murta
5 Replies

On Windows you can use

data = ReadList["!netsh wlan show networks mode=bssid", "String"];

The tidying up will be slightly different however.

POSTED BY: Danny Finn

Very nice work, thanks for sharing!

POSTED BY: Sander Huisman

Very nice post!

Thanks, M.

POSTED BY: Marco Thiel
Posted 10 years ago

Importing a map of your place (probably as a picture), and devising a tour on it on a specified speed, with an interactive indicator of where you should be on a specific moment, and then collecting data tied to interpolated locations may provide you enough data to generate an interpolated map of base station signal strenght(s).

I did this with a mishmash of Unix tools on a big university faculty roughly a decade ago; it was somewhat tedious to put the data together (should be much easier with Mathematica!), but with multiple base station signal strengths, it was possible to also identify locations of attentuating materials, such as load-bearing walls, concrete columns and elevator shafts.

POSTED BY: Jari Kirma

Very cool.

POSTED BY: David Reiss
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract