Thoughts on improving Video downlink

Joined
Feb 12, 2017
Messages
25
Reaction score
16
I was bored and thought I would do some poking around in the RC.
Found the default for wifi distance calcs on mine are disabled.
Coverage class: 0 (up to 0m)
I made a comment in another thread on why Magic Power works in FCC areas due to the ack packet timeouts and remembered there was a patch a few years back that enabled auto calculations.

I could not get the RC to accept the auto setting to enable this but I did find The coverage class can be adjusted.
I have found the following:
2 up to 900m
3 up to 1350m
4 up to 1800m
5 up to 2250m
6 up to 2700m
7 up to 3150m
8 up to 3600m
The RC will accept any of the above settings. I have not tried them but believe at longer distances the settings will make a difference.

Hopefully I can start a discussion. I know there is a math equation that calculates distance from the RSSI signal based on frequency. I was hoping to use this calc to get an estimated distance. Then change the coverage class to the above setting corresponding to the calculated distance.

Magic power uses up to class 5 to improve video based on signal strength. I have seen others taking the P3S to further than 2250m so a way to use 6 & 7 might get them further. PapaTita may have already looked in this area an I am not going to re-invent the wheel. If the idea works he may add it into his program.

I am ok with scripting but I am not a expert with maths! This is where help is needed.
This is the equation I have found to work out distance in metres using freq in Mhz

distance metres = 10 ^ ((27.55 - (20 * log10(frequency)) + signalLevel)/20)
have tried a few examples but can not get it to work for me.

Any ideas.
 
Im a noob at this.

can we not just modify this section of his script, the problem is how does signal strength correlate to distance. and what coverage classes should be set at what distances? I cant find much info on this.

Code:
iw phy phy0 set distance <distance meters> ;# set appropriate coverage class (0-114750)
iw phy phy0 set coverage <coverage class> ;# set coverage class (1 for every 3us of air prop time 0-255)

What does ' iw set distance' do, does it set the coverage class based on distance?

Code:
if [ "$RXSIG" == "" ] || [ $RXSIG -eq 0 ] ; then
    COVERAGE=0
    LIMITCHANGE=1
    LIMIT=$MAXPOWER
    DRONELIMIT=$MAXPOWER
  elif [ $RXSIG -le -65 ] ; then
    COVERAGE=2
    if [ $RXSIG -le -75 ] ; then COVERAGE=3 ; fi
    if [ $RXSIG -le -85 ] ; then
      COVERAGE=4
      LIMITCHANGE=1
      LIMIT=$MAXPOWER
      DRONELIMIT=$MAXPOWER
      if [ $RXSIG -le -90 ] ; then COVERAGE=5 ; fi
    fi
  fi
 
Last edited:
ikWwd2p.png

Light travels approx 300m in 1μs. so these are correct for one way distances
2 up to 900m
3 up to 1350m
4 up to 1800m
5 up to 2250m
6 up to 2700m
7 up to 3150m
8 up to 3600m

As for the drones distance. after reading this
Understanding Wireless Range Calculations
It seems there are just too many variables to make this accurate enough. So how about just taking the drone out and creating a table from the indicated iwinfo power and gps distance? it will likely be more accurate as it will be bespoke for the actual hardware and surroundings. You could also make multiple tables for different combinations of hardware

I think this will be my next project too. As i fly multiple miles now.
 
Last edited:
Dan, Wow, a heap of questions.. That is good. These are my thoughts regarding your comments.
can we not just modify this section of his script
You could but I think the section you refer to needs attention to get it to work better. It is also part of PapaTita's program and I think it is his choice if he wants to change/modify it. I had already made my own changes to my system to get range increase before I found this forum. The result of getting higher transmitter output is the same, but written differently than Papas.

the problem is how does signal strength correlate to distance. and what coverage classes should be set at what distances? I cant find much info on this.
I don't think we should use just signal strength, as we all know different setups get different ranges. I am sure they all have weak signal strength reported at their max range. Setting the coverage to 5 (~2200m) would not work for those only getting 7-800m before RTH.

Another thought is to send a few ping packets to/from the AC and using the average time to alter the coverage setting. The time for a packet is relational to the distance not the signal level. We use a permanent 4klm wifi bridge for our LAN and it averages a return packet time 1.13ms year round.
Transmission time - Wikipedia
I also found this document. A lot of reading. https://www.net.in.tum.de/fileadmin/bibtex/publications/papers/tkn_04_16_paper3.pdf

I wanted to get the discussion going.

If there was a way to calculate distance approximately would be better.

Most mobile devices use wifi signal strength to triangulate your position more accurately than GPS. Figure the maths used in relation to signal strength the rest is easy.

If you use the following and set different distances, example for 2000 metres
Code:
iw phy phy0 set distance 2000
then use:
Code:
iw phy phy0 info
It will show the class it has set to suit the distance you enter. That is where I got the table of distances for class 2 to 8.

