Knowledge for the World

OctoPrint: Control your 3D printer remotely with Raspberry Pi and OctoPi

Untether your printer!
  • by Zach (125)
  • 30 minutes

Have you ever wanted to control and view your 3D printer from your web browser and print things remotely? Thanks to the amazing OctoPrint software library and a Raspberry Pi, you can!

What is OctoPrint?

OctoPrint is free, open-source software that allows you to remotely perform and monitor all aspects of your 3D printer using a Raspberry Pi computer. You can remotely load new prints, monitor your extruder temperature, turn your printer off and on, check the status of your prints, watch your prints with a live video feed, and more.

Setting up OctoPrint is quick and easy. Let's get started!

OctoPrint video

I created a video version of this guide as well if you'd like to check it out!

1

Before you start, make sure that OctoPrint supports both your printer and Raspberry Pi model.

Does my printer work with OctoPrint?

Probably. OctoPrint works with most popular 3D printers. Check out the complete list of supported printers. Chances are your printer is on there.

Which Pi should I use for OctoPrint?

It is recommended you use a Raspberry Pi 3 or 3+ to run OctoPrint. The cheaper Raspberry Pi Zero is not quite up to the task. In particular, the Zero can suffer from massive Wi-Fi interference, negatively impacting your prints.

2

Install OctoPrint

The easiest way to set up OctoPrint on your Raspberry Pi is to use the OctoPi disk image, which is basically a full copy of a working OctoPrint installation. Download the OctoPi SD card image from the OctoPrint downloads page.

After downloading the image, we're going to burn (or "flash") it onto your Pi's Micro SD card.

Connect the SD card to your computer using a Micro SD card reader. Then, download and install Etcher.

Locate the OctoPrint disk image you downloaded, select your SD card, and click Flash! The flashing process should take about 5 minutes.

Note: Alternatively, you can compile OctoPrint from source instead. This is useful if you plan on using the Pi simultaneously for something else (which is generally not recommended).

3

To connect your Raspberry Pi to wifi, we're going to edit a text file on the SD card. Etcher may automatically eject your SD card after flashing. If it did, disconnect and reconnect it to your computer.

Locate your SD card in Finder (MacOS) or Explorer (Windows). Then, open the octopi-wpa-supplicant.txt file in Notepad, Sublime Text, or another text editor. Do not use Microsoft Word, Wordpad, or any other "rich text" formatting program to edit the file.

Uncomment the lines below, and input your wifi network and password:

## WPA/WPA2 secured
network={
    ssid="my-wifi-network-name"
    psk="my-wifi-password"
}

If you're using a Raspberry Pi 3B+ (the newest Pi), you'll also need to uncomment or add your country code in that file:

# Uncomment the country your Pi is in to activate Wifi in RaspberryPi 3 B+ and above
# For full list see: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
#country=GB # United Kingdom
#country=CA # Canada
#country=DE # Germany
#country=FR # France
country=US # United States

Save and exit. Finally, safely eject the SD card, put it into your Pi, and connect your Pi's AC adapter.

4

For security reasons, I recommend you change your Raspberry Pi's default password.

5

Connect to OctoPrint

You can now connect to OctoPrint to view the OctoPrint interface. From your regular computer, make sure you're on the same network as your Pi, and then visit http://octopi.local in your web browser.

You can also access the SSL-encrypted version at https://octopi.local, though you'll need to accept the self-signed certificate.

6

Configure OctoPrint

After loading the OctoPrint interface in your browser, you will see the OctoPrint Setup Wizard:

Access Control

Use this to set a secure username and password for Access Control. Even if your printer will not be accessible from an external network, I recommend you set this up.

Online Connectivity Check

This will ping Google's DNS server periodically to ensure your Pi is online, aborting intensive operations if it is not. Enable it, and leave it at the default 15 minutes interval.

Plugin Blacklist

This setting prevents unsigned or potentially malicious plugins from being installed on your Pi. I recommend enabling this.

Cura Slicing Profile

OctoPrint supports slicing directly on the Pi using the open-source CuraEngine. If you plan on slicing directly from within OctoPrint, you'll want to import a slicing profile for your printer.

To do this, install and open Cura, create a slicing profile, navigate to Preferences > Profiles, and then export your profile as a .ini file. Finally, browse for and select this file in the OctoPrint wizard.

Note: At the moment, only older versions of Cura can export the .ini file necessary to do this. If your Cura outputs a .json or .curaprofile folder, you can't use this feature just yet. If this is the case, continue with the setup process and you can enable slicing later.

7

Configure your printer for OctoPrint

This part of the Setup Wizard is important. Enter the details for your printer.

If you aren't sure of your printer's specifications, open your normal slicing program (like Cura) to view the settings or do a quick Google search.

I'm using the Creality Ender 3 with OctoPrint and my settings are as follows:

