usmcguy
Posts: 10
Joined: Mon Mar 04, 2013 12:01 am

WiFi Doesn't Always Connect

Wed Mar 13, 2013 11:41 pm

WiFi USB Adapter: 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter

I am using the above USB WiFi module for my Raspberry Pi running Raspian OS. Some times when the Raspberry powers up it doesn't connect.

I have the USB adapter plugged into a powered USB Hub. Running the Command "cat /proc/net/wireless" shows I have a Quality Level of 63 and 0 noise.

Does anyone know why it will not always connect? Sometimes it takes several manual power disconnect and reconnect to get it online.

I have the following in the /etc/network/interfaces file:

Code: Select all

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
auto wlan0
iface wlan0 inet dhcp
wireless-essid MyWirelessNetworkID
pre-up wpa_supplicant -B w -D wext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
post-down killall -q wpa_supplicant
iface default inet dhcp
Inside of the /etc/wpa_supplicant/wpa_supplicant.conf file I have the following:

Code: Select all

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
	ssid="MyWirelessNetworkID"
	psk=VeryLongStringOfMypsk
	proto=WPA RSN
	scan_ssid=1
	key_mgmt=WPA-PSK
	pairwise=CCMP TKIP
	group=CCMP TKIP
}

MrEngman
Posts: 4051
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: WiFi Doesn't Always Connect

Sun Apr 21, 2013 2:27 pm

Try this:

Run the command iwlist wlan0 scan. This should show a list of access points in range of your Pi. Check what channels they are using and then set the channel on your wifi access point to avoid those used by the others in range.

I have two access points and I had trouble connecting to the one furthest from my Pi until I changed the channel number it used. A wifi scan shows up to 7 different networks as well as my own 2. Most are set to channel 6, one to channel 1 and another channel 11. I have mine set to channel 3 and 9 and now I have no trouble connecting to either.

MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

marcins83
Posts: 5
Joined: Mon Apr 08, 2013 8:22 pm

Re: WiFi Doesn't Always Connect

Sun Apr 21, 2013 3:04 pm

Hi!

I am running raspberry pi with Openelec, I have exactly the same problem with my wifi adapter, would you help me how to set it up???

The command iwlist wlan0 scan does not work...

Anyone could help?

MrEngman
Posts: 4051
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: WiFi Doesn't Always Connect

Mon Apr 22, 2013 12:00 am

Well, I've not used Openelec before so downloaded and installed it on an SD card and now have it running with wifi working. Ran XBMC and set up the wifi from the gui - System/openELEC/Network2.

Logged in using SSH to get to a terminal setup and haven't got much further. The image doesn't seem to include any of the wifi tools that I'm used to using and trying to install them doesn't seem to be allowed - or not easily. Network setup also appears totally different to what I've seen before.

If your problem is due to interference from other networks changing the channel your access point uses may help. Trouble is I'm not sure with this image how to get a scan of any other nearby wifi networks. I can only suggest that you check your access point and see which channel it is using and maybe try changing it to a different channel and see how you get on. Change it up or down a couple of channels and see how you get on.

Another issue that many people would blame for causing instability with the wifi is the power supply and whether it can maintain sufficient voltage when the Pi is drawing maximum current especially when the wifi is plugged directly into one of the Pi's USB ports rather than the dongle being plugged into a powered hub.

MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

marcins83
Posts: 5
Joined: Mon Apr 08, 2013 8:22 pm

Re: WiFi Doesn't Always Connect

Mon Apr 22, 2013 2:15 am

First of all I would like to thank you for your precious time that you spent on this project. I have been looking for help on the openelec.tv forum but nobody has tried to help... Thanks buddy!

The thing is that my access point works in an automatic channel mode (wifi protected setup - cisco router) so I am unable to check the channel since it is randomly (i guess) assigned.

The power supply should not be the issue, I have checked the Raspberry Pi both wit the USB cable connected to the TV and to the external power source.

I will try again to look for some help on the openelec.tv forum by posting your recommendation, maybe someone will finally find a solution to this problem.

What wifi adapter are you using??? Are you facing similar problems after keeping the RPi for at least 30 minutes powered off?

best regards,
Marcin

MrEngman
Posts: 4051
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: WiFi Doesn't Always Connect

Mon Apr 22, 2013 3:34 am

No problem, glad to be of help, or at least offer some advice.

Interesting to hear you use automatic channel mode. I did think about that. Must try it here and see what happens.

I have several different wifi dongles but I usually use the Edimax EW7811Un (Realtek rtl8188cus) connected directly to the USB port of the Pi.

