Thursday, July 24, 2014

wifi monitor to troubleshoot Yun wifi

My Yun's wifi seems to be very unstable.

I created a python script to monitor the Yun's wifi connection.

This script can be downloaded here.

The main script is wifiMonitor.py

There are 4 things that are supposed to be configured (see wifiMonitor.py):

LOGFILE="/tmp/wifiMonitor"
LOGFILESD="/mnt/sda1/arduino/wifiMonitor_"
RESTART_WIFI_WHEN_LOST = True
TO_PING = "192.168.1.1"

The first 2 give the location of where the logs are stored: LOGFILE is the main destination, with now and then a backup to LOGFILESD.
When it sees the wifi coonection is lost, it will either:
- do nothing (just wait and hope it gets restored)
- restart the Yun's wifi
This is configured by the RESTART_WIFI_WHEN_LOST option.
To determine if the Wifi is ok, it will ping a particular site or IP address. This is set by the TO_PING option. In my case I just ping my router.

In short the script will now and then ping to TO_PING site to determine if Wifi is ok and do the appropriate action if not. It logs the ratio of ok/not_ok and the current uptime.



4 comments:

  1. hi
    please can you guide in detail on how to install this on arduino yun
    regards

    ReplyDelete
  2. That depends on where you can start. The first thing to do is to download the script and put it on your arduino Yun somewhere. I assume you know how to do this? If not, maybe this can help: http://myyafa.blogspot.de/2013/11/mounting-yun-sd-card-on-my-linux.html

    Next you need to make sure the script starts when your Yun starts: http://myyafa.blogspot.de/2013/12/starting-script-after-cpu-linino-boot.html

    ReplyDelete
  3. Hi Nico, I wonder according to your script what is the fastest recovery time for the wifi to be back up and running again?

    Thanks bro :)

    ReplyDelete
    Replies
    1. I'm planning to make my yun to send data to local database every three seconds, and i wonder how many seconds we need to restart the yun wifi once it get disconnected.

      Delete