Mikrotik router audio alignment script.

This helpful script was given to me.  It was sent to me by WISP-Router (http://www.wisp-router.com/).  Casey told me it was sent to them by one of their customers.  It will create a beep that changes frequency as the alignment gets better/worse.  Requires (of course) a MT router with a speaker onboard.

:local beep “10ms”;
:local no “2400ms”;
:local 90 “1290ms”;
:local 85 “790ms”;
:local 80 “590ms”;
:local 77 “390ms”;
:local 74 “290ms”;
:local 71 “240ms”;
:local 68 “190ms”;
:local 65 “140ms”;
:local 62 “90ms”;
:local 59 “60ms”;
:local 56 “40ms”;
:local 53 “20ms”;
:local 50 “10ms”;
:for i from=1 to=100 do={
/interface wireless monitor wlan1 interval=1 do={
:if ($signal-strength <= -90) do={
:delay $no;
}
:if ($signal-strength <= -85 && $signal-strength > -90) do={
:for i from=1 to=2 do={ :beep length=$beep; :delay $90; }
}
:if ($signal-strength <= -80 && $signal-strength > -85) do={
:for i from=1 to=3 do={ :beep length=$beep; :delay $85; }
}
:if ($signal-strength <= -77 && $signal-strength > -80) do={
:for i from=1 to=4 do={ :beep length=$beep; :delay $80; }
}
:if ($signal-strength <= -74 && $signal-strength > -77) do={
:for i from=1 to=6 do={ :beep length=$beep; :delay $77; }
}
:if ($signal-strength <= -71 && $signal-strength > -74) do={
:for i from=1 to=8 do={ :beep length=$beep; :delay $74; }
}
:if ($signal-strength <= -68 && $signal-strength > -71) do={
:for i from=1 to=10 do={ :beep length=$beep; :delay $71; }
}
:if ($signal-strength <= -65 && $signal-strength > -68) do={
:for i from=1 to=12 do={ :beep length=$beep; :delay $68; }
}
:if ($signal-strength <= -62 && $signal-strength > -65) do={
:for i from=1 to=16 do={ :beep length=$beep; :delay $65; }
}
:if ($signal-strength <= -59 && $signal-strength > -62) do={
:for i from=1 to=24 do={ :beep length=$beep; :delay $62; }
}
:if ($signal-strength <= -56 && $signal-strength > -59) do={
:for i from=1 to=34 do={ :beep length=$beep; :delay $59; }
}
:if ($signal-strength <= -53 && $signal-strength > -56) do={
:for i from=1 to=48 do={ :beep length=$beep; :delay $56; }
}
:if ($signal-strength <= -50 && $signal-strength > -53) do={
:for i from=1 to=80 do={ :beep length=$beep; :delay $53; }
}
:if ($signal-strength <= -20 && $signal-strength > -50) do={
:for i from=1 to=120 do={ :beep length=$beep; :delay $50; }
}
}
}

2 Responses to “Mikrotik router audio alignment script.”

  1. randy Says:

    I made a few modifications to this for my use. I tried to document more of it, and make it more configurable. Hopefully this is helpful to someone:

    
    # 10 sec delay required by ROS3 for startup scripts?
    :delay 10
    
    # set the interface you want to monitor
    :local interface "wlan1";
    
    #set the sound frequency you want to use (in Hz)
    :local beepfreq "523.251";
    
    
    #set the number of iterations - approx 1-2 seconds per iteration
    :local iterations "150";
    
    :local beep "10ms";
    :local no "2400ms";
    :local s90 "1290ms";
    :local s85 "790ms";
    :local s80 "590ms";
    :local s77 "390ms";
    :local s74 "290ms";
    :local s71 "240ms";
    :local s68 "190ms";
    :local s65 "140ms";
    :local s62 "90ms";
    :local s59 "60ms";
    :local s56 "40ms";
    :local s53 "20ms";
    :local s50 "10ms";
    :for i from=1 to=$iterations do={
    
    /interface wireless monitor $interface once do={
    
     :if ($"signal-strength" <= -90) do={
     :delay $no;
      }
     :if ($"signal-strength"  -90) do={
      :for i from=1 to=2 do={ :beep length=$beep frequency=$beepfreq;  :delay $s90; }
      }  
     :if ($"signal-strength"  -85) do={
     :for i from=1 to=3 do={ :beep length=$beep frequency=$beepfreq;  :delay $s85; }
      }
     :if ($"signal-strength"  -80) do={
     :for i from=1 to=4 do={ :beep length=$beep frequency=$beepfreq;  :delay $s80; }
      }  
     :if ($"signal-strength"  -77) do={
     :for i from=1 to=6 do={ :beep length=$beep frequency=$beepfreq;  :delay $s77; }
      }  
     :if ($"signal-strength"  -74) do={
     :for i from=1 to=8 do={ :beep length=$beep frequency=$beepfreq;  :delay $s74; }
      }  
     :if ($"signal-strength"  -71) do={
     :for i from=1 to=10 do={ :beep length=$beep frequency=$beepfreq;  :delay $s71; }
      }  
     :if ($"signal-strength"  -68) do={
     :for i from=1 to=12 do={ :beep length=$beep frequency=$beepfreq;  :delay $s68; }
      }  
     :if ($"signal-strength"  -65) do={
      :for i from=1 to=16 do={ :beep length=$beep frequency=$beepfreq;  :delay $s65; }
      }  
     :if ($"signal-strength"  -62) do={
      :for i from=1 to=24 do={ :beep length=$beep frequency=$beepfreq;  :delay $s62; }
      }  
     :if ($"signal-strength"  -59) do={
      :for i from=1 to=34 do={ :beep length=$beep frequency=$beepfreq;  :delay $s59; }
      }  
     :if ($"signal-strength"  -56) do={
      :for i from=1 to=48 do={ :beep length=$beep frequency=$beepfreq;  :delay $s56; }
      }
     :if ($"signal-strength"  -53) do={
     :for i from=1 to=80 do={ :beep length=$beep frequency=$beepfreq;  :delay $s53; }
      }  
     :if ($"signal-strength"  -50) do={
      :for i from=1 to=120 do={ :beep length=$beep frequency=$beepfreq;  :delay $s50; }
      }  
     }
    }
    
    
    		
  2. Mikrotik’s True Full Duplex Wireless – NStreme Dual - Persian Networks Says:

    […] antennas in another article in the future, but this is the basic process. You may wish to use the Audio Alignment Script to align the antennas. One other consideration before deciding to use the NStreme Dual connection […]

Leave a Reply

You must be logged in to post a comment.