screenshot of Raspberry Pi OctoPrint web interface with web cam showing a printing Creality Ender 3 with BLTouch visible.

Installing OctoPrint on Raspberry Pi


Installing OctoPrint on a Raspberry Pi for remotely controlling, monitoring a 3D Printer. Easy steps to guide through setting up OctoPrint.

Hardware Requirements

Affiliate Links Below:

Official Raspberry Pi 3B Starter Kit

Official Raspberry Pi 4 4GB Starter Kit

Firstly there are a few prerequisites before you can install OctoPrint on a Raspberry Pi. Without a doubt you are going to need a Raspberry Pi. However what one ? While you can get OctoPrint to run on some older or less powerful Raspberry Pi’s. In order to give you the best overall performance and versatility, it is best to go with the recommended Raspberry Pi 3B or higher.

Secondly you need a good power supply, suitable for carrying a minimum of 5V 2.5A for the 3B version and a 5.1V 3A power supply for the Pi 4. I personally use the Raspberry Pi’s own 5V 2.5A power supply as it was included in a kit.


32GB Sandisk Micro SD Card 98MB/S

Thirdly you need a good micro SD card, go for a trusted brand such as Lexar, or Sandisk. Personally I use Sandisk as I have used their cards commercially for years and they have never let me down. Furthermore you will need a Class 10, with a read speed of up to 98MB/s will serve you well.


USB A to B Cable with Ferrite’s.

Lastly you need a method of connecting your Raspberry Pi to your 3D printer. While there are various ways of achieving this. But for ease of installing OctoPrint for the first time, let’s keep to a simple USB cable. What cable depends on what model of Raspberry Pi you are using. For instance the 3B has a USB-A connector, but the 3D printer will probably need a USB-B, so a USB-B to USB-A cable is required. Furthermore try and find a USB cable that has one or two ferrite’s, they help remove high frequency noise, that can affect printing.

With the hardware side of covered let move onto the software side for installing OctoPrint on a Raspberry Pi.

Software Requirements

While you can begin by installing OctoPrint on top of a Raspberry Pi operating system. However it is far easier in setting up OctoPrint by using a nearly pre-configured OctoPi image. Ultimately if you are simply using the Raspberry Pi for just OctoPrint then this gets rid of the non-essential graphics and process hungry elements. Such as the desktop, OctoPrint doesn’t need the desktop to run. Instead it uses Python with a web interface.

But what if you want to use the Raspberry Pi for more than just OctoPrint ?

Unless you want to use the Raspberry Pi for other tasks at the same time as running OctoPrint than you could just use a different SD card and swap them over when you want. There many great reasons why you may wish todo so. There’s Kodi a multimedia solution for streaming and running home entertainment systems. RetroPi for the old school classic games.

However if you do wish to have a desktop and OctoPrint you can still do this. However it is best to wait until everything is installed and working. I will post the commands at the end if this guide.

What Software to Download for OctoPrint

Firstly you are going to need the latest OctoPi to download.

https://octopi.octoprint.org/latest

Secondly you need a program that can turn the OctoPi into a bootable operating system on the SD card. Etcher is by far the most popular and is available free for PC, Mac and Linux.

https://www.balena.io/etcher/

Making a bootable OctoPi SD

With the software listed above downloaded let’s begin. Insert your new micro SD card into its adapter and insert the card into your computers SD slot. After Installing Etcher open up the Etcher application.

Select Image

Simply drag the downloaded OctoPi .img file to the select image option within balenaEtcher. Alternatively you can click on the Select image icon and go through your folders to find the downloaded OctoPi file. Personally I find drag and drop is a lot quicker.

Select Target

Next ensure the selected target is the correct memory card that you wish to install OctoPrint onto. This can be done by clicking on the Select target button. In the newly loaded window, click on any USB or SD cards that you don’t want to install OctoPrint. This will remove the green tic, then simply click on the SD card that you want to install OctoPrint on. Now click on continue to return to the previous screen.

