Welcome to PhantomPilots.com

Sign up for a weekly email of the latest drone news & information

Install OpenWRT WebUI on Repeater/P2V+

Discussion in 'Phantom 2 Vision + Discussion' started by linuxkidd, Jun 12, 2014.

  1. linuxkidd

    Joined:
    Jun 12, 2014
    Messages:
    79
    Likes Received:
    2
    Location:
    Anywhere USA - Fulltime RV'er
    Also see how to enable FPV WiFi Encryption in this thread
    Also see how to enable Camera to Repeater WiFi Encryption in this thread

    Here's a quick how-to I put together on installing a WebUI for managing the P2V+ and Repeater. Doing so enables you to *easily* adjust any networking/wifi aspect you desire!
    Presentation: WebUI Install for DJI P2V+ and Repeater

    Screencast: YouTube
    [youtube]https://www.youtube.com/watch?v=d3O4dZ4i_E0[/youtube]

    Below is a quick text format version, but the presentation has some screenshots for PuTTy users in case the instructions aren't clear enough.

    Happy to answer any question!
    LK
    ---------------------------------------------------------------------------------------
    ## Disclaimer
    • The instructions provided here are provided as-is and with no warranty expressed or implied.
    • You are responsible for any issues that arise from following these instructions.
    • **** Follow at your own risk! ****


    ## Quick Explanation
    • The DJI Phantom 2 Vision/Vision+ and DJI FPV WiFi Repeater both operate a free and opensource WiFi ROM called ‘OpenWRT’
    • Because OpenWRT supports many different routers and platforms, and is a VERY common ROM, there are LOTs of packages available for installation.
    • The procedure outlined here will provide a means of connecting your DJI gear to the internet and download/install some of these extra packages.
    • We will be using port-forwarding to accomplish this, along with some simple modifications on the DJI gear.
    • This guide intends to be step-by-step, so even if you’re not familiar with the technology, you should be able to accomplish some quick tasks.

    ## Prerequisites
    • A computer with both WiFi and Wired internet capability
    • An available WIRED internet connection with an IP range NOT using 192.168.1.x
    • An SSH client (either the built in one on Linux / Mac OSX, or PuTTy on Windows)

    ## NOTE
    • This document uses IP 192.168.1.2 which is the IP of the DJI FPV WiFi Repeater.
    • However these instructions can be applied to the DJI Phantom 2 Vision/Vision+ as well.
    • Simply substitute 192.168.1.1 in place of references to 192.168.1.2.

    ## Preparation
    1. Power on your:
      • Repeater
      • DJI Controller
      • Phantom 2 Vision/Vision+
    2. Connect to your Repeater's WiFi with your computer
    3. AFTER you're connected via WiFi to the repeater, Plug in your Wired Internet Connection
    4. Verify Internet Access (Go to your LEAST favorite web-site - i.e. One that won't be cached by your browser)
    5. Verify Repeater Access (Go to http://192.168.1.2, you should get a 404 or similar page)

    ## Installing Web GUI on your Repeater and/or Phantom Vision/Vision+
    1. Linux/Mac OSX: In a terminal window, issue: ssh root@192.168.1.2
      Windows: Launch PuTTy, in the 'Host Name' field, enter: root@192.168.1.2
      Password: 19881209
    2. Issue the following commands in the remote SSH session:
      • For the repeater (IP 192.168.1.2)
        Code:
        /etc/init.d/lighttpd stop
        /etc/init.d/lighttpd disable
        
      • For the Phantom (IP 192.168.1.1)
        Code:
        /etc/init.d/uhttpd stop
        
      • For both:
        Code:
        echo 127.0.0.1 downloads.openwrt.org openwrt.org >> /etc/hosts
        
      • Establish the remote port forward:
        • On Linux/Mac OSX:
          Code:
          exit
          sudo ssh -g -R 80:downloads.openwrt.org:80 root@192.168.1.2
          Password: 19881209
          
          NOTE: In this step, using 'sudo' is required in order to forward a port < 1024 (privileged ports). On Mac, this is configured automatically, and you'll simply enter your Mac password when prompted. On Ubuntu and Ubuntu based distro's, the same applies. On other linux distros, you may need to become root via other means, or you may need to configure sudo. Doing this is beyond the scope of this guide, but Google for 'sudoers' and you'll be well on your way.
        • On Windows via PuTTy:
          • Right click the title bar of the PuTTy Window
          • Click 'Change Settings'
          • Click the + beside 'SSH' under 'Connection' (to expand the SSH section)
          • Click 'Tunnels'
          • Select 'Remote' in the lower right section of the Dialog
          • For 'Source port', enter '80'
          • For 'Destination', enter 'downloads.openwrt.org:80'
          • Click 'Add'
          • Click 'Apply'
      • In the remote SSH session, now issue:
        Code:
        opkg update
        opkg remove firewall3
        opkg install luci
        /etc/init.d/uhttpd enable
        
        ( An updated firewall package is installed with the WebUI which will conflict and fail if the old one is not removed first! )
      • Remove the remote port forward:
        Code:
        exit
        
      • Linux/Mac OSX: In a terminal window, issue: ssh root@192.168.1.2
        Windows: Launch PuTTy, in the 'Host Name' field, enter: root@192.168.1.2
        Password: 19881209
      • In the remote SSH session, issue:
        Code:
        /etc/init.d/uhttpd start
        exit
        
      • In your browser, go to: http://192.168.1.2
        • You should see the LuCI Web Interface after a short pause.
        • Username: root
        • Password: 19881209
        • Some have reported that the redirect to the LuCI WebUI never occurs. If after a few seconds you don't see a login page, use this URL instead: http://192.168.1.1/cgi-bin/luci
     
  2. linuxkidd

    Joined:
    Jun 12, 2014
    Messages:
    79
    Likes Received:
    2
    Location:
    Anywhere USA - Fulltime RV'er
    -- Removed --

    Found this to be not needed upon re-examination.. Removing the details from here to prevent confusion..
    LK
     
  3. srandall25

    Joined:
    Apr 17, 2014
    Messages:
    692
    Likes Received:
    4
    Is the connection to the wifi repeater off the Tx controller or to the repeater on the phantom?
     
  4. HunterSK

    Joined:
    May 4, 2014
    Messages:
    137
    Likes Received:
    18
    Nice write up! Please continue as I'm particularly interested in enabling encryption on the WiFi to stop it being an open network for anyone to log in. Enabling encryption may affect range, but we'll find out.

    Also in the event that someone really screws up the Linux installation on the Phantom or repeater, is it possible to reinstall? I suspect not and this is what makes me nervous about software mods like this.

    I think users should realise that as soon as you're doing these types of mods, YOU are responsible for the state of the system. Changing the software baseline means future software updates from DJI may run into issues.
     
  5. srandall25

    Joined:
    Apr 17, 2014
    Messages:
    692
    Likes Received:
    4
    As you're aware, there is a Booster app that increases the wifi gain on the Phantom. Do your instructions allow us to also increase the gain on the wifi range extender that hangs off the Transmitter as well?
     
  6. varmint

    Joined:
    Feb 5, 2014
    Messages:
    390
    Likes Received:
    6
    Location:
    Hillsboro, OR
    Nice work!
     
  7. linuxkidd

    Joined:
    Jun 12, 2014
    Messages:
    79
    Likes Received:
    2
    Location:
    Anywhere USA - Fulltime RV'er
    The Repeater at 192.168.1.2 is the one mounted to the Tx Controller. The IP 192.168.1.1 is that of P2V+ WiFi. There's a 3rd IP (192.168.1.10) for the Camera, but it is simply relayed from the P2V+ connection. This means that changes to the P2V+ and Repeater WiFi are all that's required, and full operation will continue after.

    When you're in the 'WiFi' section of the Repeater config, you'll see two WiFi networks listed there:
    * FC200_XXXXXX
    - This is the connection to your P2V+
    - Do NOT change the 'mode' of this connection from it's default state ('Client WDS' I think..)
    * Phantom_XXXXXX
    - This is the normally visible WiFi that you connect to for FPV

    I've not tested the effectiveness, but I believe it will be possible to increase the WiFi Transmit Power on both the P2V+ and the WiFi Repeater. It should be stated as well that I've already modified both my Tx Controller and my WiFi Repeater with external antenna jacks which more than doubled my range to begin with. My testing of any WiFi Transmit Power adjustments will be biased based on the existing hardware mods I've done. You're results may vary.

    The mods I've outlined so far are very benign. It'd be very trivial to revert what's done. (I'll write this up soon too). Once this is setup, there is a 'backup' feature which will produce a backup of your settings, but not the ROM itself. I did backup the ROM contents of my Repeater prior to any mods with the following commands issued from inside the remote SSH session:

    tar -czvf /tmp.tgz /tmp
    tar -czvf /root.tgz /bin /etc /lib /mnt /overlay /rom /root /sbin

    Then, from a local terminal (on Linux/Mac OSX) or with an SCP program (WinSCP, FileZilla, etc), I copied the tgz files local to my system.
    scp root@192.168.1.2:/tmp.tgz ./
    scp root@192.168.1.2:/root.tgz ./

    While anything is possible, my experience is that any new Firmware will completely wipe out the existing ROM. This means that while you'll likely loose all the changes you've made, the new upate should proceed without issue. However, you do take this risk on your own.

    Thanks,
    LK
     
  8. tscott

    Joined:
    May 21, 2014
    Messages:
    15
    Likes Received:
    0
    This is pretty timely. I spent last night and tonight peeking and poking at the contents of the Wifi Extender and P2V+. I'm used to dealing with buildroot configs and this is my first time dealing with OpenWRT, so it was new but not completely unfamiliar territory.

    From what I gather, the Booster app simply issues a couple of 'iw' commands to boost tx power... along the lines of "iw phy phy0 set txpower fixed 1300". It doesn't look like "iw" gives you the current tx-power, though, and "iwinfo" is not installed, so here's what I did to install iwinfo WITHOUT using opkg:

    1) Downloaded http://downloads.openwrt.org/attitude_a ... ar71xx.ipk to laptop.
    2) Extracted the ipk contents using 7-zip until I got my grubby little hands on "iwinfo"
    3) Transferred that via "pscp -scp d:\tmp\iwinfo root@192.168.1.1:/tmp/iwinfo"
    4) Logged into the P2V+ and did a "chmod a+x /tmp/iwinfo"
    5) Ran "/tmp/iwinfo wlan0 info" and saw the txpower was set to 7dBm
    6) Ran "iw phy phy0 set txpower fixed 1300" and re-ran iwinfo. Saw that the current power went to 13dBm.
    7) Did a little dance. Heh.
    8) Moved iwinfo to /overlay/usr/sbin/iwinfo (I think... it was /bin or /sbin, can't remember).

    Why not use opkg? Well, I've never used it before TBH, and am a bit paranoid of package installers updating / changing / moving stuff unexpectedly. Give me a simple binary that I can manually install and I'm happy.

    I think it should be fairly easy to permanently boost the txpower via a software config by adding something to the start-up scripts.

    --tim
     
  9. tscott

    Joined:
    May 21, 2014
    Messages:
    15
    Likes Received:
    0
    Other observations:

    You can connect directly to the P2V+ by using the SSID FC200_xxxxxx. However, I had to define a static IP for my laptop for this to work reliably. Further, if you don't turn on the Wifi Extender you get hiccups as watchdog_wireless.sh tries to kickstart the network. After killing this process, the hiccups went away for me.

    --tim
     
  10. linuxkidd

    Joined:
    Jun 12, 2014
    Messages:
    79
    Likes Received:
    2
    Location:
    Anywhere USA - Fulltime RV'er
    Ya, I think that's what the Booster app does as well. (PVFlyer claims they're not doing this in the booster thread.) With the WebUI installed (or by editing /etc/config/wireless), you can make the change permanent (or at least until the next firmware is flashed).

    Getting ready to post the encryption instructions in another thread... More GUI'fied this time (relying on the foundation of the WebUI).

    Thanks!
    LK
     
  11. brushlesheaven

    Joined:
    Jan 29, 2014
    Messages:
    250
    Likes Received:
    6
    Just have a simple question guys please.
    What is your default power set to on your P2V+ camera and extender in the wifi section details?
    Thanks
    Robert
     
  12. linuxkidd

    Joined:
    Jun 12, 2014
    Messages:
    79
    Likes Received:
    2
    Location:
    Anywhere USA - Fulltime RV'er
    I have not specifically modified mine, and the values reported are as follows (seems a bit low)

    On the repeater
    FC200_XXXXXX: 12dBm (15mw)
    Phantom_XXXXXX: 12dBm (15mw)

    -- I think they'll be the same as they're set at the Card level, not the Virtual WiFi network level (even though the WebUI would lead you to believe otherwise).

    On the P2V+
    FC200_XXXXXX: 7dBm (5mw)

    According to the WebUI anyway...
    LK
     
  13. garrock

    Joined:
    Apr 29, 2014
    Messages:
    466
    Likes Received:
    47
    Location:
    Portsmouth Ohio USA
    That is 6dB increase. "If" the Range Extender is the weakest transmit link then that will add to the over all RF Link Budget.

    Important Note: Need to know the drones RF output power level before and after using the Booster App. If it too increases by 6dB then should get a Doubling of Distance. It's a bit more convoluted than that to calculate an RF Link Budget.
     
  14. brushlesheaven

    Joined:
    Jan 29, 2014
    Messages:
    250
    Likes Received:
    6
    Hmm...
    I see 20 dBm, 501 mW on both, extender and camera..
     
  15. linuxkidd

    Joined:
    Jun 12, 2014
    Messages:
    79
    Likes Received:
    2
    Location:
    Anywhere USA - Fulltime RV'er
    I did do a lot of poking around, but I wouldn't expect the stuff I did too have changed the Wi-Fi power.. but anything is possible.

    I'd love to hear others default values.
    LK

    Sent from my HTC One_M8 using Tapatalk
     
  16. brushlesheaven

    Joined:
    Jan 29, 2014
    Messages:
    250
    Likes Received:
    6
    Am I looking at the right information here?
     

    Attached Files:

  17. garrock

    Joined:
    Apr 29, 2014
    Messages:
    466
    Likes Received:
    47
    Location:
    Portsmouth Ohio USA
    The value read could be the chipsets output power setting register. Or, is it the dB level "after" the RF Front End Power Amplifer ???

    The Range Extender's RF Front End circuit uses a PA Chip (RF Power Amplifier). It has a gain of 28dB.
    • EDIT: If the PA Chip operates from 3.3V then the max gain is 25dBm. If on 5V it is 28dB.

    So, the Big Question is... Are the dB output values for the entire RF system (WiFi chipset plus RF Front End gain circuit) ?
     
  18. linuxkidd

    Joined:
    Jun 12, 2014
    Messages:
    79
    Likes Received:
    2
    Location:
    Anywhere USA - Fulltime RV'er
    ya, that looks right.. although above the selection area, it states Tx power 20dBm..

    Sent from my HTC One_M8 using Tapatalk
     
  19. linuxkidd

    Joined:
    Jun 12, 2014
    Messages:
    79
    Likes Received:
    2
    Location:
    Anywhere USA - Fulltime RV'er
    Great question! if it's only the chipset, it could make things much worse cranking the value up since it could overdrive the PA.


    LK

    Sent from my HTC One_M8 using Tapatalk
     
  20. tscott

    Joined:
    May 21, 2014
    Messages:
    15
    Likes Received:
    0
    Curious. I just powered on both the WiFi Extender and P2V+ and then checked the iwinfo stats. Here's what it says:

    WiFi Extender
    root@Phantom:~# ./iwinfo wlan0 info
    wlan0 ESSID: "Phantom_XXXXXX"
    Access Point: 60:60:1F:XX:XX:XX
    Mode: Master Channel: 1 (2.412 GHz)
    Tx-Power: 12 dBm Link Quality: 70/70
    Signal: -34 dBm Noise: -95 dBm
    Bit Rate: 19.5 MBit/s
    Encryption: none
    Type: nl80211 HW Mode(s): 802.11bgn
    Hardware: unknown [Generic MAC80211]
    TX power offset: unknown
    Frequency offset: unknown
    Supports VAPs: yes

    P2V+
    root@Phantom:~# iwinfo wlan0 info
    wlan0 ESSID: "FC200_XXXXXX"
    Access Point: 60:60:1F:XX:XX:XX
    Mode: Master Channel: 1 (2.412 GHz)
    Tx-Power: 3 dBm Link Quality: 70/70
    Signal: -13 dBm Noise: -95 dBm
    Bit Rate: 104.0 MBit/s
    Encryption: none
    Type: nl80211 HW Mode(s): 802.11bgn
    Hardware: unknown [Generic MAC80211]
    TX power offset: unknown
    Frequency offset: unknown
    Supports VAPs: yes

    Earlier, I saw that the P2V+ was sitting at 7dBm. I must have read it with iwinfo after messing around with various txpower settings. I'll try things again tomorrow and see if they are consistent.

    --tim