How to Install OctoPi on a Raspberry Pi

Photo of author

Written by Marcello De Lio

Last Updated

6 min read
Close up of a raspberry pi connected to an Anycubic Cobra 2. The image demonstrates how to install OctoPi on a Raspberry Pi

After slicing your file, most 3D printers require you to upload the file to a USB stick or SD card and insert it into the printer. This often means running back and forth between your computer and 3D printer while you adjust the G code or add new models to print.

OctoPi makes it easy to control and monitor your 3D printer wirelessly and easily. OctoPrint lets you control your printer remotely, monitor your prints in real-time, manage your G-code files, and more. There are dozens of plugins for Octoprint that allow you to create time-lapses, monitor prints from your phone, and use Telegram integration.

This tutorial guides you through the step-by-step process of how to install OctoPi on a Raspberry Pi. Whether you’re a beginner or an experienced user, our easy-to-follow instructions will keep you up and running quickly.

What You Need

Close up of a Raspberry Pi in a clear plastic case without a lid on a white background
(Photo by Marcello/3D Print Mentor)

Here are the necessary tools and equipment to get started with OctoPrint:

  1. Raspberry Pi: A Raspberry Pi board is a small, single-board computer we’ll use to run the OctoPi software. We recommend using a Raspberry Pi 3B, 3B+, 4B, or 5B for optimal performance. Note: Octoprint is not compatible with the Pi Z or Zero W.
  2. Power Supply: Your Raspberry Pi needs a reliable power source. Use a high-quality 5.1V power supply. The electrical current depends on the board model. The 3B and 3B+ use 2.5A, while the 4B uses 3.0A.
  3. Full-Sized or Micro SD Card: Depending on your Raspberry Pi model, you’ll need either a full-sized or micro SD card to store files on the Pi. Most people only need an 8GB card. But if you want to upgrade to a 16GB or 32GB card if you’re taking time-lapse videos.
  4. USB Cable: This cable connects your Pi to your 3D printer. It’s important to remember that the connection depends on your printer’s connectivity. Most 3D printers use a USB Type A or Type B connection, but some use a mini or micro USB connection.

With these tools in hand, you’re ready to install OctoPi.

Flashing OctoPrint on Raspberry Pi

Screenshot of the Raspberry Pi Imager flashing OctoPi on a microSD Card (1)
(Photo by Marcello/3D Print Mentor)

Now that you’ve gathered all the necessary tools, it’s time to flash the OctoPi image onto your micro SD card. We’ll use the Raspberry Pi Imager, a user-friendly tool that simplifies installation.

Follow these step-by-step instructions to get OctoPi up and running on your Raspberry Pi.

  1. Visit the official Raspberry Pi website and download the Raspberry Pi Imager for your operating system (Windows, macOS, or Linux).
  2. Insert your SD card into your computer using a USB adapter. There’s no need to format the card as the flashing process automatically overwrites all the existing data. (Note: Most 3D printers include an SD card-to-USB adapter for this process.)
  3. Open the Raspberry Pi Imager and follow the setup wizard. You’ll see a simple interface with two main options: “Choose OS” and “Choose Storage.”
  4. Select your Raspberry Pi device and click the “Choose OS” button.
  5. Scroll down the list of operating systems until you find “Other specific-purpose OS.”
  6. Click on “Other specific-purpose OS” to expand the options.
  7. Select “3D printing” from the submenu.
  8. Choose “OctoPi” from the list of available 3D printing operating systems. The Raspberry Pi Imager will automatically download the latest stable release of OctoPi.
  9. After selecting OctoPi, you must fill in the details to connect your Raspberry Pi to WiFi. This step is essential as it’s what will allow you to monitor and control your 3D printer remotely:
    • Set username and password: I recommend setting “pi” as the username and password. This is only for SHH connections and not for logging into OctoPrint.
    • Configure wireless LAN: Enter your WiFi name and password to allow OctoPi to connect to your WiFi network.
    • Country Code: Select your country code from the dropdown menu.
    • Verify you’ve entered the correct information and click “Save” to return to the installation menu.
  10. Click on the “Choose Storage” button.
  11. Select your micro SD card from the list of available storage devices.
  12. Double-check that you’ve selected the correct device to avoid accidentally overwriting other storage media. Once you click “Next,” the Imager will overwrite all of the files on the SD card. It’s crucial to ensure you’ve selected the correct card to prevent accidentally deleting important files or documents.
  13. Click on the “Write” button to begin the flashing process.

After the flashing process begins, a progress bar will indicate the operation’s status. Flashing may take a few minutes, depending on the speed of your micro SD card and computer.

Once the flashing is complete, the Raspberry Pi Imager will automatically verify the written data to ensure integrity. When the flashing and verification process is finished, the Imager will notify you that removing the device is safe. If you don’t see this message, go into your system settings to extract your USB device safely.

Screenshot of the front page of Balena Etcher with the download link
(Photo by Marcello/3D Print Mentor)

Alternatively, you can use Balena. Balena is a free flashing software for Windows and MacOS.

I find that Raspberry Pi Installer is more user-friendly, and it pre-configures the WiFi settings.

However, I know several people who prefer using Balena. It’s not difficult to set up. However, there are some additional steps to configure the WiFi connection.

