WiFi setup and troubleshooting

troubleshooting
wifi
octopi
connectivity

#1

A number of people who have followed the instructions for setting up OctoPi on your Raspberry Pi experience problems getting connected to WiFi. This thread is intended to detail a couple of common problems people have experienced and things to try to resolve them. This page assumes that your WiFi network is up and working and that other devices are able to connect to it without a problem.

We are also assuming that you have already successfully downloaded the OctoPi image and "burned" it on to your SD card. The OctoPi image can be found at https://octoprint.org/download/. The page also includes basic installation directions as well as a video describing installation process. There are also a number of other OctoPrint/OctoPi videos on YouTube which describe basic set-up as well as advanced options. See for example this series

Basic Setup - Edit Info to Log On to Your WiFi Network

:point_up: Heads-up!

Before editing the files noted below, read the troubleshooting section below about using the appropriate text editor while editing this file.

With the SD card plugged in to your computer (you may need an adapter for your computer to accept the SD card if it doesn't already include the appropriate slot). You access the card just as you would an external disk or thumb drive mounted on your computer. The file you will need to edit is in the /boot/ directory of the SD card (if you are editing on a Windows or Mac computer, the /boot/ directory will likely be the only directory you can see.) Look in the "boot" directory of the SD card. The file you need to edit varies depending on which version of OctoPi you downloaded. OctoPi 0.14 has been out for some time. The stable release of OctoPi 0.15 is in the process of being release in April/May of 2018. See the section below appropriate to your version.

OctoPi 0.15.0 or newer

In the /boot/ directory, open octopi-wpa-supplicant.txt with the appropriate text editor. (The use of /boot/octopi-network.txt which was used in OctoPi version 0.14 has been discontinued in version 0.15). There are instructions within that file for editing your network settings. Be sure to use an appropriate text editor. For most WiFi networks, you'll edit the section that looks like this:

## WPA/WPA2 secured
#network={
#  ssid="put SSID here"
#  psk="put password here"
#}

Uncomment the 4 lines which have a single # front of them by deleting the # (do not delete any spaces after the #), then enter your WiFi network SSID (your network's "name") and the password in the indicated places. Note that the SSID and password are case sensitive. (A common problem when cutting and pasting this information is accidentally including leading or trailing spaces which are not part of the SSID or password.) For a network named JoesWiFi with a password of 12345, it should look like this:

## WPA/WPA2 secured
network={
  ssid="JoesWiFi"
  psk="12345"
}

In OctoPi 0.15, you will also need to set the WiFi Country. The setting for this is also found in the /boot/octopi-wpa-supplicant.txt file. Scroll to near the bottom of the file and find the section that begins with "# Uncomment the country your Pi is in..." By default, the line for the United Kingdom is uncommented (the "#" is removed from the front of the line). If you are in some country other than the UK, comment out the United Kingdom line by putting a # in front of it, then remove the # from in front of the country you are in (do NOT remove the # from the middle of the line). If your country is not in the list, follow the link provided in the file to find the complete list, and create a new line for your country. For example, if you are in Switzerland, you would scroll down the page to find that the 2 letter code is "CH", and create a new line that looks like this:

country=CH # Switzerland

:point_up: Heads-up!

Your WiFi's SSID is hidden? You'll need to to some additional changes or your Pi won't be able to find your network after all!

Within the brackets { ... } add a new line

scan_ssid=1

For example, if it is the WPA/WPA2 section you adjusted earlier, you now want it to look something like this:

## WPA/WPA2 secured
network={
 ssid="JoesWiFi"
 psk="12345"
 scan_ssid=1
}

Save the changes and exit the text editor. Do not simply yank the SD card from the reader slot. Find and use the menu command to Eject/unmount the SD card from your computer, wait a few seconds for the unmounting process to complete, and then remove it from the card reader slot. Make sure the Pi is powered down, and then install the SD card in your Pi and boot it up by turning on the power to the Pi. Note that the first boot may take some time: be patient.

OctoPi 0.14 or older

In the /boot/ directory, open octopi-network.txt with the appropriate text editor. There are instructions within that file for editing your network settings. For most WiFi networks, you'll edit the section that looks like this:

## WPA/WPA2 secured
#iface wlan0-octopi inet manual
#    wpa-ssid "put SSID here"
#    wpa-psk "put password here"

Uncomment the 3 lines which have a single # front of them by deleting the # (do not delete any spaces after the #), then enter your WiFi network SSID (your network's "name") and the password in the indicated places. Note that the SSID and password are case sensitive. (A common problem when cutting and pasting this information is accidentally including leading or trailing spaces which are not part of the SSID or password.) For a network named JoesWiFi with a password of 12345, it should look like this:

## WPA/WPA2 secured
iface wlan0-octopi inet manual
    wpa-ssid "JoesWiFi"
    wpa-psk "12345"

:point_up: Heads-up!

Your WiFi's SSID is hidden? You'll need to to some additional changes or your Pi won't be able to find your network after all!

Append these lines to the section you just edited:

wpa-ap-scan 1
wpa-scan-ssid 1

For example, if it is the WPA/WPA2 section you adjusted earlier, you now want it to look something like this:

## WPA/WPA2 secured
iface wlan0-octopi inet manual
   wpa-ssid "JoesWiFi"
   wpa-psk "12345"
   wpa-ap-scan 1
   wpa-scan-ssid 1

Save the changes and exit the text editor. Do not simply yank the SD card from the reader slot. Find and use the menu command to Eject/unmount the SD card from your computer, wait a few seconds for the unmounting process to complete, and then remove it from the card reader slot. Make sure the Pi is powered down, and then install the SD card in your Pi and boot it up by turning on the power to the Pi. Note that the first boot may take some time: be patient.

TROUBLESHOOTING The WiFi Connection

Try some of these suggestions if you are unable to connect to your Pi via your Wifi network:

Editing the octopi-wpa-supplicant.txt file (or octopi-network.txt in OctoPi 0.14 or earlier) with the wrong text editor

Some text editors, including Apple's TextEdit (included with macOS) and WordPad (included with Windows) make changes to the files you edit which render them unusable by the Pi's Raspian operating system. (I've heard that Windows NotePad can also cause problems, but have not personally verified that). There are several good, free options out there you can download with will avoid these problems.

For the Mac, I use BBEdit (after 30 days, the freely downloaded version reverts to a limited demonstration version, but that limited version still does everything you need it to to edit files on your Pi.)

For Windows, one of the more popular choices is NotePad++. (also free)

Note that if the file has already been edited with an inappropriate text editor, your best bet is starting over with a clean, unedited copy of that file. Simply editing it again with the correct editor is unlikely to fix the damage.

:spiral_notepad: Note:

If you really want to use Apple's TextEdit on your Mac, it can be fixed by making a few changes to it's default preferences. Launch TextEdit and go to TextEdit>Preferences. Under Format, choose "Plain Text". Under Options, uncheck "Smart Quotes" and "Smart Dashes". Close the preferences pane, then quit TextEdit and relauch. It will now work without messing up your Pi's files. If you have already edited a file before making these changes, you may need to start with a clean copy of the file to get it to work. A telltale sign that TextEdit has screwed up your file: the quotation marks around the SSID and password will show up as "curly" quotes rather than the desired "straight" quotes.

Weak/Inadequate Power Supply

This is a common cause of a wide range of intermittent and hard to diagnose issues, and especially causes problems with the extra load put on the Pi by running WiFi, BlueTooth, a camera, etc.

The Pi needs a solid source of 5+VDC. A minimum of 2 amps. (Many recommend 2.5 Amps for the Pi 3, particularly if the Pi is powering a camera or USB devices.)

A charger is not the same as a power supply. Chargers are generally not required to provide tightly regulated voltage or may not be able to provide the peak current that the Pi requires. That old phone charger probably won't work, or if it does, it may cause you intermittent problems. Get an appropriately rated power supply from a reputable source.

WiFi signal strength

If you are using the built-in WiFi in a Raspberry Pi-3, a Pi-3B+, or Pi-0W, be aware that the signal strength from the tiny internal antenna may be weaker than other WiFi devices. Try moving your Pi closer to the router as a test (even if that is not possible to do when you are printing, the test will at least let you know if this is the issue). If this solves your connection issue, try relocating your Pi or your router. Sometimes even a small move can make a big difference. Minimize the number of walls or other obstacles blocking the signal, move things out from behind metal boxes or other electrical devices. (My router sat behind a metal electrical service box in my basement. It worked Ok for other devices in my home, but not the Pi. Building a shelf that positioned it just a couple of feet away made a significant difference in signal strength and WiFi reliability for my Pi.)

Hidden SSID

Your WiFi network's SSID might be hidden after all. Please refer to the corresponding Heads-up boxes in the basic setup guide above and adjust the network configuration file (octopi-wpa-supplicant.txt for OctoPi 0.15.0 and newer, octopi-network.txt for OctoPi 0.14 and older) as described there.

Electrical Interference

Electrical interference from some appliances can cause interference with the Pi's WiFi reception. Items such as florescent lights, dimmer switches, some LED lights (typically, it's the power supplies in 110V LED lights, not the lights themselves), some electric motors, etc. Electrically "noisy" devices often create radio frequency interference, which can wreak havoc with the Pi's WiFi signal. This can cause intermittent problems which are hard to diagnose as those appliances turn on and off.

Copying text from places which do not have "Pi-friendly" formatting

(This is an issue with similar symptoms to using the wrong text editor.)

Cutting and pasting commands or text from some sources can cause problems. There can be subtle differences in the text: for example the site from which you copied may have substituted those "curly" shaped quotation marks for the straight ones that the Pi recognizes, or it may have wrapped what should be one long line into two lines (some sites do that wrap without actually causing a break in the line when you copy it - others put a line break in, which messes up the Pi).

The differences can be hard to spot and can have you pulling your hair out. This is one of the reasons it is recommended to put code in a Code Block when posting (that's what the symbol </> in the icon menu above is for).

Copying files vs. burning the image to an SD card

This one is not really a "WiFi" problem, since the Pi won't boot at all in this case, but for someone new to this - especially if they are running a headless set-up, it may appear that their WiFi is not working (in fact, nothing is working).

Some people make the mistake of simply copying the downloaded OctoPi .IMG file to their SD card (for example, by dragging and dropping the file to their card). This is how you install NOOBS, but it will not work to install an .IMG file such as OctoPi. If installed by simply copying to the SD card, the Pi will not boot. One symptom of this is that when you power up the Pi, all that happens is the red light comes on, but you never see the green light flash at all.

OctoPi must be installed by burning the .IMG file to your SD Card. To do this follow the directions on the OctoPi Download Page. Scroll down the page a bit. That page has a link to instructions to install an .img file to an SD card, like any other Raspberry PI image (Do not use a NOOBS-type installation).

:spiral_notepad: Note:

The instructions linked above mention using Etcher (available for Windows, macOS, or Linux) to burn the image to your SD card. Other OctoPi/OctoPrint help videos may mention using Apple Pi Baker (for macOS) or Win32 Disk Imager (for Windows) to burn the image. Any of these will work fine. (I generally use Apple Pi Baker or Win32DiskImager, since they also allow you to make a backup .img file of your SD card, once you have everything set up and working to your liking. Since SD cards can and do fail, having a backup can save you a lot of hassles down the road)

Damaged or defective SD Card

It's possible your SD card is damaged. This can cause all sorts of problems (including failing to boot), not just WiFi issues. The most common cause of SD card failure is probably inserting or removing the SD card while the Pi is powered up. This is a definite no-no. It's also possible (though a bit less likely) to damage the card by not shutting your Pi down properly prior to turning off the power to the Pi (you can shut down from the "System" menu that shows up at the top of the OctoPrint web page if you are logged in as an Admin user, or by entering the sudo shutdown -h now command from the Pi's command line).

You should also use a good quality, class 10 SD card. There are a lot of knock-off or forged cards out there with questionable quality, often masquerading as top brands. Some are not the size they claim to be, and some are just plain poor quality. Save yourself the hassle and buy a reputable brand from a reputable retailer.

Lastly, SD cards can simply wear out over time. The rated read/write cycles are high, but not infinite. If you have a card that has been working but starts getting flaky, it may be time to replace it.

Other Diagnostic Commands

If all else fails, here are a couple of diagnostic things you can do to help narrow down the problem.

Even if those don't lead to success, please make sure to provide the result of these steps and the output of these diagnostic commands when asking for help on the forums - they will help others help you!

Is your Pi connected to the WiFi network?

There are several ways to check this (note: these are also good ways to find out your Pi's IP address).

Access your router's set-up/control page

If you have access to your router's set up page, there is usually an option to show all connected devices. The details of doing this are beyond what I'll go into here, since each router brand/model is different. In short, you access the page by entering the router's IP address in your web browser's address bar. The IP address varies, but two commonly used setups are 192.168.1.1 and 192.168.0.1 You'll most likely need a username and password to log on to your router (get those from your ISP, if they will give them out). Then poke around the various options. Look for something that says DHCP, or LAN, or WLAN and see if it brings up a list of connected devices. Look for a device named "octopi" in that list (if you have renamed your octopi hostname to something else, look for that name). If you see the name in the list as an active device, your Pi is connected and is using the IP address indicated.

Use a network scanner

There are a number of free apps you can download. I use the free Angry IP Scanner (works on Windows, macOS, and Linux - I have not tried running the Linux version on a Pi). Fing is also a good free option (runs on Windows, macOS, Linux - and has a Pi version. You can also find the Fing app for Android and iOS devices.) Log on to your WiFi network with your computer or phone, launch the app and tell it to scan the network. Look through the result for a device named "octopi" (or whatever name you have given your OctoPi setup). Note that some IP scanners will remember devices from a previous scan and show them even if they are not presently on the network (in this case, usually dimmed out). You are looking for active devices. (If you app shows both active and inactive, yu can usually set a filter to show only active devices.) If you see the name in the list as an active device, your Pi is connected and is using the IP address indicated.

Connect to the Pi via Ethernet or plug in a monitor and keyboard

If your Pi is connected to your local network (or directly to a computer) via an Ethernet cable, you can SSH into it to enter commands on the command line. You can also access the Pi by plugging in a keyboard and monitor. In either case, log into your Pi and enter the following command:

ifconfig wlan0

If your Pi is connected to the WiFi network, the beginning of the output should look something like this:

wlan0     Link encap:Ethernet  HWaddr xx:yy:zz
          inet addr:192.168.aa.bb  (followed by other stuff)

The four-part number is the IP address assigned to your Pi by your router for WiFi access. (The "192.168." start of the number is a very common sequence for home WiFi networks. The "aa.bb" part may be a variety of numbers. Another common starting number sequence is "10.". Unless you have an unusual network/router setup, yours will likely look similar. Large corporate or school networks will likely be different.)

If the Pi is not connected to a WiFi network, the beginning of the output from that command will likely look something like this:

wlan0     Link encap:Ethernet  HWaddr xx:yy:zz
          UP BROADCAST MULTICAST  MTU:1500  Metric:1

In other words, there's no line listing "inet addr:" for wlan0.

Can your Pi even see your WiFi network?

If you are able to log into your Pi through an Ethernet connection or with an attached monitor and USB keyboard, the following command will show all of the WiFi networks your Pi can see (whether it can connect to them or not):

sudo iwlist wlan0 scan

Several lines down in the output from that command, you should see a line that looks like:

ESSID:"yourWiFi"

Where "yourWiFI" is your WiFi network name (the SSID, the same name you use when connecting a device to the network). If you have more than one WiFi network in the area, the output will show a similar block for each network (generally a couple dozen lines of info for each WiFi network).

If you do not see your network listed in the output, then the Pi is simply not seeing the the network at all. There could be a number of causes. See some of these further up: WiFi Signal Strength, Hidden SSID, Weak/Inadequate Power Supply, Electrical Interference.

:thinking: Still not working?

Please use the OctoPi WiFi/network connection troubleshooting megatopic to seek help!


Note: This first post in this topic is a wiki, so others can edit and add to it. If you do edit this post, please try to follow the formatting here to help separate the various various issues (I just copy the heading line from an existing section, paste it in, and edit to make a new one). Don't let formatting fears stop you from posting a fix that may be helpful to others. I'll try to stop in and clean things up from time to time if it's needed. When editing, please leave this paragraph at the bottom of the page.


OctoPi WiFi/network connection troubleshooting megatopic
I can't reach my OctoPi under octopi.local
Pi 3 Model B+ Octoprint Build
Problem with setting up the Pi
OctoPi won't open anymore
Installed OctoPi on Astrobox, can't connect to my WiFi
Pi 3 model B unable to connect to WIFI
Unable to get WiFi to work on OctoPi
Cant SSH into Pi 0
Pi 3 Model B+ Octoprint Build
I can't reach my OctoPi under octopi.local
Octopi on Pi B3+ with HDMI monitor keyboard and mouse?
Wifi on OctoPi 0.15 (pi 3)
Installing on Mac
Setting up Wi-Fi problem
Playground for post experiments
Wifi Will Not Work!
Wifi Will Not Work!
How to change a WIFI Name and Password?
WIFI Not connecting on Octopi (latest release)
#8

I'm wondering if it might make sense to move this into the FAQ category? What do you think?


#9

Makes sense to me.

I'm hoping others will jump in with other common issues. I also have a few diagnostic commands I have recommended in the past, but I never remember the exact format. I'll put them up when I get a chance.

UPDATE: diagnostic commands added in this post


#10

Sounds good! I've moved it over now.


#12

7 posts were split to a new topic: OctoPi wifi/network connection troubleshooting megatopic


#15

(This post has now been merged into the top post)


#16

@John_Mc I've taken the liberty to move the contents of your "diagnostics" post into the top post as well - will hopefully get more people to see it.


#17

Good idea. I was thinking of removing the original diagnostics post, now that it's in the first post, but I'm thinking it has been linked to from other posts here and from other sites, so I guess I'll leave it alone.


#18

We can just edit it down to

(This post has now been merged into the top post)

or something?


#19

Makes sense to me. That way, we don;t have to edit it in two places if there is an update.

I'll give it a try. Hopefully I don't screw things up in the process.


#20

Oops! I guess I can no longer edit that post (no little pencil icon showing up in the menu choices.)


#21

Ah, probably time limited then. I've taken care of it, no problem!

edit yup, there was a time limit of 60 days. Since we have public edit diffs anyhow, I've now disabled that time limit. If this causes issues down the road we can always re-enable it.