Flash

While the next step is to click on the Flash! button. It will more than likely prompt you for your administration password, it needs this to change the state of the SD card. Enter your password and click OK.

balenaEtcher will begin flashing the OctoPi img file to the SD card. Moreover it doesn’t normally take too long, just a few minutes.

Once completed, you can either flash another SD as a backup, or just close the balenaEtcher program. However you will notice that you SD card file size is a lot smaller than before. While it may be initially daunting to see, further on in this guide we will show you how to expand the Raspberry Pi SD card back to its full size.

With the bootable OctoPi SD card created let’s move onto the next step of Installing OctoPrint on a Raspberry Pie, which is editing the settings.

Installing OctoPi onto a Raspberry Pi

So far we have made a bootable OctoPi SD card ready for the Raspberry Pi to boot with. However before we insert the card into the Pi and start loading the OctoPrint, we need edit our WiFi settings.

OctoPi editing the WiFi settings

balenaEtcher would have ejected the SD card when it had finished creating the bootable OctoPi, so remove you SD card and re-insert it back into your computer.

Your newly created SD card will now show as boot, either on your desktop or My Computer. On a Mac if it is not showing on your desktop then click on Finder, go to the options at the top of the screen called Go, and click on Computer.

Double click on the boot SD card, and look for a file called octopi-wpa-supplicant.txt, it is normally towards the bottom. Furthermore we need to edit the octopi-wpa-supplicant file with a plain text editor. NotePad is perfect for PC users.

Mac Users Text Edit *Important

However Mac users can use TextEdit, but before you do, you need to change the preferences to plain text. To change this, once TextEdit is loaded, click on TextEdit on the top left of the screen. From the drop down list, click on preferences. Now change the preferences from Rich Text, to Plain Text. The setting will automatically be saved, so you can just close the window.

OctoPi editing the WiFi settings continued

Once octopi-wpa-supplicant.txt is loaded into your particular editor, scroll down and look for the WPA/WPA2 secured section.

Now delete the # markers from the WPA/WPA2 section so that the code looks like below.

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

Now change the SSID to that of your WiFi network. Furthermore it is sometimes referred to on the packaging as a network name. Additionally set the password to for your WiFi network and save the file.

Setting the Country

By default UK is set as standard for OctoPi. However if you need to change the country, scroll further down the same .octopi-wpa-supplicant.txt file until you find the country section. Simply place a # in front of UK and remove the # from you region of choice. Importantly don’t forget to save the file.

Setting OctoPrint webcam to 1080p

While the OctoPi does a great job at pre-defining the cameras, sadly they are not always set to the full capabilities. However a quick change and the webcam can be seen in all its glory.

USB Webcam

Within the boot SD card, look for and open the octopi.txt file into your plain text editor and look for the following line.

#camera=”auto”

remove the # and replace auto with usb, see example below.

camera=”usb”

next find the line below for the camera options

#camera_usb_options=”-r 640×480 -f 10″

remove the # and change 1920×1080 the -f10 is the frame rate. In order to view a smooth footage directly you could increase this to 30 frames. However it will use more bandwidth on your WiFi network. Experiment and see what works for you.

Below is an example code for the Logitech C920 running full HD with 30 frames per second.

camera_usb_options=”-r 1920×1080 -f 30″

Pi Cam ribbon cable cameras

Within the boot SD look for and open the octopi.txt file into your plain text editor look and for the following line.

#camera=”auto”

remove the # and replace auto with raspi, see example below.

camera=”raspi”

If you are running a Pi camera that is capable of 1080p than find the following line.

#camera_raspi_options=”-fps 10″

While similar to the USB camera option there are a few changes. See below.

camera_raspi_options=”-x 1920 -y 1080 -fps 30″

Don’t forget to save the octopi.txt file.