Light travels approx 300m in 1μs. so these are correct for one way distances
I think the distance is one way from a to b and the propagation time (class) is allowing for the return trip - transmit out & receive the ack back..
 
  • Like
Reactions: dan84uk
I read your link, but i see no equations that can be used.

Some more info about calculating distance here
Wireless Calculator - Welcome to TP-LINK

So you first need to calculate fade margin, the free space path loss, then finally distance. Its going to be impossible to make a one size fits all equation with this method.

Im just going to first change the coverage manually by using the distance from the app. To test to see if it even makes any difference. if so create a table for my own personal setup.

I have a question. i notice papas set coverage loop is only in the controller script. Is this optimal?
 
Last edited:
Thanks for the link Dan.
Most of the info I can find is for fixed links and the distance is known. Our wifi link uses AirOs and the setup allows for auto adjust of the distance. This is an extract of the info on the setting.
Auto Adjust We recommend enabling the Auto Adjust option. Every time the station receives a data frame, it sends an ACK frame to the AP (if transmission errors are absent). If the station does not receive an ACK frame from the AP within the set timeout, then it re-sends the frame. If too many data frames are re-sent (whether the ACK timeout is too short or too long), then there is a poor connection, and throughput performance drops. The device has a new auto-acknowledgement timeout algorithm, which dynamically optimizes the frame acknowledgement timeout value without user intervention. This critical feature is required for stabilizing long-distance 802.11n outdoor links. This critical feature is required for stabilizing long-distance 802.11n outdoor links. If two or more stations are located at considerably different distances from the AP they are associated with, the distance to the farthest station should be set on the AP side.

I am of the opinion that using signal strength alone will not show a true distance.

Your idea of creating a table (Lookup table) is good for an individual solution.

Please let us know how you go with your test.

Another thought is the coverage is only changing the timeout value before a packet is considered lost. If it is too short it resends the data and waits again. Resulting in bad video. If we just set it once to our max distance and the timeout is longer at shorter ranges would it affect anything? Timeout value is only used if it doesn't receive the ACK.

In the quote above it is recommended to set the distance to the furthermost client and close clients are not affected.
The client end should also set the distance, so answering your question, I believe coverage should be set both ends.

Next flight I will set it fixed both ends at class 4 or 5 and only fly a few hundred metres to see what happens.

Went to try it today with and got invalid SD card warning..! Did not take a spare so we came home disappointed.

Regards
 
  • Like
Reactions: dan84uk
Thanks for the link Dan.
Most of the info I can find is for fixed links and the distance is known. Our wifi link uses AirOs and the setup allows for auto adjust of the distance. This is an extract of the info on the setting.


I am of the opinion that using signal strength alone will not show a true distance.

Your idea of creating a table (Lookup table) is good for an individual solution.

Please let us know how you go with your test.

Another thought is the coverage is only changing the timeout value before a packet is considered lost. If it is too short it resends the data and waits again. Resulting in bad video. If we just set it once to our max distance and the timeout is longer at shorter ranges would it affect anything? Timeout value is only used if it doesn't receive the ACK.

In the quote above it is recommended to set the distance to the furthermost client and close clients are not affected.
The client end should also set the distance, so answering your question, I believe coverage should be set both ends.

Next flight I will set it fixed both ends at class 4 or 5 and only fly a few hundred metres to see what happens.

Went to try it today with and got invalid SD card warning..! Did not take a spare so we came home disappointed.

Regards

I agree the signal strength isnt a great solution especially as the drone has patch antennas and not omi, so as soon as it rotates its immediately inaccurate, so they would need to be changed or code written to stop coverage going up and down. Your latency timing is the best idea for an all round solution i think , if you can get the resolution, good luck with that lol.

Yes i was wondering if just setting the coverage just once at the start of the flight to distance you intend to reach would work also work ok close range. Just tested it at coverage 9, works fine close range, set both controller and drone to 9. I wish the weather would behave so can go out and do some testing.
 
Last edited:
I can confirm no negative effects from setting the coverage to 5000m before take off, if anything the video was smoother a close range. No distance script needed. Ive left it at 5000m :D
 
and how can you change the signal class? Is there a tutorial somewhere? Thank you
 
and how can you change the signal class? Is there a tutorial somewhere? Thank you

Ive removed magic power and used my own script. Magic power is fine and will set coverage class for you, up to 2250m, im not sure how accurate it is though. So if you haven't already just use that.

Oh and thank you Oz for creating this thread and bringing coverage class to my attention.
 
