One of most interesting uses of Raspberry PI is controlling a 3D printer (the mine one is an Anet A6) without needing to be connected with your PC. This can help for long prints and improve controls available on printer status.
What Is OctoPi
OctoPi is a fork from Octoprint, built to run on Raspberry Pi.
OctoPrint (here the home page) is an Open Source project which enables an improved web interface to control 3D printer and printing jobs. It allows to:
- Access the embedded webcam feed and watch remotely how your printer is creating your newest thing.
- Get constant feedback regarding the current progress of your print job.
- Take a look at the integrated GCODE visualizer to see a rendition of the GCODE you are currently printing.
- Keep an eye on the temperatures of your hotends and print bed and adapt them on the fly.
- Move the print head along all axes, extrude, retract or just define your own custom controls.
- Start, stop or just pause your current print job, you are in full control at any time.
OctoPrint and Docker
Everyone knows my love for Docker. But in this case the official Docker image available on Docker Hub is not built on ARM processor, se there is the need to use an unofficial image.
From the various images that I tried, the one from urrizzz user (https://hub.docker.com/r/urrizzz/octopi/) was correctly working on my Raspberry Pi.
Some considerations on Hardware. OctoPrint notifies that the Raspberry Pi Zero W is not recommended since severe performance issues were observed, caused by the WiFi interface when bandwidth is utilized (look here for GitHub issue). So I decided to test it on my Raspberry Pi 3 A+, which has also a camera connected that will be used for video streaming.
We start from a RPI with Docker installed (please find here the procedure).
The following step is installing MotionEye into a container (also this can be done with the following procedure, being careful to map also 8081 port for video streaming).
Before staring, we need to identify the port related to USB. Once your printer is powered on and connected with your Raspberry Pi, type:
ls /dev | grep tty
The port should sound something like /dev/ttyUSB0. Now the power of Docker comes to us and allows OctoPi installation with a single command line:
docker run -d --device /dev/ttyUSB0:/dev/ttyUSB0 -p 4000:5000 --name octopi urrizzz/octopi
Fantastic, isn’t it? Note that we had to change the host port (4000) in order to avoid port conflict with MotionEye
At the end of image download, extraction and run you will be able to connect your OctoPi setup wizard page by browsing the address http://<<YOUR_RPI_IP_ADDRESS>>:4000.
You can configure or simply press next (except for user and password creation) to reach the home page (all the settings can be edited later):
Click connetct to contact your printer.
To connect also your webcam to OctoPi:
- go to the settings (icon on top-right with the wrench),
- select “Webcam and Timelapse”
- insert your streaming ip address ( http://<<YOUR_RPI_IP_ADDRESS>>:8081/ ) and press the test button
My configuration appears as in the following picture:
Press “Save” and you should find your video streaming in Control Section: