January312013

If you went through the set of pictures I posted along with my post about my Ultimaker, you might have noticed a bracket for a Raspberry Pi in there, including the Pi itself. I bought one of those tiny computers (together with a tiny USB WiFi dongle) around the same time I acquired the Ultimaker, specifically for the purpose of using it as a wireless printing host taking care of sending the print commands to the Ultimaker and also offering information regarding the current state (progress, temperature etc) of the printer and print job. Ideally I wanted to be able to upload GCODE files to the Raspi via a web interface, and also use that to start, pause, stop the printjob and have a general idea what the Ultimaker is currently doing (the plan being to set it up in another room so that it does not bother us in living room or office with noise or PLA fumes).

I tried some existing web interfaces for this (namely Printerface, the web interface of Printrun and 3DPrinterInterface), but they either did not offer the back channel I wanted or I didn't get them to properly work (I don't blame the software here, I didn't have much patience to be honest). Given that it's been some time since I had some private coding session, I took that as a reason to hack something together myself. Studying the code bases of some existing printing tools, I quickly learned that it takes a bit more than just sending some lines over a serial interface and read some stuff back and be done with the printer communication, but that in order to get some solid, error-resilient communication stack including the necessary state queries I needed for my back channel requirements, I'd have to invest quite some time to get what I want. So instead of reinventing the wheel here as well, I decided to just build my web interface on top of Cura, basically offering an alternative UI on top of the existing printing code. Given that Cura is written in Python and works under both Windows (my development environment) and Linux (the target environment) I figured that should give me a good starting base, and I was right.

while connected to the printer, gain information regarding the current temperature of both head and bed (if available) in a nice shiny javascript-y temperature graph

while printing, gain information regarding the current progress of the print job (height, percentage etc)

read the communication log and send arbitrary codes to be executed by the printer

move the X, Y and Z axis (jog controls, although very ugly ones right now)

change the speed modifiers for inner & outer wall, fill and support

All this is done via AJAX with a little server component (which heavily borrows from the existing print dialog implementation), and it feels quite responsive I dare to say, even on the Pi :) I so far tested it on both my windows-based development box and the Raspi as server1), and Chrome on Windows and my Galaxy Note 10.1 as the frontend, and I'm quite happy with the results so far.

It also allowed me to play around with Flask, JQuery, Bootstrap, Knockout.js, Flot and the JQuery File Upload Plugin, so I not only have a nice web interface for my printer now, I also learned something in the progress and had an awful lot of fun while doing so I'll probably continue to work on the code, but my original goal – a wireless Ultimaker – is reached I'd say

Probable next steps: Webcam support and some electronic solution that allows me to just plug in one power plug for both Raspi and Ultimaker

Update from Dec 31st 2012

I have just made a major overhaul of the codebase. Since I had to realize that with the limited processing power of something like a RasPi it's just not feasible to even think about adding slicing support, the only thing used from Cura will stay the communication stack and GCODE interpreter code. I therefore refactored the codebase to only include those parts (with proper Credit of course!) and pushed it to a different repository.

Further development will continue there, but I'll leave the forked Cura repo with the added WebUI where it is now (with a statement where to find updates ).

Update from Jan 31st 2013

I nearly forgot to mention it here… Printer WebUI was renamed two weeks ago into “OctoPrint” (including a neat logo) and has consequently been relocated to here since last sunday. Let's hope that this will be the last move ;)

1)
On my Raspi (running Rasbian) I got it to run by cloning the Git repository, installing the python-pip package, then installing the dependencies as stated in the repo's requirements.txt via pip install -r requirements.txt and then starting the interface via python -m Cura.cura –web from the repo root (at least as far as I can remember *cough*). I added a corresponding entry to /etc/rc.local so that the web interface now starts up when booting the Raspi.