Trick #21: My Raspberry Pi becomes unreachable (wireless connection lost)

Some of you have experimented this annoying behavior. Here is a tutorial to try to fix it.

Please note that the following informations are based on my own observations, and the observation of some users affected by the issue.

This is not a general tutorial to fix the problem definitively at all, and it only depends on the OctoPrint + Printoid usage context.

1/ Description of the problem

The conditions are the following:

  • OctoPrint is installed on a Raspberry Pi (1, 2 or 3)
  • You have installed the OctoPi environment or Raspbian + OctoPrint
  • Your Raspberry Pi is connected to your network by WiFi
  • You are using both of Printoid and the OctoPrint web interface on your phone

The ways to reproduce the issue are the following (this list is non-exhaustive):

  • Opening the OctoPrint web interface from your phone (frequent)
  • Showing your webcam from Printoid (frequent)
  • Sending SSH commands from Printoid (pretty rare)
  • Simply opening Printoid (very rare)

Symptoms are the following:

  • You can’t access to the OctoPrint web interface anymore
  • You can’t connect with Printoid anymore
  • Your current printing job is still running fine

2/ Explanations

I don’t have great explanations to provide 😉

  • It seems that your Raspberry Pi does not support to much network traffic and the network manager of Raspbian simply crashes.
  • This also seems to occurs only with a wireless connection to the network, and (most of time) when the WiFi signal is not so good.

3/ Solutions

Again, I haven’t a definitive fix for this problem right now, but according my observations, the three following solutions seem to work well and solve the issue (in 95% of cases)

Solution 1: change the WiFi channel

Your rooter is emitting your WiFi access point through a specific frequency (in a standard range of frequencies). This emitting frequency is called “channel”.

There are up to 14 channels in the 2.4GHz WiFi bandwidth (13 in Europa, 12 in the USA). The different channels are here to prevent interferences between the different equipments in your environment (can be other WiFi networks, microwaves oven, amateur radios…)

So you need to analyze the frequency spectrum at your home our your apartment, were you Raspberry Pi is located. That’s way, you will be able to know which are the channels the most and the less used.

A good way to analyze your WiFi is to use this Android application: Wifi Analyzer (by F01arproc)

As you can see in the previous screenshot of Wifi Analyzer :

  • The “home” network is emitted on the channel 11. That’s really good because it does not disrupt at all with the other access points.
  • The “TBC-LINK_5F476C” network is emitted on the channel 1. That’s not so good, but it superimpose a bit with “Tenda_597638
  • The “TBC_LINK_44C950” network is emitted on the channel 6, same as “Netcore1” and “wacweozhensben7“. That’s really bad because there are 3 networks on the same channel, and its signal strength is not good at all. This network will be probably difficult to reach and a lot of data packets will be lost during the network communications.

The idea is to configure your rooter to emit your WiFi access point on the less used channel. Simply check in your rooter configuration page / documentation for how to.

Learn more informations about the WiFi channels here.

Solution 2 : use an extra WiFi USB dongle

The Raspberry Pi does not support yet the WiFi 5GHz.

Today, the 5GHz access points are not used a lot. That’s a good thing to know because the 5GHz bandwidth allows you to use up to 25 other channels, with a better download/upload rate.

Check if your rooter is able to emit a 5GHz access point and enable it (some rooters are already emitting a 5GHz access point by default, with the same SSID than the 2.4GHz one – you can also choose to emit it with a different SSID in order to distinguish them).

By using a 5GHz-complient WiFi USB dongle, you will be able to connect to this 5GHz access point with your Raspberry Pi.

You can find small WiFi dongles in Amazon for example, at a reasonable price.

Solution 3 : wired connections rule the world!

If ever the solution 1 nor 2 do not work in your case, or if ever you can’t manage how to change the WiFi channel of your rooter – or won’t buy an extra dongle for your RPi…

You can simply connect your Raspberry to Internet over an ethernet cable. As I’ve explained in the solution 1, the WiFi networks can be easily disrupted by other devices such as neighborhood’s access points, microwaves ovens, amateur radios… but also concrete walls, mirrors, etc…

The wired connections rule the world! None of these disruptions affect an Ethernet cable. Unless you have a hamster or a rabbit at home…

4/ To go further

If ever you reproduce this issue by another way, or if you have a better solution to fix it, I’ll be happy to hear & share your experience here 😉

Feel free to contact me at printoid.for.octoprint@gmail.com

[EDIT: 09/29/2017] Probably a kernel issue (dues to the power management)

Niels Bunkenburg sent me an email today with a link to a bug on the RPi’s github: https://github.com/raspberrypi/linux/issues/1342

That seems to be a kernel issue dues to the power management on the Raspberry Pi. I will investigate on that an probably update this page once I got more informations.

Advertisements

2 thoughts on “Trick #21: My Raspberry Pi becomes unreachable (wireless connection lost)

  1. Hi Anthony,

    Could the reason that Raspberry does not support channel 12 and 13 for countries where it should be supported? Some routers hop to these, it could have something to do with the problems you describe? I fixed my channel for that reason rather then have it select an available one (in my Fritz Box) and choose channel 12 or 13.

    I would not be able to connect reliably with Octoprint otherwise…

    Cheers Ruud

    2017-09-27 12:51 GMT+02:00 Printoid for OctoPrint :

    > Anthony posted: “Some of you have experimented this annoying behavior. > Here is a tutorial to try to fix it. Please note that the following > informations are based on my own observations, and the observation of some > users affected by the issue. This is not a general t” >

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s