Other dongles I have are Netgear WNA1100 (Atheros ar9271), Edimax EW-7622UMn (Realtek rtl8192su) and Micronet SP907ns (Realtek rtl8188cus). No obvious problems with any of them and I usually use them connected directly to the Pi's USB port or use a usb extention cable, USB A plug to USB A socket, to connect them to the Pi so they still take their power directly from the Pi. An advantage in using the extension cable is that with my Pi mk2 with no USB fuses the Pi does not reset if I plug in the wifi when it is powered on. If I do not use the extension cable the Pi will reset if I plug the wifi straight into the Pi's USB port.

MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

marcins83
Posts: 5
Joined: Mon Apr 08, 2013 8:22 pm

Re: WiFi Doesn't Always Connect

Mon Apr 22, 2013 1:25 pm

Thank you for your reply again!

I have just ordered the same adapter that you are using: Edimax EW7811Un.
As for my understanding you do not use any external USB hub for this adapter?

MrEngman
Posts: 4051
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: WiFi Doesn't Always Connect

Mon Apr 22, 2013 8:59 pm

Correct, I do not use a hub for the wifi. It is connected directly to the USB port of the Pi using a USB extension cable.

I used to have it plugged directly into the USB port of the Pi but with the newer Pi Mk2 with no fuses on the USB ports if I unplug it and then plug it back in again it will cause the Pi to reset. Using the USB extension cable I can now unplug the wifi from the cable and plug it back in again without problems. Or with the wifi still connected to the extension cable I can unplug the cable from the USB port of the Pi and plug it back in again without any problems.

I also have a Pi Mk1 and also run it with the wifi connected directly to the USB port of the Pi. I use an old powered hub with the Pi Mk1 but only to connect the keyboard and mouse.

FYI I changed my access point to use automatic channel mode and I still have no problems. I also powered of the Pi last night and powered on again in the morning and again no problem connecting. After doing a scan I also noticed all the APs that had been using channel 6 were now using channel 11 so I guess they are also using auto mode.

MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

marcins83
Posts: 5
Joined: Mon Apr 08, 2013 8:22 pm

Re: WiFi Doesn't Always Connect

Tue Apr 23, 2013 2:23 am

Again thank you for your reply :)

It is good to know that it is not a assignment of the channels - that would be weird... It still makes me wonder what is wrong with the wifi adapter. Why does the RPi has to be restarted (after it is powered off for a longer time) in order for the adapter to start working...

Did you test it overnight with the Edimax EW7811UN?

I also bought the Logitech K230 wireless keyboard so i may be in need to use the external hub for my pi.

I do not know if the RPi has 2.0 or 3.0 USB ports but I assume it rather has the 2.0. This follows my next question, if the pi has 2.0 USB ports does this make sense to get the 3.0 USB hub? Would not it be a waist of money if I bought one?

FYI
My TV just broke, I have Samsung (2 years), what happens is it turns on and for a few (2-3) seconds the screen is ok and all the sudden it goes black...
I googled this and some guys recommend to replace few capacitors on the power board (I have already ordered the parts). But for me the board looks ok, capacitors do not look like they were blown out. But what can I say, I will replace those and see what happens... :)

MrEngman
Posts: 4051
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: WiFi Doesn't Always Connect

Wed Apr 24, 2013 9:33 am

To me changing channel seems to make sense and appeared to fix the problem I originally had with not being able to connect to one of my access points. Now I have no trouble at all connecting to my preferred AP. My Pi is about 1.5M away from one AP and 10M from my other AP. My Pi is configured to connect to the AP 10M away.

One other thing to consider is the wifi configuration. Looking through the forums there appears to be so many different ways to setup the wifi and it may be possible that some may work more reliably than others.
.
With the EW7811Un I can power off the Pi for several hours and it will always reconnect straight away without any problems when I switch it on again.

The USB ports are supposed to be USB 2 so using a USB 3 hub does not seem to make much sense.


MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

marcins83
Posts: 5
Joined: Mon Apr 08, 2013 8:22 pm

Re: WiFi Doesn't Always Connect

Wed Apr 24, 2013 10:51 pm

Hi! Thanks for your reply!

In this matter you're right - it makes sense to change the channel.

I have received my new wifi adapter and it looks like it powers up every time even when powered off for many hours!

I also tried this with my wireless keyboard adapter connected to the raspberry at the same time - the wifi adapter powers up every time!

I still have my tv broken - waiting for some parts to arrive - but once it's up again I will confirm my preliminary findings :)

Return to “Troubleshooting”