OctoPrint Setup - How to Install OctoPi on a Raspberry Pi - PrinterMods UK Ltd

OctoPrint gives you more control over your 3D prints. Learn how to set up OctoPi on a Raspberry Pi with this step-by-step setup guide!

Before we get into how to set it up, what exactly is OctoPrint? To answer that question, here’s a list of things OctoPrint allows you to do:

  • Wirelessly upload G-code files from a computer to a 3D printer
  • Manually control a 3D printer (moving the X-, Y-, and Z-axes as well as forcing extrusion)
  • Monitor print temperature and change print settings
  • Set up a webcam to view in a browser
  • Slice models using CuraEngine
  • Customize operation with numerous plug-ins (and you can even write them yourself!)

For many 3D printers, files to be printed are uploaded either via an SD slot or a USB port. This means you have to, for example, stick an SD card into your computer, load the G-code onto it, and insert it into the 3D printer every time you want to print something. And a printer without an SD slot requires a computer to be tethered throughout printing.

With OctoPrint, there’s no such inconvenience. It works with almost every 3D printer to make controlling the process wireless and easy. Though certainly not a must, thousands of hobbyists love using OctoPrint to make their lives easier.

The various plug-ins made available through the Plugin Manager interface provide further functionalities, including custom timelapse creation, external monitoring/control via smartphone, and even Telegram integration for remote monitoring.

What do you need?

Raspberry Pi 4 - OctoPrint Setup

To get started with OctoPrint, here’s what you’ll need:

  • Raspberry Pi: OctoPrint strongly recommends the Raspberry Pi models 3B, 3B+, or 4B. Raspberry Pi versions 1 and 2 are compatible with OctoPrint but not officially supported, and the Pi Zero is “not recommended explicitly“. Be aware that unsupported boards are prone to performance issues and negatively affect the 3D printing process, so use them at your own risk. This tutorial will cover the installation on the recommended boards only.
  • Power adapter for the Pi: This item is usually overlooked, but it’s actually very important to ensure enough electrical power is provided to the board. According to the OctoPrint website, all models require a 5.1-V supply, but the power supply connection varies according to the model (Micro-USB for 3B/3B+ and USB Type-C for 4B). Electrical current also depends on the board model (2.5 A for 3B/3B+ and 3.0 A for 4B), and under-voltage during printing could cause performance issues, too.
  • Micro or full-size SD card: You’ll need whatever fits in your Pi (likely a microSD) along with an SD adapter if your computer only takes full-size SD cards. Unless you’re planning to queue a large number of prints through OctoPrint, an 8-GB card should enough. For users planning on making time-lapses on a regular basis, a 16-GB or 32-GB card might be better suited.
  • USB cable: This is to connect the Raspberry Pi to the 3D printer. Keep in mind which connection your 3D printer has – USB Type-A, Type-B, Mini, or Micro. The Pi end is USB Type-A.

Naturally, you’ll also need a 3D printer that works with OctoPrint 👍

Flashing the OctoPi Image

Raspberry Pi Imager Screenshot

The simplest way to run OctoPrint is by booting your Raspberry Pi with the OctoPi image. To get there, you’ll need a tool to flash your SD card. And for that, we recommend using the Raspberry Pi Imager, available for Windows, MacOS, and Linux.

Here’s how to do it:

  1. Download and install the Raspberry Pi Imager
  2. Insert your SD card into your computer or connect it using an adapter. There’s no need to format the SD card prior.
  3. Open the Raspberry Pi Imager and click on “Choose OS” under “Operating Systems”.
  4. Then go to “Other specific purpose OS > OctoPi”. There should be the latest version.
  5. Back on the main window, click on “Choose Storage” and select the SD card.
  6. Open advanced options by using the keyboard shortcut "Ctrl" + "Shift" + "X" to configure your Wifi connection.
    Raspberry Pi Imager Wifi Setup
  7. Click “Write” and the Raspberry Pi Imager will download and install the OctoPrint image.

Once installed, the software will run a quick verification, and you should be all set to go.

OctoPi GitHub Download Page

Alternatively, you can use Etcher, which is a free tool for Windows and MacOS. Here are the steps:

  1. Download the latest version of OctoPi from the GitHub repository (currently 0.18 or newer).
  2. Unzip the downloaded image. You should have an image file ending in “.img”.
  3. Insert your SD card into your computer. Once again, there’s no need to format the card prior.
  4. Open up Etcher, select your SD card, select the OctoPi image, and click “Flash”.

