Raspberry Pi Zero Octoprint / OctoPi setup

Written on Dec 2015

I expect this post to age quickly but will hopefully find people setting up OctoPi for the newly released Pi Zero.

OctoPi is a Raspbian image with Octoprint installed and configured on it. Octoprint allows network access and control of a USB connected 3D printer. It is the best thing since sliced bread, in my opinion and it has allowed the whole household to access the printer. The software has also created freedom to control the printer from multiple devices in the house. The webcam monitoring allows progress of prints to be checked too. There is even a mobile phone app now that allows control of the printer from an Android smart phone.

Get the case

House your Pi Zero in a case to protect it or use self adhesive posts to mount it somewhere on or in your 3D printer, remembering to allow access to SD slot and USB sockets. I’d recommend this case I made: http://www.thingiverse.com/thing:1167846

Get the image

If the current release version of Octopi is placed into a Pi Zero, then the Pi Zero will flash the on-board LED repeatedly 8 times and the Pi Zero will refuse to show any output to HDMI and will fail to boot.

This is because the current (Dec 2015) release version of OctoPi (2015-07-02_2015-05-05-octopi-wheezy-0.12.0) is built on the wheezy version of Raspbian. Raspbian is the flavour of Linux operating system developed for the Raspberry Pi devices. The Pi Zero requires the jessie version of Raspbian as a minimum to boot. Luckily the nightly builds of OctoPi are now using Jessie, although the nightly builds are not official releases and may have some issues yet to be ironed out, I’ve actually found them reliable in practice. Download the latest nightly build from the nightly build folder, for example today it is https://storage.googleapis.com/octoprint/2015-12-04_2015-11-21-octopi-jessie-0.13.0.zip, the 04th of Dec being today.

Write the image

Uncompress the zip file and use the resulting disk image to write to your micro SD card that will be placed into the Pi Zero. Follow the standard instructions for writing Raspbian to SD cards. Follow the instructions on “how to use it” here https://github.com/guysoft/OctoPi. Remember to configure the network settings in the network text file located in the root directory of the written SD card.

Plug in the Pi Zero and 3D printer

Use a micro-B USB on the go to USB A female cable adapter, to plug in a (powered preferably) USB hub, into which you plug a WIFI dongle and the printer. Next plug in the micro-B USB power to the right hand socket, this is the dedicated power socket, does not do data and also note the data USB socket next to it cannot be used to power the Pi Zero.

Boot and using a web browser browse to http://octopi.local or find the IP address your network has assigned to the Pi by checking the router or DHCP services.

At this point you should be up and running.

IMG_7897

Printrbot, Pi Zero & USB 3.0 Hubs

Trying to connect Printrbot Simple Metal Printrboard to the Pi Zero resulted in no serial port being listed in OctoPi. The message on trying to auto connect was:

Failed to autodetect serial port, please set it manually

Connecting to the OctoPi via SSH and looking at the $ dmesg output revealed issues with the Pi identifying the Printrboard, which presents itself as a serial device.

device descriptor read/64 error -71 dwc_otg

This normally indicates a power issue, but the hub is a Amazon Basics USB 3.0 powered hub, so this seems unlikely. From the previous Pi to the Pi Zero, the printer has moved from being directly plugged into the Pi to going via the hub, due to the Pi having no internal USB hub.

After some research it turns out that support for USB 3.0 hubs might not be very good on the Raspberry Pi. I tested this by getting a simple, old unpowered USB 2.0 hub out the drawer, much to my delight this worked allowing the printer to be detected by OctoPi.

Please comment if this was helpful as it motivates me to write more!

Comments (11) -

  • Thanks for writing this, I'll be interested to hear how you get on.
    But I'm curious as to why you've chosen to use the pi zero to drive your 3d printer. I have considered retiring the pi B I have driving mine for the zero but the lack of a second USB port or Ethernet is the deal breaker for me.
    Are you intending on keeping a USB hub connected all the time or is there some clever way of accessing a network without using USB which I've overlooked?

    Keep up the good work, I'd be interested to see how you get on.
  • Tim
    Chris,
    Thanks for the comment, nice to know people read the blog!
    Reasons for Zero;
    -Exceedingly cheap, keeping my higher spec (in terms of connectivity) PI's available for other projects
    -Already was using a powered hub for webcam, WiFi and Printer connections on previous Pi that was running Octoprint due to power needs
    -The Zero is actually faster than the previous old RPi I was running on with my printer! So OctoPi runs a little slicker IMO (subjective).
    - Its so tiny I can EASILY put the Pi inside the printer chassis, technically possible with a full size Pi, but much more cosy.
    - Zero is very power efficient, and I tend to have my printer Pi on all the time.

    You can't avoid a hub with the Zero, its really for headerless embedded applications really, but I've already got cheap hubs around the house, now unused left over from PC upgrades, upgrades from from USB1 and USB2 to USB3.
    Besides a £3 hub I tested worked fine with the Pi!
  • Tim,

    First thanks for sharing!

    I have setup a Zero and am now struggling to get the video to work.

    I have a zero, wifi and generic camera... it seems to be recognized by the zero but I cannot get video in either the browser or VLC....

    I get the following in the log:

    Mar 10 02:38:26 octopi kernel: [   93.146037] usb 1-1.2: new high-speed USB device number 5 using dwc_otg
    Mar 10 02:38:26 octopi kernel: [   93.297263] usb 1-1.2: New USB device found, idVendor=1908, idProduct=2311
    Mar 10 02:38:26 octopi kernel: [   93.297292] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
    Mar 10 02:38:26 octopi kernel: [   93.297305] usb 1-1.2: Product: USB2.0 PC CAMERA
    Mar 10 02:38:26 octopi kernel: [   93.297317] usb 1-1.2: Manufacturer: Generic
    Mar 10 02:38:26 octopi kernel: [   93.302885] uvcvideo: Found UVC 1.00 device USB2.0 PC CAMERA (1908:2311)
    Mar 10 02:38:26 octopi kernel: [   93.304688] input: USB2.0 PC CAMERA as /devices/platform/soc/20980000.usb/usb1/1-1/1-1.2/1-1.2:1.0/input/input1
    Mar 10 02:38:49 octopi logger: Starting USB webcam
    Mar 10 02:38:49 octopi MJPG-streamer [670]: starting application
    Mar 10 02:38:49 octopi MJPG-streamer [670]: MJPG Streamer Version.: 2.0
    Mar 10 02:38:49 octopi MJPG-streamer [670]: Using V4L2 device.: /dev/video0
    Mar 10 02:38:49 octopi MJPG-streamer [670]: Desired Resolution: 640 x 480
    Mar 10 02:38:49 octopi MJPG-streamer [670]: Frames Per Second.: 30
    Mar 10 02:38:49 octopi MJPG-streamer [670]: Format............: JPEG
    Mar 10 02:38:49 octopi MJPG-streamer [670]: TV-Norm...........: DEFAULT
    Mar 10 02:38:49 octopi MJPG-streamer [670]: www-folder-path...: ./www/
    Mar 10 02:38:49 octopi MJPG-streamer [670]: HTTP TCP port.....: 8080
    Mar 10 02:38:49 octopi MJPG-streamer [670]: username:password.: disabled
    Mar 10 02:38:49 octopi MJPG-streamer [670]: commands..........: enabled
    Mar 10 02:38:49 octopi MJPG-streamer [670]: starting input plugin input_uvc.so
    Mar 10 02:38:49 octopi MJPG-streamer [670]: starting output plugin: output_http.so (ID: 00)
    Mar 10 02:39:26 octopi MJPG-streamer [670]: serving client: 192.168.54.6

    Last line says it seems to be trying to get the video out but... nothing... Frown

    Thanks!
  • It seems you've glossed over an important detail: how to get the wifi to connect.
    I've done what you describe, but the url does not work and the Pi0 does not appear to be connected to my network. Why would it be when I've not entered a wifi password? Maybe you could add the instructions for entering that. I've got an Edimax N150 plugged into the USB hub. It seems like I might need a monitor and keybd to finish setting this up.
    • Under the heading of "write the image" i say, "Follow the standard instructions for writing Raspbian to SD cards. Follow the instructions on “how to use it” here https://github.com/guysoft/OctoPi. Remember to configure the network settings in the network text file located in the root directory of the written SD card."

      Network config of RPi for WiFi is a whole subject of its own, not something I wanted to get into the detail of. The most important thing is to use a WiFi dongle that is 100% suitable for RPi, otherwise it gets difficult.
      For a feel of what you need to do, see this url, davidmaitland.me/.../
  • Hey Tim thanks for the nice write up! I'm having the same issue connecting to my printrboard. I've also tried with a smoothieboard.

    Can you provide some info on the hub that was working for you? I bought a cheapo one from microcenter as I wanted to keep this build inexpensive, and the wifi works but can't connect with the serial ports.
    • I'm sorry but it was just some really cheap hub in my drawer, from discount shop. Apologies i have no more info on it!
  • DrD
    I kickstarted something called the RedBear IoT pHAT, which adds btle and wifi using the gpio headers to any pi that has the full header breakout. (2, 3, zero, etc).  I do not know how it works yet, but I am hoping this will work correctly with the zero, so I can use a single OTG cable for the printer and have a raspi camera and make this all a tiny octoprint setup.
    • Thanks for  pointing out your project https://redbear.cc/product/iot-phat.html
      Now the zero has the camera option and a better ecosystem of boards like this, I guess we have many more options  to get an good octoprint setup!
      • DrD
        Just to rectify, that was not my kickstarter, I simply helped fund it. On another note, I have confirmed that the Pi Zero (v2), Pi Camera, RedBear IoT pHAT Wifi, and an OTG cable all work together. I am currently messing around with the controls on my printer with OctoPrint from another room. Time to start using it for printing and testing its performance!
        • Thanks for the update, sounds like it has gone well!

Add comment

Loading