Wireless 3D printing with Raspberry Pi

In this guide I will go through the steps required to turn you 3D printer into a wireless device that can be controlled from other devices anywhere.

 

But why?

For a long time I have been annoyed by the fact that I have been using my main computer to send gcode over usb to my 3D printer. This was not a good solution and especially not since my printer has an Arduino Mega 2560 and I have accidentally uploaded a wrong program to it and "bricked" it earlier. Of course I could have chosen the route of SD card printing, but it's just one step too many I think. I have a Raspberry Pi that has been laying around here unused as I didn't know what to use it for and figured that a 3D print controller had to be the perfect use for it.

First I had a look at Pronterface for Raspberry Pi since I had been using this software on my computer earlier. There certainly was a version of it for the Pi but it wasn't quite what I was looking for. Then I stumbled upon Octoprint. A complete solution to make your 3D printer accessible from anywhere wirelessly. PERFECT!

 

You need:

  • 3D printer(too obvious?)
  • Raspberry Pi with Raspbian( Here is a guide)
  • Basic knowledge of using the terminal in Raspberry Pi

 

First things first

We need to ensure that your Raspbian install is updated. If connected to the Raspberry Pi with a keyboard and monitor open a terminal or use ssh(More info) to access it. Everytime you see a box like the one under you will write the commands into the terminal one line at a time and press return between them.

sudo apt-get update

Next up we need to download and install the basic OctoPrint package.

cd ~
sudo apt-get install python-pip python-dev python-setuptools python-virtualenv git libyaml-dev build-essential
git clone https://github.com/foosel/OctoPrint.git
cd OctoPrint
virtualenv --system-site-packages venv
./venv/bin/python setup.py install
mkdir ~/.octoprint

And change some user permissions

sudo usermod -a -G tty pi
sudo usermod -a -G dialout pi

 

Making it automatically start

Since you probably want your Raspberry Pi to be a slave with no keyboard or monitor connected it's a nice thing if the OctoPrint services starts automatically if you reboot your Pi. This can be done by writing the following.

sudo cp ~/OctoPrint/scripts/octoprint.init /etc/init.d/octoprint
sudo chmod +x /etc/init.d/octoprint
sudo cp ~/OctoPrint/scripts/octoprint.default /etc/default/octoprint

What this code did was copy the needed files to the right folders. But now we need to change a few lines inside them. 

First we need to open the file

sudo nano /etc/init.d/octoprint

This will open a text editor inside the terminal. Scroll down until you see the text "DAEMON". 

Replace 

DAEMON=/etc/default/octoprint

with

DAEMON=/home/pi/OctoPrint/venv/bin/octoprint

Now press Ctrl+O and confirm with the return key. Then press Ctrl+X to close the text editor. 

We now need to add the script to autostart.

sudo update-rc.d octoprint defaults

It's now possible to start, stop or restart the OctoPrint service by writing

sudo service octoprint start
sudo service octoprint stop
sudo service octoprint restart

 

Accessing OctoPrint from another device

You are now ready to connect to your printer from another device. Make sure that the service is running and that the 3D printer is connected to the Raspberry Pi and turned on.

For the next step you will need your Raspberry Pi's ip address. This can be found by writing "ifconfig" in the terninal or if you are not connected to the Raspberry Pi anymore you can use Fing or a similar service to search your network and find it. 

Now go to a web browser and write http://<your raspberry ip>:5000 

If everything works this should bring up an interface that will ask you to choose a username and password for you printer. After doing this you can start configuring and testing your new printer setup.

The interface is in my opinion very nice and have a lot of cool features. One of them is a live updated Gcode view that shows you what layer the printer is working on right now. It is also possible to add a camera and make time lapses automatically.

The rest of this setup is specific to you particular printer. Check out the video below by YouTube user SinfoniaSam for a quick walkthrough of the needed settings.

 

 

Accessing OctoPrint from Android phone

As a next step I downloaded OctoDroid for Android. With this app I can monitor my prints and a lot more. It also gives a nice progress bar on the lock screen

 

Taking it to the next level

I have only made all of these features available inside my own network, but it is certainly possible to take it further and make it available outside your house. But this guide will not cover the more advanced parts of the setup.

This guide is a simplification of a more advanced guide. If you want to take it to the next level and add webcam support and so on visit https://github.com/foosel/OctoPrint/wiki/Setup-on-a-Raspberry-Pi-running...

Comments

Submitted by ggallant on Sat, 2015-12-12 17:40

ggallant's picture

This is a very useful guide. Thanks for doing all the hard work and posting a easy to read tutorial. 

Submitted by Roxanna77 on Sat, 2015-12-12 18:11

Roxanna77's picture

Great way to get the printer off an expensiive desktop or laptop and onto a $35 Pi! I really like that.
And thes days with Windows10 decideing to reboot systems at will and without asking, this is very good timing to show  the power of the Raspberry Pi.

Exellent write up and graphics too!

To get this from outside of your local network would just be a matter of setting up Single Port Forwarding route on your wireless router, would need to know what port the Android software wants, and then using the IP your ISP provides you (look up on WhatsMyIP.org) and the port number you have chosen.

Submitted by fhareide on Sun, 2015-12-13 08:25

fhareide's picture

Thank you!
Yes I think I will make a second guide for that and also for connecting a web camera. I ordered a cheap one so will do the guide when it arrives:)

fhareide's picture
Author: 
fhareide
Last updated: 
12 Dec 2015 - 14:20