That’s all the editing we need to do for now, next comes turning on the Raspberry Pi and letting OctoPi finish installing itself. So let’s jump to the next stage of installing OctoPrint on Raspberry Pi.

Starting OctoPi on Raspberry Pi

Insert the freshly made and configured OctoPi SD into the Raspberry Pi. While you don’t technically need to plug the Raspberry Pi into a monitor via the HDMI connector. Nonetheless it helps to check any issues that may arise.

For instance when I first turned on the Pi, either OctoPi or the Raspberry Pi was not running correctly and as such I was unable to connect to the Pi. A simple turn on and off resolved the issue. However without having a screen attached I would have spent ages presuming it was a network communication error.

While you don’t need a keyboard or mouse to run OctoPi, you will need a computer or phone that can send communications to the Raspberry Pi over the WiFi network. However if you are running as a completely standalone OctoPrint than plug in your usb keyboard and mouse now.

Moreover regardless if accessing remotely or directly the following methods are the same.

Webcam

Furthermore If you have a webcam that you wish to use. Plug it in via the USB cable or if your camera is a ribbon cable type, then plug it into the Camera socket.

If you found this guide useful, please consider a donation to help keep the Make ‘N’ Print website running. For further information please have a look at our support us page

Thank You

Connecting to OctoPrint via SSH

At this stage in the installing OctoPrint on Raspberry Pi guide, presumably your Raspberry Pi has finished booting and OctoPi is connecting to your WiFi network. Now we can begin accessing the Raspberry Pi Remotely. Furthermore a very quick an easy way to remotely configure and access the Pi, is remotely via SSH (Sure Shell) encrypted network protocol. So let’s begin.

On a Mac launch the Terminal Application.

While on a PC launch the Command Prompt Application.

Once loaded your Terminal or Command Prompt applications are loaded, type in the following command:

ssh pi@octopi.local

At this point it may come up with a message similar to below.

The authenticity of host ‘octopi.local … )’ can’t be established.
ECDSA key fingerprint is …
Are you sure you want to continue connecting (yes/no)?

It is nothing to worry about simply hit YES and the enter key.

You will then be asked for pi@octopi.local’s password. By default the password is raspberry all in lowercase. Next type it in the default password and hit enter.

All being well you will now see the terminal connected to the Raspberry Pi, and that OctoPi is running. Furthermore the command prompt will show you have logged in as pi.

The login name pi is default for most Raspberry Pi’s operating systems. See below for an example of the command prompt.

pi@octopi:~ $

Additionally, above the command prompt OctoPi will show you the various web address methods of connecting to OctoPrint.

While using http://octopi.local is favoured by many. Try and fight the urge the start viewing OctoPrint at this point. Moreover it is recommended to wait until the installation process is finished. Otherwise you will be configuring OctoPrint before finishing the correct installation. Which may cause problems down the line.

Raspberry Pi changing the default password

Increasing security is an important part of installing OctoPrint on a Raspberry Pi. Changing the default password makes remote access more difficult for those without the new password. A mixture of numbers, upper and lowercase letters, and special characters are recommended. See below for an example of a strong password.

!_XzgD13Ql/dLf@

In order todo this use your Command Prompt or Terminal applications and type in the line below and hit enter.

sudo raspi-config

It will give a spill about getting a lecture from the system administrator, and as that is you, consider that done. Furthermore it will ask you for the default password again, so type in default password of raspberry all lowercase followed by the enter key.

A new menu system will be displayed, and the first option is Change User Password. Press the enter key. It will then ask you to type in a new password and again to confirm. You will notice that nothing is shown or moves when typing in your password. Don’t worry it is normal.

Before we leave the rasps-config menu, let’s look at enabling the Pi Cameras, which are the cameras with ribbon cables, and expanding our SD card back to its full size.

Enabling Pi Camera (Ribbon Cable Cameras)

From the first menu in raspi-config, scroll down to Interfacing Options and press the Enter key.

The first option is Camera, and it enable or disables the Raspberry Pi Camera. Hit the Enter Key.

