Changing the WiFi Channel on your Drone

Mirumod, Macgyver, hull, cam, propeller, leg, cross, ball bearing mods... etc.
Post Reply
User avatar
Lunar1
Battery Charged
Posts: 5
Joined: 29 Dec 2011, 08:53

Changing the WiFi Channel on your Drone

Post by Lunar1 » 29 Dec 2011, 17:58

Hi Guys!

This is my first post AND my first tutorial so don't hesitate to ask questions.



Disclaimer
Attempt this at your own risk! I nor Parrot are responsible for any damage done to your drone. This will void the warranty. This also only been tested on firmware version 1.7.4. Also, this does not change boot. If you cycle power it will go back to default.

Description
This mod allows you to set your drone to a specific WiFi channel, instead of channel 6 or some random one. Specifying a channel with the least amount of traffic should help improve connectivity and range. Also, wherever you see MyChannel replace that with the channel number you want to use. For example, "iwconfig ath0 channel MyChannel" becomes "iwconfig ath0 channel 5".

Requirements
Android phone(Can use a Iphone but I have a droid so you may have to find equivalent apps.)
An AR.Drone (Duh!)
A computer with WiFi capability
Some spare time

Instructions

Step 1
You need to get a WiFi analyzer app on your phone, then walk around your general flying area and use the channel scanner to see which is the most open wifi channel in the area. This is the "custom" channel that you will force the drone to use. Note that only channels 1 through 11 are available for use in the US.


Image

This is the free WiFi Analyzer app on the android market. A link is below.
WIFi Analyzer


Step 2
Plug in your drone. Once the LEDs are green, connect to the drone's WiFi with your computer and launch your telnet client. Then input 192.168.1.1 as the ip address and select telnet. Then press connect. A terminal will pop up. This is the brain of your drone.

Step 3
Now we're going to write the script that changes the channel. Type the following command that creates the script:

cat > chMyChannel.sh

For example:
cat > ch5.sh
Then type this:

Code: Select all

SSID=`grep ssid_single_player /data/config.ini | awk -F "=" '{print $2}'`
ifconfig ath0 down
iwconfig ath0 mode master essid $SSID channel MyChannel
iwconfig ath0 commit
ifconfig ath0 192.168.1.1 netmask 255.255.255.0 up
Put it in as I have written, with each command on a new line. Then make a new line (just hit return) and press CTL-D to finish it.
Then type:

chmod 755 /chMyChannel.sh

To test it type:

/chMyChannel.sh

Your terminal should hang because the drone has changed WiFi channels! Check with your WiFi analyzer to see if its on MyChannel.
(Note: It is sometimes necessary to restart the WiFi analyzer for it to register the channel change)

Step 4
Now that we have done that, you can go get a telnet app for your droid like this one:
https://market.android.com/details?id=k ... xuZXQiXQ..
Reboot your drone then connect to it with your phone. open the app and type in 192.168.1.1 for the address and connect. Then type:

/chMyChannel.sh

and it should do the same thing! So now you don't have to have a laptop to change the channel!

Keep in mind that you can repeat this process to create multiple scripts that set to different channels, like ch1.sh, ch7.sh, ch9.sh, etc...

Also, when you cycle power on your drone, it will revert to the factory default, so you will have to go in and run the script each time you cycle power. The good news is that its not permanent, so its pretty hard to brick your drone.

Thats all, Happy flying!



--Lunar1
Last edited by Lunar1 on 29 Dec 2011, 23:16, edited 10 times in total.

ShellDude
Batterys getting low
Posts: 957
Joined: 04 Jan 2011, 20:10
Drone Type: Bebop
Location: Philadelphia, PA USA
Contact:

Re: Changing the WiFi Channel on your Drone

Post by ShellDude » 29 Dec 2011, 18:36

I really do need to devote a little time to re-evaluating wifi setup with 1.7.4+ ... I'm certain I could do some neat stuff within AR.Pro now that the whole wifi stack has stabilized on the drone.

Great write up, BTW!

Shell

User avatar
Lunar1
Battery Charged
Posts: 5
Joined: 29 Dec 2011, 08:53

Re: Changing the WiFi Channel on your Drone

Post by Lunar1 » 29 Dec 2011, 19:08

ShellDude wrote:I really do need to devote a little time to re-evaluating wifi setup with 1.7.4+ ... I'm certain I could do some neat stuff within AR.Pro now that the whole wifi stack has stabilized on the drone.

Great write up, BTW!

Shell
Thanks! It would be fantastic to have full customization of the WiFi settings on the drone via AR.Pro in a way that doesn't require permanent "boot" changes to make it safe. Having the ability to set the WiFi channel to a known, fixed value is the first step towards setting up a wireless mesh network around the house for my drone. Now, I'm trying to figure out whether the drone should be set to Infrastructure or Managed mode. You don't have to answer this, it's just where I am in the thought process.

ShellDude
Batterys getting low
Posts: 957
Joined: 04 Jan 2011, 20:10
Drone Type: Bebop
Location: Philadelphia, PA USA
Contact:

Re: Changing the WiFi Channel on your Drone

Post by ShellDude » 29 Dec 2011, 22:41

We used to run infrastructure (client) mode prior to 1.7.4 via bootup patch.

