Python script to monitor Yun wifi connection

I am still experiencing trouble with my Yun's wifi stability.

I created a python script that monitors ans logs the wifi connection of the Yun (optionally resetting the wifi if it drops). I will run some trials in the coming days. If anyone else would be interested in this script you can find it + some explanation at http://myyafa.blogspot.be/2014/07/wifi-monitor-to-troubleshoot-yun.html

I am experiencing wifi stability too.

Did you uncommented the wifi-live-or-reset in the rc.local? To me it seems that this script is an alternative to it.

I would add some more things like wifi strength signal.. wh don't put it on github?

No, I did not uncomment the wifi-live-or-reset. I think this is only run just after boot, so it does not disturb me too much.

I don't see this script as an alternative, it is just a way to log stuff, maybe with the added value that it can reset the wifi (without the rest) if it is dropped. I will see if I can add some extra stuff like strength. I didnt think it was worth puttinh on GitHub, but it is indeed easier to maintain that way.

Just moved it to gitHub (link is on http://myyafa.blogspot.be/2014/07/wifi-monitor-to-troubleshoot-yun.html) , and it now also logs the Link Quality, Signal level:

2014-07-25 14:01 : wifiMonitor (re)started with RESTART_WIFI_WHEN_LOST=True
2014-07-25 14:01 : wifi OK, uptime=0:00:05.039530, ok/nok: 1/0 - Link Quality=22/70  Signal level=-88 dBm
2014-07-25 14:02 : wifi OK, uptime=0:00:25.107430, ok/nok: 2/0 - Link Quality=29/70  Signal level=-81 dBm
2014-07-25 14:02 : wifi OK, uptime=0:00:45.157213, ok/nok: 3/0 - Link Quality=21/70  Signal level=-89 dBm
2014-07-25 14:02 : wifi OK, uptime=0:01:05.206381, ok/nok: 4/0 - Link Quality=26/70  Signal level=-84 dBm
2014-07-25 14:03 : wifi OK, uptime=0:01:25.251912, ok/nok: 5/0 - Link Quality=25/70  Signal level=-85 dBm
2014-07-25 14:03 : wifi OK, uptime=0:01:45.293574, ok/nok: 6/0 - Link Quality=26/70  Signal level=-84 dBm
2014-07-25 14:03 : wifi OK, uptime=0:02:05.342532, ok/nok: 7/0 - Link Quality=27/70  Signal level=-83 dBm

sonnyyu: Understanding Wifi Signal Strength: Wireless signal strength is traditionally measured in either percentile or dBm (the power ratio in decibels of the measured power referenced to one milliwatt.) The level of 100% is equivalent to the signal level of -35 dBm and higher, e.g. both -25 dBm and -15 dBm will be shown as 100%, because this level of signal is very high. The level of 1% is equivalent to the signal level of -95 dBm. Between -95 dBm and -35 dBm, the percentage scale is linear, i.e. 50% is equivalent to -65 dBm.

Get Wireless signal strength in dBm at Yun:

iwconfig 2>&1 | grep 'Signal level'
Link Quality=70/70  Signal level=-37 dBm

My reading now:

root@Arduino:~# iwconfig 2>&1 | grep 'Signal level'
          Link Quality=70/70  Signal level=-21 dBm

Adjust router antenna and make router and Yun closed together as well as add high gain antenna into Yun will bring Signal level up.

Should not bring 'Signal level' too high, It could be saturation the RF circuit.

I cannot put them closer together or manipulate any antennas. I know I am on the "low side". My PC (just next to the Yun) or tablet just work fine on this network.

I am not so much troubles by now and then having a network drop, but more that this seems to crash the Yun (white LED goes off)

sonnyyu:
The reason external antenna is needed is:

  • On board chip antenna has average Gain -0.5 dBi
  • Yun’s transmit power is only 17 dBm.
  • Yun is siting at metal case.
  • The distance between Yun and WIFI router is far

Friis Transmission Formula with Propagation Law

  • R = Maximum range for communication link
  • N = Propagation Law (N=2 for line-of-sight, N=4 for urban environments)
  • PT= Transmit power
  • GT= Total antenna gain
  • ? = Wavelength
  • PR= Receiver sensitivity
  • FM= Fading margin

if in urban environments;-

  • Every 12 dBm receiver sensitivity gain will be double the distance.
  • Every 12 dBi antenna gain will be double the distance.
  • Every 12 dBm Transmitter power gain will be double the distance.

in line of sight environments;-

  • Every 6 dBm receiver sensitivity gain will be double the distance.
  • Every 6 dBi antenna gain will be double the distance
  • Every 6 dBm Transmitter power gain will be double the distance.

http://forum.arduino.cc/index.php?topic=175577.msg1304059#msg1304059

PC or tablet has higher gain antenna and transmit power could be much higher than Yun.

P.S. since use different RF chip set, The Receiver sensitivity could be higher than Yun as well.

I will try with an extra access point to see what that does.

Extra access point:

2014-07-25 20:12 : wifiMonitor (re)started with RESTART_WIFI_WHEN_LOST=True
2014-07-25 20:12 : wifi OK, uptime=0:00:05.038185, ok/nok: 1/0 - Link Quality=70/70  Signal level=-35 dBm
2014-07-25 20:13 : wifi OK, uptime=0:00:25.109937, ok/nok: 2/0 - Link Quality=70/70  Signal level=-33 dBm
2014-07-25 20:13 : wifi OK, uptime=0:00:45.157321, ok/nok: 3/0 - Link Quality=70/70  Signal level=-33 dBm
2014-07-25 20:13 : wifi OK, uptime=0:01:05.204992, ok/nok: 4/0 - Link Quality=70/70  Signal level=-35 dBm
2014-07-25 20:14 : wifi OK, uptime=0:01:25.262757, ok/nok: 5/0 - Link Quality=70/70  Signal level=-34 dBm

If it now fails…

NewLine: I will try with an extra access point to see what that does.

Maybe a bit cheap solution: I mounted a pair of larger antennas on my wireless router (just +- 1o euros); they give me +- 8dB more signal strength.

kind regards,

Jos

thank you for sharing the python script