5

I have an Edimax EW-7811Un plugged into my RPi's USB port.

Frequently, when connected to the internet through the Edimax, my SSH connection drops or is very sluggish. I don't think I've had a session for longer than 5 mins without it freezing. However, it seems like freezing only happens after it has been idle for a period of time. For example, if I just keep pressing enter at the command line it does not freeze, but if I let it idle for a bit and then come back and press enter it won't register and close out. That being said there are some cases where i leave it idle for a period of time and a type something and it takes 15-20 seconds to register and it does not close out.

Sometimes I get this error after the connection drop: pi@raspberrypi ~ $ Write failed: Broken pipe

Any thoughts on how to remedy this? I've already tried a different PSU which didn't really do anything. Could it be router settings I have? My router is kind of a POS. Or maybe this is an issue with how I set up the edimax with the RPi?

metersk
  • 153
  • 1
  • 4

2 Answers2

4

I had this exact problem, down to every detail stated in the original question. Upon additional searching, I saw this question (with the same wording) was cross-posted in the raspberrypi.org forums where a user suggested this solution:

http://www.andreagrandi.it/2014/09/02/how-to-configure-edimax-ew-7811un-wifi-dongle-on-raspbian/

The poster of the question in the raspberrypi.org forum, who I believe is the author of this question, replied the following day with:

this worked perfectly! thank you

Link to the RPI forum on which this answer is based: http://www.raspberrypi.org/forums/viewtopic.php?f=28&t=98375

markee
  • 66
  • 2
3

For some reason, most of the cheap WiFi dongles you buy for the Raspberry Pi (including Tenda, Edimax, et all) have a power saving mode turned on by default, which causes these dropped (and/or spotty) connections.

I wrote a detailed guide for setting up WiFi on the Raspberry Pi, after about the 10th time configuring it on one of my own Pis (I now have 2 A+s, 2 B+s, a B, and a couple 2 model B's on the way!).

Basically, do the following:

  1. Create a new configuration file: sudo nano /etc/modprobe.d/8192cu.conf
  2. Add the following line inside the configuration file:

    options 8192cu rtw_power_mgnt=0 rtw_enusbss=0
    
  3. Reboot your Raspberry Pi: sudo reboot

Once rebooted, the WiFi connection and SSH sessions should be much more stable; you shouldn't need to do any additional work, like adding cron tasks that ping servers or anything like that.

geerlingguy
  • 1,616
  • 2
  • 16
  • 22
  • Why do some people suggest adding cron task to ping router? What is it good for? – Michael Jul 25 '15 at 17:33
  • 1
    If the above instructions don't help to keep the WiFi connection alive/ready for activity, pinging the router every n amount of time helps. It's a form of 'tickling' the network connection to keep it from dropping out for extended periods of time while the WiFi chip sleeps to conserve energy. – geerlingguy Jul 27 '15 at 02:23