I've been meaning to look at the new Wifi-setup.sh script to see if we can run infrastructure client without a patch.

Sent from my GT-I9100 using Tapatalk

ShellDude
Batterys getting low
Posts: 957
Joined: 04 Jan 2011, 20:10
Drone Type: Bebop
Location: Philadelphia, PA USA
Contact:

Re: Changing the WiFi Channel on your Drone

Post by ShellDude » 30 Dec 2011, 02:27

The following works just as well (I'm experimenting tonight):

Code: Select all

iwconfig ath0 channel XX commit
Looks like only channels 1 through 11 are available... was really hoping for access to channel 14 :(

Code: Select all

# iwlist ath0 channel
ath0      11 channels in total; available frequencies :
          Channel 01 : 2.412 GHz
          Channel 02 : 2.417 GHz
          Channel 03 : 2.422 GHz
          Channel 04 : 2.427 GHz
          Channel 05 : 2.432 GHz
          Channel 06 : 2.437 GHz
          Channel 07 : 2.442 GHz
          Channel 08 : 2.447 GHz
          Channel 09 : 2.452 GHz
          Channel 10 : 2.457 GHz
          Channel 11 : 2.462 GHz
          Current Frequency:2.412 GHz (Channel 1)
Also looks like it max's out power wise at 39mW ... no way to get it to go any higher ... could see that being an issue with the FCC here in the States anyway... I'm sure there are hacked atheros drivers out there for those wanting to overdrive it (read -- illegal in the US).

Code: Select all

# iwlist ath0 txpower
ath0      unknown transmit-power information.

          Current Tx-Power=16 dBm       (39 mW)

User avatar
Lunar1
Battery Charged
Posts: 5
Joined: 29 Dec 2011, 08:53

Re: Changing the WiFi Channel on your Drone

Post by Lunar1 » 30 Dec 2011, 03:24

Nice Find! My experience was that you had to bring the card down, but that works even better! I have also written a script to put the drone safely in managed mode, and tested it using AR.Pro. The cool part is that how it works. It can support multiple drones, assuming you client can specify the drone IP (Like AR.Pro).

ShellDude
Batterys getting low
Posts: 957
Joined: 04 Jan 2011, 20:10
Drone Type: Bebop
Location: Philadelphia, PA USA
Contact:

Re: Changing the WiFi Channel on your Drone

Post by ShellDude » 30 Dec 2011, 04:03

Poking around tonight it's (adhoc, infrastructure client, hotspot) all driven by wifi_mode now so I can have it integrated into AR.Pro in no time at all.

In the meantime, I integrated on the fly channel change capabilities and plan to have it out with 1.4.1 that I hope to release tonight.

Image

User avatar
Lunar1
Battery Charged
Posts: 5
Joined: 29 Dec 2011, 08:53

Re: Changing the WiFi Channel on your Drone

Post by Lunar1 » 30 Dec 2011, 05:02

Hey, as soon as its released ill test it out!

ShellDude
Batterys getting low
Posts: 957
Joined: 04 Jan 2011, 20:10
Drone Type: Bebop
Location: Philadelphia, PA USA
Contact:

Re: Changing the WiFi Channel on your Drone

Post by ShellDude » 30 Dec 2011, 06:21

1.4.1 just hit the market

alexmoi
Just flips over
Posts: 83
Joined: 11 Mar 2011, 03:51

Re: Changing the WiFi Channel on your Drone

Post by alexmoi » 30 Dec 2011, 07:12

putting aside the advance of ar.pro. if you want to follow the first process you can do it without the use of pc. busybox + better terminal is all you need.

but i suggest using the ar.pro....alot simpler than remembering code lol

User avatar
Lunar1
Battery Charged
Posts: 5
Joined: 29 Dec 2011, 08:53

Re: Changing the WiFi Channel on your Drone

Post by Lunar1 » 30 Dec 2011, 07:20

Yes i would have to agree, but i made that before Shell packed it all nicely into AR.Pro. But the app worked like a charm, Great work!

alexmoi
Just flips over
Posts: 83
Joined: 11 Mar 2011, 03:51

Re: Changing the WiFi Channel on your Drone

Post by alexmoi » 30 Dec 2011, 07:28

well your tutorial led shell on right path.....so thanx for the help lol

ShellDude
Batterys getting low
Posts: 957
Joined: 04 Jan 2011, 20:10
Drone Type: Bebop
Location: Philadelphia, PA USA
Contact:

Re: Re: Changing the WiFi Channel on your Drone

Post by ShellDude » 30 Dec 2011, 07:34

alexmoi wrote:well your tutorial led shell on right path.....so thanx for the help lol
Right on... This thread rocks!!!

I wish all first posts were as informative as yours :-)

Sent from my GT-I9100 using Tapatalk

User avatar
krfanning
Ready for take off
Posts: 32
Joined: 22 Jul 2015, 08:29
Drone Type: AR.Drone 2

Re: Changing the WiFi Channel on your Drone

Post by krfanning » 24 Oct 2015, 04:21

It would be great if someone found a way to lock a channel in permanently! Parrot said it can't be done...you guys are on the right track...keep up the good work!! :D
One day I will own a REAL drone...

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests