Table of Contents

(work in progress Sam :) )

PIZERO OCTOPI

This quick guide is an example of how you can you a Raspberry Pi ZERO W as an Octoprint controller.

The recommended setup is still to use a Raspi3, as it has more CPU power and full width USB ports. However I do believe a PiZero setup works quite well, and has the benefit to be extremely compact (no external camera, no external power, less cables, etc) This setup is “non invasive” (can be easily removed), and it can even fit on the A3S/A5 screws in an elegant way.

Detail ;

What I do like about my own setup is that I can see not only the material beeing printed (to check if all is good), but also the spool moves, which looks great when doing timelapses with OctoPrint.

Additionnally, on the PWM and IO ports of the ZERO ; you can easyly add lighting LEDs and/or a button to cancel prints (topics not covered here)

Stuff you'll need

Everything can be put together in the case

  1. The Pi
  2. The Camera
  3. The little cable

You should end up with this

Now - as covered in multiple other tutorials (eg http://dabbletron.com/how-to-run-octoprint-on-a-raspberry-pi-zero/ ), simply find an image of Octoprint for Pi (https://octoprint.org/download/) flash it on a MicroSD card ( 16 GB or more recommended )

As the PIZERO doesn't know your network settings yet, mount the flash drive in a PC and edit the network config ( found in /boot/octopi-network.txt ) for your internal LAN's SSID and password.

Then put it in the PIZERO, boot it and verify it gets an ip adress (eg : in your router)

Beware the PIZERO has two USB ports and you need them both

The one at the side of the case (right on the picture) is the “power” one, you simply connect it with a micro usb cable to the USB thumbdrive port on the A5/A3S : it'll power the pi. You can also power it with a USB powerbank for your tests (no fan noise :) )

The second cable, located in the center, is the data port. This one will send Octoprint's instructions (GCODE) to the printer, in the same way your laptop would do. The Pizero only has MicroUSB ports, so you need connect this one with an OTG adapter to the “blue” data cable (USB2.0 TYPE B, the square port). You can find a micro USB to USB2.0 TYPE B cable, they do exist in china. (I'm waiting one myself.)

Once it's powered up (there a little green led flashing that you can see barely at the back of the case) try connecting to it with it's ip, or maybe http://octopi.local if proper dns resolution is in place.

Serial port

You should setup the Octoprint to use /dev/ttyAMA0 if the “auto” setting does not work. You should hardwire the data rate at 250,000

As Samuel points out, it is important you disable some error handling

The communication between the LCD panel and the REPRAP board can spit out error message that could be interpreted by Octoprint as a print problem (which they are not) and would cancel a print.

Camera

You can of course put your camera wherever you see fit. I did put it next to the extruder, as it gives me a nice view of the current printing process, and it's not obstructing access to the printer.

You should use the 4:3 setting in Octoprint. By default, the camera streams at 640×480 which is very low resolution. The PiV3 is able to do up to 4000×2000. However, I don't recommend you go much higher than that, as Octopi is already streaming at a ridiculous 10Mbps for that resolution. Also, the focus of the V2 is not very sharp anyway, so it's a bit of a waste of bandwidth. YMMV.

Should you wish to change the resolution of the cam, edit /boot/config.txt

Here are some settings you can try

#default : 640x480 10fps. Streams at 10Mbps which is already a lot.

camera_raspi_options="-fps 10"

# Raspberry Pi Camera V2, half resolution, video mode, full field of view (4:3 aspect) at 10fps
# Notes: Streams at 30Mbps !
#camera_raspi_options="-x 1640 -y 1232 -fps 10 -quality 95"
#
# Raspberry Pi Camera V2, maximum resolution, stills mode, full field of view (4:3 aspect) at 15fps
# Notes: Very slow for streaming, large images. Less image processing, generally looks worse
#camera_raspi_options="-x 3280 -y 2464 -fps 15 -usestills -quality 95"
#
# Raspberry Pi Camera V1/V2, 1080P, partial field of view (16:9 aspect) at 30fps
# Notes: Using 16:9 aspect crops your field of view so you will see less
#camera_raspi_options="-x 1920 -y 1080 -fps 30 -quality 95"
#
# Raspberry Pi Camera v2, 720P, partial field of view (16:9 aspect) at 30fps
# Notes: Using 16:9 aspect crops your field of view so you will see less
#camera_raspi_options="-x 1280 -y 720 -fps 30 -quality 95" 

Don't listen to tutorials saying you to reboot the box after editing this file (?) simply do a service restart webcamd (as root) Then reload you browser window.

Hardware setup

in progress Basically : I'm using a 3D printed mount, then use two screws from the vertical rods to tighten it. I then find a proper viewing angle, then glue it for good. more details later :)

Final comments

The Octoprint website is not very clear ; they “do not recommend” the PiZERO for a setup, but the related bug ( https://github.com/guysoft/OctoPi/issues/318#issuecomment-284762963 ) has been closed since a long time, and many people report this works fine for them. And so do I.

As long as you limit the bandwidth of the webcam, which makes sense anyway for such a small and wifi device, I've never seen more than 17% cpu usage for streaming. You can even go lower than that by limiting FPS.

My experience has been very positive so far with a PizeroW setup as an octopi, it's also great to use with smartphone apps ( like “octoprint remote” and others ) by scanning the qR code.

I hope you enjoyed this little tutorial and that it inspired you to think “out of the box” and try things by yourself. :)

–CEDRIC