Here’s a step-by-step guide to Flash OctoPi using Balena:

  1. Download the latest OctoPi version from Octoprint.
  2. Unzip the downloaded file. You should have a file that ends with the “.img” extension.
  3. Download and install the Balena Flashing software.
  4. Insert the SD card into your computer.
  5. Open Balena on your computer and select the OctoPi Image and your SD card.
  6. Click “Flash” to install OctoPi on your SD Card.
A screenshot showing the octopi wpa supplicant txt file with a red box highlighting the sections that need to be updated when installing OctoPi on a Raspberry Pi
(Photo by Marcello/3D Print Mentor)

After flashing OctoPi with Balena, you must follow the steps below to configure the WiFi connection. You can skip the following steps if you used the Raspberry Pi imager, as the Imager set up your connection using the information you provided.

  1. If the flashing software ejects your SD card, unplug the USB connection and plug it back in to reconnect it.
  2. Open your SD card’s files directory. It should be named “boot.”
  3. Open the file “octopi-wpa-supplicant.txt” in a text editor. MacOS users can use TextEdit, and Windows users can use Notepad. However, I’ve sometimes run into issues with how Notepad formats the file. I recommend downloading Notepad++ if you’re on Windows.
  4. The text in the file seems daunting at first, but don’t worry—it’s not difficult to understand. There are several sections with options to set up your wireless connection depending on your WiFi security. Most WiFi networks are secured by WPA/WPA2. Navigate to the WPA/WPA2 network block and remove the “#” from the four lines, like in the image above.
  5. Enter your WiFi network name in the quotes beside “said.” Your network name is what appears when you search for WiFi on your phone or laptop. Enter your WiFi network password beside “psk.” You can add multiple networks to OctoPrint by copying and pasting the four lines of the “network” block and adding the details for each network.
  6. Near the bottom of the file is a list of country codes. If you’re in the UK, there’s nothing you need to do. If you’re in any other country, add a “#” at the front of the line for the United Kingdom and remove the “#” beside your home country.
  7. Double-check the information in the file, then save the file and eject your SD card.

Optional Security Settings

Screenshot of the Putty terminal while using SSH to connect to a Raspberry Pi with OctoPi and change the SSH password
(Photo by Marcello/3D Print Mentor)

Before connecting your Raspberry Pi to your network, it’s a good idea to take some extra security measures. Every Raspberry Pi uses the same default username and password for remote SSH access.

Leaving your Pi with the default settings leaves it vulnerable.

Follow these steps to enhance the security of your Raspberry Pi:

  1. Insert the SD card into your Raspberry Pi and power it on by plugging in the power cord.
  2. Open CMD in Windows or Terminal in macOS to run the command line interpreter, which allows us to communicate with the Raspberry Pi.
  3. Run ssh pi@octopi.local. If you know the IP address assigned to your Raspberry Pi, you can replace “octopi.local” with the IP address.
    • The command line may ask, “Are you sure you want to continue connecting (yes/no)?” Type yes and hit the enter key to continue.
  4. When it asks for the password, type the default password raspberry and hit enter.
  5. To change your password, run the command sudo raspi-config.
  6. The program will ask you to re-enter the default password. Enter raspberry and hit enter.
  7. Next, it will allow you to “Change User Password.” Enter your new password twice to update your password.

That’s it. You’ve now changed the SSH password of your OctoPrint instance. Keep note of the password for the future if you need to SSH into your Raspberry Pi.

Connecting Your Raspberry Pi To Your 3D Printer

Close up of a raspberry Pi connected to a 3D printer with a USB Cable on a white table
(Photo by Marcello/3D Print Mentor)

Connecting your Raspberry Pi to your 3D printer is as easy as connecting the USB cable from your Pi to your printer’s input port and powering it on your devices. When both devices are on, your Raspberry Pi will automatically connect to your WiFi network and 3D printer.

Note: If you changed your Raspberry Pi’s SSH password, you must disconnect power from the board and plug it back in.

Connecting to OctoPrint on Your Computer

Screenshot of Octoprint while a 3D print is in progress
(Photo by Marcello/3D Print Mentor)

After your Pi and 3D printer boot up, you can access OctoPrint by visiting “http://octopi.local” or the IP address assigned by your router.

You can only access OctoPrint if your computer and Pi are on the same WiFi network.

The first time you visit OctoPrint, you will be run through the setup wizard. Follow the instructions to set up your OctoPrint. It will ask you for a username and password, but these are different from the SSH password you set up earlier.

The left panel of OctoPrint allows you to connect to your 3D printer by hitting the “Connect” button.

Once you connect your 3D printer, you can remotely manage and monitor your 3D machine.

Photo of author
Written by

Marcello co-founded 3D Print Mentor to share his love of 3D printing. Marcello used to own an online 3D printing company, where he sold unique designs and customized novelty gifts. After closing the business, Marcello’s new passion is 3D printing replica movie props and cosplay items.

Related Articles

3D printed engine block model. Technology, industry

14 Crazy 3D Printing Facts

Close up of a hand holding an SD card with an out of focus Ender 3 V3 SE 3d printer in the background

How to Convert STL Files to G-code

Bambu Lap P1P Upgrades with a green PLA printed side panels and a purge bucket

Bambu Lab P1P Upgrades and Modifications