Unchaining your 3D printer with OctoPrint

By Russell Barnes. Posted

We show you how to turn your 3D printer into a WiFi-enabled network printer that you can control through any web browser, using a pre-made Pi SD card image

This tutorial can be found in The MagPi 36

Say goodbye to the cable salad of tethering your desktop PC or laptop to your 3D printer. With OctoPrint, there exists a 3D printer remote control that you can easily run on a Raspberry Pi and use from any web browser, giving you full control and monitoring capabilities. And thanks to the OctoPi distribution, getting this set up and ready to go is as easy as flashing an image to an SD card and booting your Pi from it.

We might try to convince ourselves to the contrary, but let’s face it- 3D printers do smell a bit strange and can produce quite a racket while they are working multiple hours on your latest three-dimensional creation.

That’s why I sat down a couple of years ago now to create OctoPrint, a free and open-source remote control and monitoring solution for 3D printers that is targeted at the Raspberry Pi. It allows you to control and monitor all aspects of your 3D printer and its print jobs just as if you were sitting in front of it, even if it’s on the other side of your house in the garage - or on the other side of the world.

Let me show you how to get this up and running in no time, powered by OctoPi, the customised SD card image created by Guy Sheffer that merits the label ‘batteries included’.

You'll need

OctoPi image
Camera Module
USB WiFi dongle
Compatible 3D printer
Class 10 SD card (minimum 4GB)

Let’s get started

First, go to the Octoprint GitHub, click on the download mirror linked there and download the most recent version of OctoPi. This might take a while. While the download is running, let’s first prepare your desktop PC or laptop so that connecting to the server later will only require entering http://octopi.local’ into your browser! OctoPi uses something called ‘mDNS’ (also known as ‘Bonjour’ or ‘zeroconf’) to broadcast this address on the local network and make it discoverable by other PCs that understand mDNS. Since not all systems support this out of the box, we now need to make sure yours will know what to do.

How to achieve that depends on what operating system you are running. Linux users should make sure that libnss-mdns is installed. On Debian and Ubuntu, a simple sudo apt-get install libnss-mdns should take care of that. Windows users need to install Bonjour Print Services for Windows, which can be downloaded from Apple. After installation, you’ll need to make sure that your Windows Firewall allows traffic on UDP port 5353 and that mDNSresponder.exe has network access. Mac users are lucky; for them, mDNS should be supported out of the box by the operating system, without the need to install anything else.

Preparing the image

Once you have downloaded the ZIP file, unpack it on your computer and flash it to your SD card. After that’s done, don’t boot from it yet - we’ll first configure your WiFi connection, which we can do quite easily without booting.

Plug the freshly flashed card into the SD card reader so your computer detects it just like it would a USB thumb drive. Open it up in your file manager and take a look there; you’ll see a file called octopi-network.txt. Open it in a text editor. You’ll see a bunch of example configuration snippets for various types of WiFi setups: encrypted with WPA/WPA2, encrypted with WEP, and unencrypted. Choose the one that matches your WiFi setup; if you are unsure, try the first one labelled ‘WPA/WPA2’, as that should be the most common type. Uncomment the three lines by removing the leading ‘#’ and insert your WiFi SSID and password where it says so. Let’s assume your WiFi has the SSID ‘MyWifi’, the password ‘MySuperSecretPassword’ and is WPA2 encrypted; if so, the four lines related to the WPA configuration snippet should look like this:

## WPA/WPA2 secured
iface wlan0 inet manual
    wpa-ssid “MyWifi”
    wpa-psk “MySuperSecretPassword”

Save the file and securely remove the SD card reader. It’s now time to boot up the Pi!

Final setup

Connect the camera, your printer and your WiFi dongle to your Raspberry Pi, then plug the SD card in and power your Pi up. The first bootup will take a while, but sooner or later your WiFi dongle should show some activity and your camera will switch on. If you’ve entered your WiFi credentials correctly and set up mDNS support properly, you should now be able to just SSH into the Pi via the address octopi.local (using the username pi with the password raspberry) to perform some final setup steps.

First of all, change the password with passwd - don’t forget it! Then run sudo raspi-config and expand the file system on the SD card. After the obligatory reboot which follows, enter http://octopi.local into your browser. Depending on your Raspberry Pi model, this may take a little while to show you a page, but sooner or later OctoPrint’s web interface will greet you with a prompt to set up your OctoPrint account. Choose a username and password, click ‘Keep Access Control enabled’ and log into your shiny new OctoPrint instance via the Login button in the upper right corner. Then select your 3D printer’s serial port and the appropriate baud rate from the Connection menu on the left, and click Connect. Once it says ‘Connected’ and your temperature graph starts showing your data, you are all set. Congratulations!

You can now fully control your printer from the web interface, upload files to print, remotely watch your print jobs, and create time-lapses. And if you take a look into the Plugin Manager inside the Settings dialog, there are also a bunch of very nice things to be discovered there. Have fun!

This tutorial was written by Gina Häussge

From The MagPi store

Subscribe

Subscribe to the newsletter

Get every issue delivered directly to your inbox and keep up to date with the latest news, offers, events, and more.