An option window will open, asking if you would like to enable the camera interface. Ensure yes is selected in red, and then hit the Enter key.

It will then display a message saying enabled, hit the Enter key again to return to the main menu.

Raspberry Pi Expanding the SD Card

Expanding the SD card is another important step in installing OctoPrint on a Raspberry Pi. Furthermore it allows the SD card to return to its full size, allowing more room for code, files, and any time lapse movies that are created with a 3D printer. Within the main menu scroll down to the Advanced Options and hit enter.

Once inside the Advanced Options menu, the very first menu option is Expand Filesystem. Hit the Enter Key. Literally within seconds, your SD card on the Raspberry Pi is back to its full size.

Hit the enter key to return, and the esc key to exit the raspi-config menu system.

Believe it or not that’s OctoPrint running on the Raspberry Pi. Without a doubt using the OctoPi pre-installed image makes light work of the installation process. Now we can access OctoPrint from any device with a web browser. As long as the device is connected on the same WiFi network as the Raspberry Pi.

Type in the address below into the web browser.

http://octopi.local

OctoPrint First Steps

For the most part, the setup of OctoPrint just requires your 3D printers firmware settings to hand. Nonetheless for reassurance we will guide you through. Click the Next button to begin.

Access Control

Access control adds extra protection by limiting access to OctoPrint via a username and password. It’s quick and easy todo and worth the protection.

Type in a user name that you wish to use, followed by a new password. For security purposes ensure it is different from the password you changed in the raspi-config menu.

Next type in the password again, but this time in the Confirm Password box and then click on the Keep Access Control Enabled Button. Now click on the Next Button.

Anonymous Usage Tracking

A personal choice on this option, if enabled it helps OctoPrint solve issues and bugs more effectively by checking it against what is working and how. Either click on the Disable or the Enable Anonymous Usage Tracking buttons and then click Next.

Configure the connectivity check

The connectivity check, allows OctoPrint to check for updates, you can leave it as default which is 15 Minutes. However I set mine to 60 minutes so there is even less network drag.

Furthermore OctoPrint is pre-configured to reach Google to ensure there is a valid internet connection. While you can change this, for many it is perfectly fine how it is already setup. Just click on the Test host & port button to check for a valid internet connection.

Next click on the Enable Connectivity Check button and then click Next.

Configure plugin blacklist processing

An extra level of reassurance. Moreover the blacklist processing option allows OctoPrint to stop certain plugin versions from being installed. In essence this is because they don’t work with the latest OctoPrint and would otherwise cause problems and issues.

Click Enable Plugin Blacklist Processing, followed by the Next button.

Set up your printer profile

This is the part where we tell OctoPrint about the printer we will be using. It is worth having you printers firmware ready and open to copy and paste some of the settings.

Default Printer Profile

There are four options within this category. Ensure you do not accidentally click next before filling in all four sections.

General

A nice simple option where a name and model number is applied. In the picture above I have named the printer Ender 3 Pro, with the model name of Creality Ender 3 Pro. However you can name them what ever you like, its for your reference.

Print bed and build volume

Firstly set the bed shape to match your 3D printer, with either the circular or rectangular options.

The next option called Origin, tells OctoPrint where the normal home position of the printer is. Is it in the centre or lower left, click which ever is applicable for your machine.

A point of note, for many using a BLTouch or probe, your 3D printer may appear to home in the centre, However it doesn’t by default. In other words if your Y and X axis move backwards and to the left when homing then you need the lower left option.

If you do not have a heated bed then untick the Heated Bed Option.

Additionally if you have a heated Chamber, you can enable the option called by clicking on the tick box.

OctoPrint Bed Dimensions and Min Max Positions

Next set your printers build volume just as you have in your printers firmware. In the Example above I have used the Creality Ender 3 Pro’s print volume by defining the actual build plate size.

