Monday, June 8, 2015

Raspberry Pi and Wi-Fi dropout problem

Wi-Fi connection gets dropped quite often. I have Wi-Pi adapter that has Ralink rt2800us chipset (you can find tests of different adapters here). You can confirm this from dmesg:
$ dmesg | grep rt2x00
[ 5.800208] ieee80211 phy0: rt2x00_set_rt: Info - RT chipset 5390, rev 0502 detected
[ 6.134049] ieee80211 phy0: rt2x00_set_rf: Info - RF chipset 5370 detected
[ 18.272745] ieee80211 phy0: rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin'
[ 18.275301] ieee80211 phy0: rt2x00lib_request_firmware: Info - Firmware detected - version: 0.29
Now, how can we improve Wi-Fi stability? First, you can disable the power management of the Wi-Fi adapter. However, you can also write a script that will ping something, say, every, minute. Check power management:
$ iwconfigwlan0 IEEE 802.11bgn ESSID:"***********"
Mode:Managed Frequency:2.447 GHz Access Point: F4:EC:38:CA:D9:88
Bit Rate=108 Mb/s Tx-Power=20 dBm
Retry long limit:7 RTS thr:off Fragment thr:offPower Management:onLink Quality=55/70 Signal level=-55 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0Tx excessive retries:0 Invalid misc:1 Missed beacon:0
Disable power management as follows if enabled:
$ echo “wireless-power off” >> /etc/network/interfaces
You can also try to keep the connection alive. Add crontab job /usr/local/bin/reconnect-wifi.sh that will check Wi-Fi state every 5 minutes:
#!/bin/bashifconfig wlan0 | grep -q "inet addr"if [ "$?" != 0 ]; then ifup --force wlan0fi
Add new job to crontab. Open your crontab:
$ crontab -e
and add this line at the end:
*/5 * * * * root /usr/local/bin/reconnect-wifi.sh >> /var/log/syslog 2>&1

No comments:

Post a Comment