Community discussions

MikroTik App
 
restebanez
just joined
Topic Author
Posts: 3
Joined: Tue Oct 13, 2009 12:24 pm

Antenna switch script

Tue Oct 13, 2009 12:38 pm

Hello everyone.

We are developing a communications system for an UAV helicopter using mikrotik boards. The heli is equipped with a SR2 with two antennas, one located at the left side of the UAV an the other at the right side, so regardless of heli orientation, we have at least one antenna with clear line of sight.

We use a simple script that is monitoring signal strength, and when it's not a value below zeor, we switch antennas.
Here is the code of the script that makes the switching...
:global radio "wlanSR2";
:global countdown 0;
:global signal;
:global ant;

:log warning "Connection Lost on $radio";
:set ant [/interface wireless get $radio antenna-mode];
:if (ant = "ant-a") do={
/interface wireless set $radio antenna-mode=ant-b;
}
:if (ant = "ant-b") do={
/interface wireless set $radio antenna-mode=ant-a;
}
:set countdown 10;
:set signal 0;
:while ((countdown != 0) && (! (signal<0)))  do={
:delay 500ms;
/interface wireless monitor $radio once do={:set signal $"signal-strength";}
:set countdown ($countdown-1);
:log warning "Waiting connection on $radio. Countdown # $countdown . Signal:$signal";
}
}

It just changes the antenna-mode value, and if I run this script manually,antenna switch and reconnection is made in less than a second.

The problem is when I try to call this Script from the Monitor script... here's the monitor script code.
:global radio "wlanSR2";
:global signal;
:global snr;
:global noise;
:global thruput;
:global freq;
:global ccq;
:global voltage;
:global rxvar;
:global txvar;
:global txpower;
:global countdown;
:global ant;
:global divisor 0;

:while (1=1) do={
/interface wireless monitor $radio once do={:set signal $"signal-strength";}

:if (! (signal<0)) do={/system script run cambia}

:led user-led=yes;
:set divisor ($divisor+1);
:if (divisor = 5) do={
/interface wireless monitor $radio once do={
:set signal $"signal-strength";
:set snr $"signal-to-noise";
:set noise $"noise-floor";
:set thruput $"p-throughput";
:set freq $"frequency";
:set ccq $"overall-tx-ccq";
:set txpower [/interface wireless get $radio tx-power];
:set voltage [/system health get voltage];
/interface monitor-traffic $radio once do={
:set rxvar $"rx-bits-per-second";
:set txvar $"tx-bits-per-second";
}
}
:set divisor 0;
:log info "RadioName:$radio-$ant_SNR:$snr_Signal:$signal_Noise:$noise_Thruput:$thruput_Freq:$freq_CCQ:$ccq_Volt:$voltage_RX:$rxvar_TX:$txvar_TxPower:$txpower";
}

:delay 45ms;
:led user-led=no;
:delay 45ms;

}
When the switch script is called from the monitor script, antenna switching and reconnection takes about 5 seconds !

Anyone knows why?

Thank you in advance.
 
User avatar
Ibersystems
Forum Guru
Forum Guru
Posts: 1686
Joined: Wed Apr 12, 2006 12:29 am
Location: Cabrils, Barcelona - Spain
Contact:

Re: Antenna switch script

Wed Oct 14, 2009 12:35 am

only a idea.. perhaps it's not the solution:


Configure the AP as bridge, with WDS.
The heli antennas as wds too.

Try to connect both antennas to the AP.

The bridge mode only accepts 1 remote connection at the same moment. When the heli turns, the other WDS will connect to the AP, but only one at the same time.

Make a bridge with the 2 WDS in the heli.

I think it will be faster than 5 sec.
 
restebanez
just joined
Topic Author
Posts: 3
Joined: Tue Oct 13, 2009 12:24 pm

Re: Antenna switch script

Thu Oct 15, 2009 1:43 pm

Hi Again.