Once it’s done, you’re good to go!

Setting Up Wi-Fi Manually

OctoPi Manual Wifi Setup Screenshot

Now that the OctoPi image is installed on your SD card, you’ll need to input your Wi-Fi network’s name and password so that your Pi can actually connect to the internet.

  1. If the Raspberry Pi Imager or Etcher ejected your SD card when it finished flashing, be sure to re-insert it into your computer.
  2. Open your SD card’s directory (usually named “boot”). It should be located wherever external drives usually show up.
  3. There’s a whole mish-mash of files in here, but don’t be intimidated. We’re looking for “octopi-wpa-supplicant.txt”.
  4. For Windows users, open the file in Notepad. For MacOS users, open the file in TextEdit. (Under “Preferences”, select “Plain Text Format” and uncheck “Smart Quotes”.) Alternatively, you can open the file in text editors such as Atom or VSCode.

Here’s how to edit your Wi-Fi details and country code:

  1. Most Wi-Fi networks are WPA/WPA2 secured. In the first network block, remove the first ‘#’ from the four lines, as shown in the image above.
  2. Type in the Wi-Fi network’s name in the “ssid” line and the password in the “psk” line, keeping the quotation marks where they are.

If you want to let OctoPrint connect to multiple networks (e.g. home Wi-Fi and phone hotspot), simply copy and paste the network block (four lines) and fill in the details for the additional networks.

  1. Near the bottom, enter your country code. If you’re in the UK, this is already done for you. If not, you’ll have to enter a ‘#’ in front of the UK and remove the ‘#’ in front of the country where you are.
  2. Make sure the blocks match the image above, especially with the ‘#’ locations matching up.
  3. Save the file and eject the SD card from your computer.
If you encounter any issues, be sure to check the official OctoPrint Wi-Fi Setup FAQ, which also includes troubleshooting tips.

Securing Communication

Connecting to OctoPi via SSH
Every Raspberry Pi board comes with a default username and password for SSH access. As such, it’s highly recommended that you change the password so as to avoid others connecting to your OctoPrint and controlling your 3D printer.

First, let’s boot up the Pi and connect to it via SSH.

  1. Insert your SD card into the Pi’s slot. If a Wi-Fi adapter is required, make sure it’s connected to a USB port on the Pi.
  2. Power up the Pi by plugging in the power cable.
  3. Open CMD (Windows) or Terminal (macOS) and run ssh pi@octopi.local (or replace “octopi.local” with the IP address assigned by your router to the Raspberry Pi).
  4. If it returns “Are you sure you want to continue connecting (yes/no)?” type yes and hit Enter.
  5. Type in the default password for the Pi: raspberry. Hit Enter.

Now you should be logged into the Pi. To change the default password, do the following:

  1. Run sudo raspi-config. It should ask for the default password once more.
  2. The first option should be “Change User Password”. Hit Enter.
  3. Enter the new password twice.

That’s it! Now your instance of OctoPrint is protected. Use this new password every time you wish to access the Pi through SSH.

Connecting the Pi to your printer

Connecting a Raspberry Pi To your 3D Printer
It’s time to put all the pieces together. In this step, we’ll connect the Raspberry Pi to your 3D printer:

  1. Remove the Pi from power by disconnecting the power cable.
  2. Use a USB cable to connect the Pi to your 3D printer.
  3. Power up the Pi and your 3D printer.

Setting up the interface

OctoPrint Interface

After the Pi boots up, you should be able to access OctoPrint through your local network.

  1. Type in “http://octopi.local” (or the IP address assigned by your router to the Pi) on any browser. Make sure your computer is connected to the same network as the Pi.
  2. You should see the OctoPrint interface and a setup wizard pop up. Follow along, and be sure to set up a username and password for OctoPrint. Note that this is not the same as the username and password you set up for your Raspberry Pi.
  3. Connect to your printer by opening up the Connection panel on the left. With the options set to “AUTO”, hit “Connect”. If this doesn’t work, try manually setting the serial port and baud rate until it does.

Congratulations! You’ve successfully set up OctoPrint. In order to make your very first print through OctoPrint, click on the “Upload” button in the lower-left and select an already sliced G-code file. Once imported, all files will be present on a list in the “Files” panel. To start printing, click on the small printer icon.

Not that hard, right? Now you’re free to explore all of OctoPrint’s functionalities and plug-ins!