Skip to content

Raspberry Pi: disable Wi-Fi powersave, and stay connected all the time

Recently I installed a Raspberry Pi with Raspbian, and attached a touchscreen to it. The device is supposed to work as a display for our openHAB home automation system. All nice and shiny, except the Pi occasionally disconnects from the Wi-Fi - apparently in order to safe power. Once the network device is needed, the Wi-Fi is reconnected. That is the default setting.

That is quite annoying, because the HABpanel will lose it's connection to the openHAB server, and no longer show widget updates. Some widgets like "time" will just continue to work, but other widgets like status of the washing machine, or the current outside temperature just show the last state, and never update.

 

The power saving is a function of the WLAN device, therefore the "wlan0" must be updated:

/sbin/iw dev wlan0 set power_save off

This works until the next reboot. And since I have all my devices setup using Ansible, I added two steps to the setup. First a small file:

#!/bin/sh

/sbin/iw dev wlan0 set power_save off

exit 0

Let's say the name is "wlan0-power". I place it in my Playbook directory, under "files/", among with some other files for that Pi.

The next step is telling Ansible to deploy that file:

- name: Copy WLAN powersave script
  copy:
    src: '{{ playbook_dir }}/files/wlan0-power'
    dest: '/etc/network/if-up.d/wlan0-power'
    owner: root
    group: root
    mode: 0755

The "if-up.d" directory holds scripts which will be executed when a (any) device comes up. Could check for the coccrect device name first, but I don't bother much. This script will only execute once the device comes up. If the device is already up, nothing happens. Either run the script manually once, or reboot the Pi. Since it's part of my initial deployment, there will be a reboot later in that Playbook - so I don't have to reboot just for this file.

  • Twitter
  • Bookmark Raspberry Pi: disable Wi-Fi powersave, and stay connected all the time at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Raspberry Pi: disable Wi-Fi powersave, and stay connected all the time
  • Bloglines Raspberry Pi: disable Wi-Fi powersave, and stay connected all the time
  • Technorati Raspberry Pi: disable Wi-Fi powersave, and stay connected all the time
  • Fark this: Raspberry Pi: disable Wi-Fi powersave, and stay connected all the time
  • Bookmark Raspberry Pi: disable Wi-Fi powersave, and stay connected all the time at YahooMyWeb
  • Bookmark Raspberry Pi: disable Wi-Fi powersave, and stay connected all the time at Furl.net
  • Bookmark Raspberry Pi: disable Wi-Fi powersave, and stay connected all the time at reddit.com
  • Bookmark Raspberry Pi: disable Wi-Fi powersave, and stay connected all the time at blinklist.com
  • Bookmark Raspberry Pi: disable Wi-Fi powersave, and stay connected all the time at Spurl.net
  • Bookmark Raspberry Pi: disable Wi-Fi powersave, and stay connected all the time at Simpy.com
  • Bookmark Raspberry Pi: disable Wi-Fi powersave, and stay connected all the time at blogmarks
  • Bookmark Raspberry Pi: disable Wi-Fi powersave, and stay connected all the time with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Trackbacks

No Trackbacks

Comments

Display comments as Linear | Threaded

No comments

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.
To leave a comment you must approve it via e-mail, which will be sent to your address after submission.
Form options