Monday, April 25, 2016

Printrbot Control with OctoPrint and Pi Link

I've been a big fan of Printrbot since the beginning. I've owned a Printrbot Original, Printrbot Simple, Printrbot Simple 1405, and currently a Printrbot Play. After becoming a fan, I even got to "moonlight" on their support team for a year.

As with just about any 3D printer, Printrbots connect to a computer with USB, and the commands for the print are fed to it serially throughout the duration of the print with a program like Pr0nterface, Repetier-Host, or Cura. Interrupt that stream of commands, and your print stops, which means you have to start over. The stream can be interrupted by letting your computer fall asleep, closing the print software, or even by plugging in another USB device (like an iPod).

The solution is a $35 Raspberry Pi and an open-source program for it called OctoPrint. The Raspberry Pi takes the place of your computer (being a tiny computer itself), and OctoPrint is accessed via a web browser over the network. Not only do you minimize the risk of losing a long print, but it untethers your computer as well.
OctoPrint, accessed via a web browser over Wi-Fi
A Raspberry Pi and OctoPrint solve a lot of problems, but I couldn't quite cram a full-sized Raspberry Pi B+ into my Printrbot Simple, and I couldn't use the smaller and cheaper Raspberry Pi A+, because it has only one USB port which is taken up by the Wi-Fi adapter.

I mentioned this problem to Jesse Laird, a good friend of mine who is a hardware engineer and fellow fan of Printrbot. He's made a lot of big contributions to the Printrboard firmware, so he's really, really, really, really familiar with it.

Jesse responded a couple months later with the Pi Link board, a sweet little device that packs a lot of functionality. I'm not really sure when he sleeps. Here's what it does:
  • Provides 5v power to the Raspberry Pi via GPIOs
  • Moves Printrboard communication from USB to GPIOs
  • Converts the 5v logic on the Raspberry Pi to the 3v logic on the Printrboard
  • Powers the Printrbot on and off via OctoPrint
  • Exposes a couple more GPIOs for buttons and LED's
He produced about 10 of these boards, and I was fortunate enough to receive one from him. Another went to Gina Häußge at OctoPrint, who wrote a plugin for it. 

Gina's plugin adds a power button for the printer, and automates the connection process after the printer has been powered on.
Technically, the Pi Link board isn't a Pi HAT, but that's essentially what it is. It plugs into the top of the Raspberry Pi via the GPIO pins, and has a 12v power in connector, a 12v power out terminals, and a ribbon cable connector.

The power in connector is identical to 4-pin or 6-pin connector on the Printrboard, so you can take your existing power and plug it right in. Then, another cable is used to go from the screw-down terminals and out from the Pi Link to the Printrboard. This allows the Pi Link to completely turn the printer on and off through OctoPrint.

Power is supplied to the 4 or 6-pin connectors on the left, and the screw-down terminals supply power to the Printrboard.
The ribbon cable connector connects to the EXP1 (expansion) connector on the Printrboard, instead of connecting the Printrboard to the Raspberry Pi via USB. This frees up a USB port for things like a Wi-Fi adapter, and allows you to use a Raspberry Pi A+, which retails for about $20 and has a smaller footprint, all with only one USB port instead of the usual four. Curiously, it's out of stock on Amazon right now but you should be able to find it elsewhere. You could also use a Raspberry Pi Zero, but who can get their hands on one of those, anyway?

If you don't mind spending the extra ~$20, the Jesse notes that the Raspberry Pi 3 should give a much snapper user experience in OctoPrint. It should also negate the need for an external Wi-Fi adapter, but, much like the Pi Zero, I haven't got my hands on one yet to test with.

I 3d-printed a small mount and press-fit standoffs for my Raspberry Pi A+ and Pi Link hat, and stuck it inside my Printrbot Play with a piece of double-sided tape.
After installing the Raspberry Pi and Pi Link in the printer, there was a bit of setup. I had to flash a special firmware to the Printrboard so it could accept gcode over the SPI port, and there was a bit of command-line work on the Raspberry Pi, but I'm a complete Linux novice and I was able to get everything working.

All done! You can see the Raspberry Pi mount, the Pi Link board, an inexpensive Wi-Fi adapter, and the ribbon cable to the Printrboard, all self contained underneath the Printrbot.
Since then, Pi Link has performed flawlessly, giving me hundreds of prints over (probably) thousands of hours. I can slice a file, upload it to OctoPrint, turn on the power, and hit print, all without having to physically touch the printer (but I do like to keep an eye on it for safety reasons).

Jesse isn't currently producing these boards, but the design is completely open-source. I'm not sure if he will make more or not since the future of the Printrboard is unknown, as Printrbot seems to be investigating new ways of controlling their printers. Additionally, Jesse has some concerns about how much power printers draw through the board. His Printrbot Plus pulls about 13 amps, and while it's been fine, anything above 15 amps could be too much for the Pi Link board. Further testing before broad distribution would be a very good idea.

Thank you Jesse for making such a sweet little board! If you have any questions about it, feel free to contact me on Twitter, or in the comments below.


OctoPrint needs funding. Up until recently, OctoPrint development was fully funded for Gina by another company, but that funding no longer exists. If you use OctoPrint at all, please consider funding it via Patreon, so Gina can continue her amazing work!


Pi Link files and documentation on GitHub
Printrbot Play
Raspberry Pi A+
Raspberry Pi B3
Wi-Fi Adapter