That is great news Dan. I have only had time to do a quick flight to get a baseline. I had not tried any distance runs other than to see how far the AC would go. (it wasn't far). My base test I went out to 1200 metres (17db) and logged the ping times.

I was hoping extending the ACK timeout would not be an issue at close range.

If you are not going out to the 5k I would probably set it lower like class 7 ~3k.

I still believe it will be better set both ends although the video is sent from the AC and it is the end waiting for the ack reply.

If I get a chance this weekend I intend logging 24db & 27db with the class set at 7 to see if I can also confirm the result.

I normally use 24db setting as I can get out around 1.5Klm range which is way further than I normally go. Out of the box I was getting signal lost all the time.

I will share my script for others but use at your own risk.. Anyone not sure of how to to do it should use Magic Power.

Create a file at each end (RC & AC) /sbin/powerup.sh
Make it executable.
chmod 755 /sbin/powerup.sh

Contents of powerup.sh:
Code:
#!/bin/sh

# Script to check every second and fix the power output if it changes
# by Oz_Sparrow
# Change LIMIT to 2400 & DB to 24 or LIMIT to 2700 and DB to 27
# REGD can be "US" or "BO"

LIMIT=2400
DB=24
REGD="US"

# set coverage class up to 3klm for better video?
iw phy phy0 set coverage 7

while [ 1 ]
   do
      if [[ $(iwinfo |grep -m1 Tx-Power: |awk '{print $2}') != $DB ]]
         then
             iw reg set $REGD
             iw dev wlan0 set txpower limit $LIMIT
     fi
      sleep 1
  done

Edit /sbin/djiled.sh
add the following line.
/sbin/powerup.sh &

Dan another thought.. I am in CE area and have simply set my reg domain to US to enable use of 27db output. I was wondering if this setting also has impact on the 5.8Ghz output as well.. Am going to try setting it to BO as that area has no restrictions, it may change the output of the 5.8 control signal.

Have fun..
 
  • Like
Reactions: Pete43 and dan84uk
That is great news Dan. I have only had time to do a quick flight to get a baseline. I had not tried any distance runs other than to see how far the AC would go. (it wasn't far). My base test I went out to 1200 metres (17db) and logged the ping times.

I was hoping extending the ACK timeout would not be an issue at close range.

If you are not going out to the 5k I would probably set it lower like class 7 ~3k.

I still believe it will be better set both ends although the video is sent from the AC and it is the end waiting for the ack reply.

If I get a chance this weekend I intend logging 24db & 27db with the class set at 7 to see if I can also confirm the result.

I normally use 24db setting as I can get out around 1.5Klm range which is way further than I normally go. Out of the box I was getting signal lost all the time.

I will share my script for others but use at your own risk.. Anyone not sure of how to to do it should use Magic Power.

Create a file at each end (RC & AC) /sbin/powerup.sh
Make it executable.
chmod 755 /sbin/powerup.sh

Contents of powerup.sh:
Code:
#!/bin/sh

# Script to check every second and fix the power output if it changes
# by Oz_Sparrow
# Change LIMIT to 2400 & DB to 24 or LIMIT to 2700 and DB to 27
# REGD can be "US" or "BO"

LIMIT=2400
DB=24
REGD="US"

# set coverage class up to 3klm for better video?
iw phy phy0 set coverage 7

while [ 1 ]
   do
      if [[ $(iwinfo |grep -m1 Tx-Power: |awk '{print $2}') != $DB ]]
         then
             iw reg set $REGD
             iw dev wlan0 set txpower limit $LIMIT
     fi
      sleep 1
  done

Edit /sbin/djiled.sh
add the following line.
/sbin/powerup.sh &

Dan another thought.. I am in CE area and have simply set my reg domain to US to enable use of 27db output. I was wondering if this setting also has impact on the 5.8Ghz output as well.. Am going to try setting it to BO as that area has no restrictions, it may change the output of the 5.8 control signal.

Have fun..

My script is broadly the same, my loop is every 5 seconds and region BO, i dont loop on the drone as it seems to do as its told and stay at 27.

I modified the region check in the rcs file in init.d directory too just in case it had any negative effect (EVERYONE DONT DO THIS PPL HAVE BRICKED THEIR DEVICES WHEN SAVING IT WRONG). I set coverage higher using distance command as im going out 7000m. I boosted 5.8 with an amp, 5.8 is flawless even at 7000m.

Im unsure how far i can actually get, at 6000m i bump into another town which lags the video, and 1000m more I have to manully RTH. I need to find a better spot which is hard in the Midlands UK

Heres the town at 6000m that messes my run up, birmingham directly behind it. I got another mile further yesterday. Ive exhausted this route now, time to find another with less noise
 
Last edited:
  • Like
Reactions: Oz_Sparrow
That's great Dan. Hoping the weather here improves over the weekend so I can try a few different settings.
 
I was really happy to find this thread. I've been using Magic Power for a while (well, a modified version of it applied manually as I have a MacBook) but I'm interested in understanding some of the built-in commands the script uses. It's good to see other people wanting to delve into other things that could be done via a script to improve the range and overall performance of the Phantom 3.

Now, if only someone could work out how to also improve the 5GHz control signal as well…
 
I was really happy to find this thread. I've been using Magic Power for a while (well, a modified version of it applied manually as I have a MacBook) but I'm interested in understanding some of the built-in commands the script uses. It's good to see other people wanting to delve into other things that could be done via a script to improve the range and overall performance of the Phantom 3.

Now, if only someone could work out how to also improve the 5GHz control signal as well…
Yeh i was happy till i read post now my brain inside out,,:) now i know why i got away from p3 s etc wow to infomation posted i say that,,,very clever
 
I was really happy to find this thread. I've been using Magic Power for a while (well, a modified version of it applied manually as I have a MacBook) but I'm interested in understanding some of the built-in commands the script uses. It's good to see other people wanting to delve into other things that could be done via a script to improve the range and overall performance of the Phantom 3.

Now, if only someone could work out how to also improve the 5GHz control signal as well…
No chance on the 5ghz, consider getting an amp. Im up to 7000m 100% signal!
 
I'm not sure on the 5Ghz side as I have no way of testing output. I have noticed while playing with the regulatory domain settings that at different locations, US, BO, GB, NZ, AU, LV, CA etc, the 5.8ghz channels change and the max output reported changes between 17db, 20db & 21db. Also some channels are restricted.

As a result I believe that if you have the reg domain set for a country that allows 21db @ 5.8Ghz, you will have more power output than someone located in a country that only allows 17db @ 5.8.

I also found that some country settings have lower frequencies allowed in the range the transmitter can output. Some of these lower frequencies are restricted on output as well. Example:
Code:
        Band 2:
                Capabilities: 0x11ef
        Frequencies:
                        * 5180 MHz [36] (17.0 dBm)
                        * 5200 MHz [40] (17.0 dBm)
                        * 5220 MHz [44] (17.0 dBm)
                        * 5240 MHz [48] (17.0 dBm)
                        * 5260 MHz [52] (21.0 dBm) (radar detection)
                          DFS state: usable (for 76 sec)
                          DFS CAC time: 60000 ms
                        * 5280 MHz [56] (21.0 dBm) (radar detection)
                          DFS state: usable (for 76 sec)
                          DFS CAC time: 60000 ms
                        * 5300 MHz [60] (21.0 dBm) (radar detection)
                          DFS state: usable (for 76 sec)
                          DFS CAC time: 60000 ms
                        * 5320 MHz [64] (21.0 dBm) (radar detection)
                          DFS state: usable (for 76 sec)
                          DFS CAC time: 60000 ms
                        * 5500 MHz [100] (disabled)
                        * 5520 MHz [104] (disabled)
                        * 5540 MHz [108] (disabled)
                        * 5560 MHz [112] (disabled)
                        * 5580 MHz [116] (disabled)
                        * 5600 MHz [120] (disabled)
                        * 5620 MHz [124] (disabled)
                        * 5640 MHz [128] (disabled)
                        * 5660 MHz [132] (disabled)
                        * 5680 MHz [136] (disabled)
                        * 5700 MHz [140] (disabled)
                        * 5745 MHz [149] (21.0 dBm)
                        * 5765 MHz [153] (21.0 dBm)
                        * 5785 MHz [157] (21.0 dBm)
                        * 5805 MHz [161] (21.0 dBm)
                        * 5825 MHz [165] (21.0 dBm)
Can't remember the country setting I used for the above report.

This link has info on the output allowed in different countries. Cisco Wireless Control System Configuration Guide, Release 3.2 - Appendix B - Supported Country Codes [Cisco Wireless Control System]

I would be certain that this setting has impact on the control signal output as I can't get any settings reported on 5.8 band 2 on the AC (receive only?).

I can't confirm this but if you are in a country set with lower output, a change of reg domain may give you more range.
 
Dan I am getting good 2.4 range and video now, just running out of distance on the 5.8 now.. May also look at some sort of booster.

Good to hear!

Im looking to add 6dbi 2.4 antennas drone side now.:D
 
I have never read anything on the forum about the ceramic patch antennas, especially what orientation they are.

Considering household wifi is our main enemy with interference and mostly vertical polarised you would think if you positioned them horizontally interference would be reduced.

Some ceramic patches are circular polarised which would make sense for video transmission. I could not identify what type they have put in the Phantom. Someone else may know what they are.

I did find a small antenna I thought might fit inside the AC. Most of them have little or no gain other than they are directional. These are listed as 5dbi gain. WLP.2450.25.4.A.02 Taoglas Limited | RF/IF and RFID | DigiKey
 

Members online

No members online now.

Forum statistics

Threads
143,085
Messages
1,467,525
Members
104,963
Latest member
BoguSlav