# WiFi Signal Monitor in WL

Posted 5 years ago
13395 Views
|
5 Replies
|
17 Total Likes
|
 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.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],InternalStringToDouble[#],#]&/@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:
5 Replies
Sort By:
Posted 5 years ago
 Very cool.
Posted 5 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 5 years ago
 Very nice post!Thanks, M.
 On Windows you can usedata = ReadList["!netsh wlan show networks mode=bssid", "String"];`The tidying up will be slightly different however.