For Example X and Y are 235mm while Z is 250mm. If unsure and you are using Marlin search for the #define X_BED_SIZE section within Configuration.h to show you the values you need.

The bounding box option is to tell Marlin where the Min and Max Axis Positions are for the 3D printer. It is used when files are sliced within OctoPrint, and doesn’t affect other Gcode files.

Much like the build volume the Min and Max position information is already in your 3D printers firmware. In Marlin it is just under the bed size section. For example on my Creality Ender 3 Pro the Min X is #define X_MIN_POS 1.5 and so on. However the Max Positions tend to be the bed size plus any amendments you may have made.

For Example #define X_MAX_POS X_BED_SIZE+2 would mean my Max X Pos is 235 +2 giving a total of 237.

OctoPrint Axes

Here we are setting the maximum speed at which the axis can move. Additionally any inverted axis directions need to be set here. This enables OctoPrint to control your printer correctly via the Control Tab and options.

Within Marlin firmware this can be found under the DEFAULT_MAX_FEEDRATE section, the example below is my current setup on a Creality Ender 3 Pro.

#define DEFAULT_MAX_FEEDRATE { 500, 500, 15, 40 }

So working from left to right we have the X, Y, Z, and Extruder feed rates in mm/s. However OctoPrint wants mm/min, so multiply the value by 60. Now Enter the values for your printer in the relevant sections.

By multiplying by 60, returns the mm/min values. In the example below, the list is the maximum speed rate for OctoPrint in mm/min taken from the above DEFAULT_MAX_FEEDRATE.

X = 30000
Y = 30000
Z = 900
E = 2400

Inverting Axis

Next double check if any of your axis run inverted. For Example on my Creality Ender 3 Pro with a BIGTREE-Tech SKR E3 DIP V1.1 board. Only the Z axis is inverted. See example below.

#define INVERT_X_DIR false
#define INVERT_Y_DIR false
#define INVERT_Z_DIR true

To verify your settings, check your 3D printers firmware. For example within Marlin search for the #define INVERT_X_DIR section. Ensure to enable any inverting axis by clicking on the Invert control option box adjacent to each individual axis.

Setup Hotend and Extruder

A nice easy setting to finish off configuring OctoPrint. Simply set how many extruders are on the 3D Printer and what size nozzle is attached. For many the default of 1 extruder with a nozzle diameter of 0.4mm is correct. However if your machine differs then change appropriately.

Then Click Next, then click Finish.

Well done, that’s the Installing OctoPrint on Raspberry Pi step by step guide complete. If you haven’t already plugin your 3D printer, use the control panel to move the axis’s around to ensure all is working correctly. Furthermore for those with webcams, you will find the webcam within the Control section.

Additional Options

Below is a list of a few additional options that may appeal to some users that are not directly covered in the installing OctoPrint on a Raspberry Pi guide.

Adding a desktop to OctoPi

For those wishing to have a desktop on the Raspberry Pi, login to the Raspberry Pi from your computers terminal app. Now type in the line below and hit enter.

sudo /home/pi/scripts/install-desktop

A more secure web link to OctoPrint

While many use the http://octopi.local method, there is a more secure method in reaching your OctoPrint. Fundamentally it uses the same method but encrypts the data between your web browser and OctoPrint. To use this method is simple just replace http with https, see the example below for an encrypted link to OctoPrint.

https://octopi.local

Useful Links

As time goes on I am sure this list will grow, but for now I have listed a few which maybe key in people getting the webcam running correctly.

https://github.com/foosel/OctoPrint/wiki/Webcams-known-to-work
https://community.octoprint.org/t/available-mjpg-streamer-configuration-options/1106
https://github.com/PrusaMK2Users/MK2_Tips_and_Tricks/wiki/OctoPrint-Webcam-Setup

If you found this guide useful, please consider a donation to help keep the Make ‘N’ Print website running. For further information please have a look at our support us page

Thank You


© 2019-2020 Copyright - All Rights Reserved.