Form factor: Rectangular
Origin: Lower Left
Heated Bed: Yes (checked)
Width: 220mm
Depth: 220mm
Height: 250mm
Axes: Default**
Custom Bounding Box: No (unchecked)
Nozzle Diameter: 0.4mm
Number of Extruders: 1

** The Axes setting is only used for manually controlling the printer -- as I slice my models before putting them into OctoPrint, I didn't bother filling this out. However, you can if you choose; remember the Axes speed settings are per minute, whereas the settings in most slicing programs are per second.

Note: If your printer is an Ender 3, I wrote a separate guide that covers using the Ender 3 with OctoPrint in greater detail.

8

Connect your Printer to OctoPrint (your Pi)

Now we can connect our Pi to our printer! Obviously, this will allow OctoPrint to send commands to and control your printer. To do this, you'll need to physically connect a USB cable from the Pi to your printer's USB port.

Your printer's USB port is normally located near the SD card slot. It might be a Micro USB port or, for some insane reason, a Mini USB port (the mushroom-shaped one). I have no idea why so many electronics still use Mini USB... Perhaps some factory made too many Mini USB ports 10 years ago. But I digress.

Using the appropriate cable, connect one of Pi's USB ports to your printer's USB port. Ensure the cable you use supports data (some cheaper cables only support charging). This is the Mini USB cable I used.

Next, under Connection Settings in OctoPrint, enter the appropriate settings from the OctoPrint wiki.

For the Creality Ender 3, the settings I used were:

Serial Port: /dev/ttyUSB0
Baudrate: AUTO

Be sure to check both "Save connection settings" and "Auto-connect on server startup".

9

Connect a camera to OctoPrint

One of the most exciting things about using OctoPrint is live watching prints remotely and recording prints. So, let's hook up a Raspberry Pi camera. Of course, this is optional but highly recommended.

First, shut down and unplug your Pi. Do not attempt to connect the camera while your Pi is powered. Then, connect the camera to your Pi and reboot it.

You should now see the webcam streaming by visiting the OctoPrint Control tab: http://octopi.local/#control

Troubleshooting

If your video feed isn't working, make sure you connected it to the "CAMERA" (not "DISPLAY") port on the Pi. I made this mistake since they're identical. If it still isn't working, check to make sure your ribbon cable connections are good, facing the right direction, and that the tiny connector that plugs into the camera itself is seated properly.

10
Print the necessary parts for your printer

I recommend printing the following parts for your OctoPrint setup:

  • Raspberry Pi camera mount
  • Raspberry Pi case/mount
  • LM2596 step-down converter case (if powering your Pi from the printer)

The exact models to use will vary for your printer, but you can find them by searching for your specific printer on Thingiverse.

11

Mount everything to your printer

My printer uses extruded aluminum rails, so I mounted my Pi using two M4x8mm bolts and M4 t-nuts. The camera model I found clips directly to the Z-axis stepper motor to give me a good side view of the extruder. Finally, I mounted my step-down converter on the back of my Ender 3 using foam tape.

Choose whatever mounting method works for you. Just keep in mind the distances between your cables and the extended Raspberry Pi camera cable -- and don't forget how long the camera cable is when the printer is fully extended in the Z-axis!

12

Power your Pi

While you can always power your Raspberry Pi using a normal Pi AC adapter, you can also power it directly from your 3D printer's power supply! This is handy for powering the Pi on only when the printer is on and creates an overall cleaner setup. Also, you can save money by not buying a separate AC adapter for your Pi.

Because this is totally optional and requires some soldering, I wrote a separate comprehensive guide to teach you how to power a Raspberry Pi from a 3D printer.

Note: With either approach, it's always important to shut down your Pi properly before disconnecting its power supply. You can do this through the OctoPrint interface or by adding a Raspberry Pi push button to shut it down.

13

Focus the camera

Now we need to focus the Pi camera so you'll have a nice clear video feed.

Open the Feed tab in the OctoPrint interface. Center your printer's bed, place an object in the center of it, and move your extruder just above it. This will simulate performing a print.

Your Pi camera came with a small white plastic adjustment wheel. Use this small adjustment wheel to turn the camera's lens a small amount at a time (maybe 1/16 of a turn). Check the feed periodically and stop when things are in focus.

You may need to try turning it in both directions. Be patient and you'll have a nice clear video feed!

14

You should never run your 3D printer when you aren't around to monitor it (read: fires and stuff). This is why the concept of OctoPrint centers largely around connecting to your 3D printer remotely over the same network.

However, if you're in a position where someone can monitor your printer for you and you want to connect to OctoPrint truly remotely -- from anywhere -- it is possible to set this up.

There are a number of ways to accomplish this, but the easiest method is to use the OctoPrint Anywhere plugin. I wrote a separate guide on setting up OctoPrint Anywhere if you'd like to check it out!

15

You're ready to print!

Import your first gcode file using the "Upload" button and send your first print to your new OctoPrint-enabled printer. Pat yourself on the back, you're done!

Questions? Comments? Did I miss something?

I'd love to hear from you. Post in the comments section below :)