Monthly Archives: October 2018

3D Printing: Networked Printing with Print3r

Note: The information is outdated as print3r natively supports networked printing, see 3D Printing: Print3r 2.x: Networked Printing (2019/02/27), but this information is still useful bridging USB to TCP in general.

Introduction

The moment you deal with more than one single 3d printer, but multiples – you want to access those with a single host: creating a cloud 3d printing facility.

After a few minutes researching the net for USB to network bridge, I realized the overhead to print via network is possible without Octoprint or some other solution, but simple ser2net and socat alone, thanks to this Github Issue by Marco E explaining his steps, so I reiterate his solution with some changes:

  • create USB to network bridge with ser2net per printer
  • create network to virtual serial per printer with socat on the host

Printers

Each printer you like to network has to have:

  • Linux OS (like Debian, Ubuntu or alike), e.g. Raspberry Pi or OrangePi or any kind of lowcost ARM-based board
  • USB connectivity where the 3d printer is wired
  • Wi-Fi (wireless) or Ethernet (wired) connectivity

Install

As next install ser2net serial to tcp bridge per printer:

% sudo apt install ser2net

Create a file named client.cfg, you may have to change the baudrate and/or the USB device:

3380:raw:600:/dev/ttyUSB0:115200 8DATABITS NONE 1STOPBIT -XONXOFF LOCAL -RTSCTS

Start ser2net on each printer:

% ser2net -c client.cfg

Host

As next prepare the host, where all the printers will be controlled from:

  • UNIX OS like Linux (Debian, Ubuntu, *BSD, macOS should work too)
  • Wi-Fi (wireless) or Ethernet (wired) connectivity
  • Print3r

Install

First make sure you have socat installed:

% sudo apt install socat

For each printer you are creating network back to (virtual) serial port – replace 192.168.0.16 with the IP of your printer(s):

% socat -d -d pty,raw,echo=0,b115200 tcp:192.168.0.16:3380
2018/10/07 10:08:16 socat[31821] N PTY is /dev/pts/29
2018/10/07 10:08:16 socat[31821] N opening connection to AF=2 192.168.0.16:3380
...

The first line reports the new virtual serial port, e.g. /dev/pts/29  or enforce a link of the new device:

% socat pty,raw,echo=0,b115200,link=/tmp/my-printer tcp:192.168.0.16:3380

you can reference /dev/pts/... or the link you defined with Print3r then:

% print3r --device=/tmp/my-printer --scale=2 --random-placement --fill-density=0 --perimeters=1 print xyzHollowCalibrationCube.scad
== Print3r 0.0.8 == https://github.com/Spiritdude/Print3r
print3r: conf: device /tmp/my-printer, bed 380x300mm, nozzle/d 0.5mm, layer/h 0.4mm, filament/d 1.75mm
print3r: scad to stl: done.
print3r: slice part to gcode: position 272,118, filament usage 2.38m, done.
print3r: print: 0h 03m elapsed, eta 0h 16m, 18.9% complete, z=0.60mm, layer #2, filament 0.42m

So you end up with something like this:

3d-printer-networking

So, that’s it, with ser2net on the printers, and socat on the host you have a rather simple and straight-forward cloud 3d printing facility.

I likely will extend Print3r to support networked printing with a simple all-in-one setup. Implemented since Version 2.0.0, see 3D Printing: Print3r 2.x: Networked Printing.

Update:

  • 2018/11/01: there is a slight drawback using ser2net: only takes common baudrates, but doesn’t support 250,000 which is the default baudrate for Marlin, 115,200 does work though. So, in case you plan to use ser2net reflash the firmware to use 115200 as baudrate.

3D Printing: Print3r (CLI)

example

Command Line Interface (CLI)

Although 3d parts need to be seen and visually so much is communicated, but Cura’s user interface feels conceptually skewed (“Prepare” vs “Monitor” tab) – and with the time I thought I want an ordinary command line interface to print parts quickly, easily multiply and random placement so the bed surface is more evenly used and not just the center – I have grown tired to move parts on the virtual bed.

So, I wrote print3r, a command line interface which utilizes Slic3r as backend. Its main features (Version 0.0.6):

  • command line interface, no GUI
  • UNIX platform (Linux, *BSD, macOS should work too)
  • print .scad (OpenSCAD), .stl, .obj, .amf and .3mf directly
    • it converts and slices depending on file format as needed
    • takes Slic3r command line arguments
    • multiply part
    • random placement
    • scale, rotate, translate or mirror (.scad or .stl only for now)
  • slice .stl, .obj, .amf and .3mf to .gcode
  • print gcode files
  • send gcode lines direct from command line arguments
  • send interactively gcode commands from the console
  • render .scad, .stl and .gcode to PNG for documentation purposes

Example

% print3r --printer=ashtar-k-30x30.ini --fill-density=0 --random-placement print Parts/cube.scad
== Print3r 0.0.3 == https://github.com/Spiritdude/Print3r
print3r: conf: device /dev/ttyUSB0, bed 300x300mm, nozzle/d 0.5mm, layer/h 0.4mm, filament/d 1.75mm
print3r: scad to stl: done.
print3r: slice parts to gcode: filament usage 79.67cm, done.
print3r: print: printing 0h 09m elapsed, eta 0h 00m, 100% complete (38494 of 38494), z=19.80mm, layer #50, filament 79.67cm

More information on the printer display: progress [%], eta and layer#:

20181005_170351

Result:

20180927_152946

and if you replace ‘print‘ with ‘render‘, like

print3r [...] --output=sample.png render Parts/cube.scad

cube-example

Download

Github.com: Spiritdude/Print3r