Friday, July 25, 2014

wifi monitor to troubleshoot Yun wifi - Results

RESTART_... = true,
sketch: simple LED blink
2014-07-25 08:11 : wifi OK, uptime=6:59:04.868013, ok/nok: 2310/3
no particular pattern


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.



Wednesday, July 23, 2014

Arduino Yun Wifi stuff (reset, access point mode, ...)

The Yun has 3 reset buttons: one of those is a Wifi reset button (WLAN Rst)

Depending on how long you press the button the following will happen (I think):


  • Pressing the WLAN Rst button for <5 sec does not do any reset at all, correct (it just lets a LED blink)
  • Pressing the Wifi Rst button for >=5 but <30 sec will run the wifi-reset-and-reboot script. This script will return the Yun in access point (AP) mode and will reboot the Yun. The Yun should then present its network SSID.
  • Pressing for >= 30 sec will restore some factory settings

If you just want to reset the Wifi, you can do this with the wifi script (should be in /sbin):

    root@Arduino:/tmp# wifi down && sleep 5 && wifi
    Successfully initialized wpa_supplicant

You probably can also do:

    ifconfig wlan0 down; ifconfig wlan0 up

Note that rc.local contains by default the entry wifi-live-or-reset. After the Yun boots, it will check for the configured Wifi network. If it is not found within 60sec, the Yun will go into access point mode.

Saturday, July 5, 2014

git stuff

general:
git add .
git commit .
git push origin master
git reset .
git rm
vi .gitignore
to remove local changes from (uncommitted) file:
git checkout filename
when creating a new project on gitHub, get it on PC:
mkdir wifiMonitor
cd wifiMonitor/
git init
git remote add origin https://github.com/NicoLugil/wifiMonitor
git remote -v
git fetch origin
git merge origin/master
After creating gh-pages (project page) using website, get it on local copy:
https://help.github.com/articles/creating-pages-with-the-automatic-generator
in essence:
cd repository
git fetch origin
# remote: Counting objects: 92, done.
# remote: Compressing objects: 100% (63/63), done.
# remote: Total 68 (delta 41), reused 0 (delta 0)
# Unpacking objects: 100% (68/68), done.
# From https://github.com/user/repo.git
#  * [new branch]      gh-pages     -> origin/gh-pages

git checkout gh-pages
# Branch gh-pages set up to track remote branch gh-pages from origin.
# Switched to a new branch 'gh-pages'