Thank you for your answer. I tried your suggestion, and it worked , althought re-connection time was about 10 secs... :-(

I re-coded my scripts again and finally i'm able to reconnect in no more than 3 secs (many times in just 0.2 secs! ).
 
tshado
just joined
Posts: 3
Joined: Tue Apr 06, 2010 3:24 pm

Re: Antenna switch script

Tue Apr 06, 2010 3:41 pm

hello restebanez, Ibersystems

@Restebabez : i plan to use WIFI for telemetry (and perhaps later video link) for an aircraft UAV.
I have found your discussion
I would be very interested in having details about your hardware setup on your helicopter and Ground station.
Do you use your WIFI link also for telemetry only or other like control or video link?
What were the antennas you used on your UAV and Ground station?
What range were you able to fly?
Are you using Linux and with board did you use ?
Also could you share with me your latest script ?

I hope both you will read my message and i will appreciate to discuss with you

Best regards,Jean-Claude
 
User avatar
Ibersystems
Forum Guru
Forum Guru
Posts: 1686
Joined: Wed Apr 12, 2006 12:29 am
Location: Cabrils, Barcelona - Spain
Contact:

Re: Antenna switch script

Wed Apr 07, 2010 12:24 pm

Hello,

I don't know if this will work at such speed.

You could cover all the air with some sector antenas putted in the ground, but I think it will be very difficult.

You need to try if you have connectivity at such speed with one antena and one client in the aircraft and how many KM you can reach, and later try to cover all the zone.

I think the problem is the type of antena in the client side.
 
tshado
just joined
Posts: 3
Joined: Tue Apr 06, 2010 3:24 pm

Re: Antenna switch script

Wed Apr 07, 2010 4:15 pm

Hello Martin,
Thanks for you reply.
I would like to establish a WIFI link between an UAV(aircraft or helicopter)
About the range i would like to try between 3 and 5 km.
This is what i was thinking about :
on the UAV, having a Bullet2 running Linux RouterOS with a 2,4 Ghz 9dB antenna.
I can have a Bullet 2 with up to 1 W power in Xmit
On the ground side, connected to a laptop running Linux, an Alpha WIFI to USB adapter (1W)
For the antenna i was planning to have a Patch antenna on a tracking system to follow the UAV.
What do you think about this setting?
Is there some kind of QoS in RouterOS if i want to add Video to telemetry link?
(of course i will start with telemetry which has a "small" bandwith)
What kind of latency range can i expect if you have an idea?
Could i benefit from using on the UAV two antenna's and a script like described by restebanez?
Do you have any remarks our suggestions ?

Thanks,Jean-Claude
 
User avatar
Ibersystems
Forum Guru
Forum Guru
Posts: 1686
Joined: Wed Apr 12, 2006 12:29 am
Location: Cabrils, Barcelona - Spain
Contact:

Re: Antenna switch script

Thu Apr 08, 2010 9:25 am

Alpha wifi?!

Use a routerboard with ubiquity xr2..
 
tshado
just joined
Posts: 3
Joined: Tue Apr 06, 2010 3:24 pm

Re: Antenna switch script

Thu Apr 08, 2010 6:40 pm

Hello Martin

I don't have a free mini-PCI slot in my Laptop for the XR2 card
So i plan to have a bullet2 connected to my Laptop
Could you help me for the antenna choice
-for the airplane bullet2 (i will remove plastic case and heavy N connector and solder in a 90 degree RP-SMA connector to have a light weight)
-For the bullet2 on the ground connected to the laptop?

Thanks for your help,
Jean-Claude
 
User avatar
Ibersystems
Forum Guru
Forum Guru
Posts: 1686
Joined: Wed Apr 12, 2006 12:29 am
Location: Cabrils, Barcelona - Spain
Contact:

Re: Antenna switch script

Fri Apr 09, 2010 11:04 am

Use a routerboard with ubiquity xr2 in the ground.. and the bullet in the aircraft if you like it.

the 2404 or 2406U hiperlink are good, but I don't know if they will work, depending of the height you fly.
 
someuser
Member Candidate
Member Candidate
Posts: 102
Joined: Tue Apr 13, 2010 7:05 am

Re: Antenna switch script

Sun Aug 01, 2010 12:07 pm

Use a routerboard with ubiquity xr2 in the ground.. and the bullet in the aircraft if you like it.

the 2404 or 2406U hiperlink are good, but I don't know if they will work, depending of the height you fly.
Hi,
I tried your site.
Here in the U.S., yet I can't seem to be "allowed to request info"

Who is online

Users browsing this forum: cyrusd and 9 guests