Bug #558


Improve wifi performance

Added by Hammel over 7 years ago. Updated over 7 years ago.

Target version:
Start date:
10 Nov 2016
Due date:
% Done:


Estimated time:
01 - Critical


It became clear after the two Maker Faire events that wifi in public spaces performs much worse than at home. There are probably tricks to dealing with this, not the least of which is choosing a different channel (which we can already do).

Here is a discussion on other things that can be done to improve performance:
Many of these could be configured through the pnc app.

Actions #1

Updated by Hammel over 7 years ago

  • Target version changed from 0.13.0 to 0.12.0
Actions #2

Updated by Hammel over 7 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10
I can use "watch -n 1 cat /proc/net/wireless" (or a thread based alternative) to monitor the wireless signal.

or to run through a popen(): cat /proc/net/wireless | tail -1 | sed 's/ \+/ /g'
I can use "sudo iwlist wlan0 scan | grep \(Channel" to find which channels are in use and recommend which one to use
Noisy environment settings:
  • sudo iwconfig wlan0 retry 16
  • sudo iwconfig wlan0 frag 512
  • sudo iwconfig wlan0 commit

According to this video the best wifi channels are 1, 6, and 11. I should scan the network for traffic on those channels and pick the best of those automatically. It also suggests more tx power can be used (if hostapd.conf permits) but will generate more heat.

Wireless API information is available from the Linux Wireless web site.

Overlapping channels come in sets, meaning if you can find channels that aren't in use and dont overlap those in use then that's the best channel to use for a WiFi network. Also there are really only 14 channels we care about for g @ 2.5GHz with four more added for 5Ghz.

Graphs could be straight edged or with an arc.

Selecting colors:
Actions #3

Updated by Hammel over 7 years ago

  • % Done changed from 10 to 40

Making progress. I've got a Cairo based display showing which channels are in use and by how many networks. Now I want to graph the signal strength. To do this I need to run this command:

$ iw dev wlan0 scan
BSS 10:6f:3f:e7:24:55(on wlp3s0) -- associated
    TSF: 797749164512 usec (9d, 05:35:49)
    freq: 5200
    beacon interval: 100 TUs
    capability: ESS Privacy (0x0011)
    signal: -62.00 dBm
    last seen: 82272 ms ago
    Information elements from Probe Response frame:
    SSID: MuseBA
    Supported rates: 6.0* 9.0 12.0* 18.0 24.0* 36.0 48.0 54.0 
    DS Parameter set: channel 40

So look for the BSS in the first colmn to find a new entry. Then parse out the signal strength, SSID and channel. That's good enough to start. I can graph the signal and show the SSID with each graph.

Here is how you convert dBm to a percentage. It assumes a maximum dBm of -50, which seems about right from my laptop.

quality = 2 * (dBm + 100)

Actions #4

Updated by Hammel over 7 years ago

See this comment on serverfault. It mentions different dBm levels for different types of hardware. Basically, for PiBox if the dbm signal is -70 to -60 then the signal is good. So I could do a "yellow line" above which the BSS is good.

Actions #5

Updated by Hammel over 7 years ago

  • % Done changed from 40 to 70

Graphing of wifi channels and signal strength is complete. Code is committed and pushed. Looks pretty good, actually. I select colors for the graphics using the golden ratio.

Now I need to add all 14 channels to the options menu for selecting a channel for the access point. Then I should set the default to 1, 6 or 11.

Actions #6

Updated by Hammel over 7 years ago

  • Project changed from PiBox to pibox-network-config
  • Category deleted (09 - Testing)
Actions #7

Updated by Hammel over 7 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 70 to 100

Done. All changes committed and pushed.

Closing issue.

Actions #8

Updated by Hammel over 7 years ago

One additional note:

I swapped out all the ModMyPi dongles with the various Panda wifi dongles and things got much better. I also moved the RPI2 away from its USB hub just a bit. Maybe that's what I really needed: better dongles and less interference from the Pi.


Also available in: Atom PDF