Kleiner Backlink als Doku: Jens und ich sind auf der NODE17 Konferenz u.A. mit einem Realtime Ceramic Printing Workshop vertreten.
Bei Interesse (gerne direkt hier bekunden!) können wir einen solchen Workshop auch an der Muthesius für Industriedesigner (oder auch Studienübergreifend) anbieten.
Hier schonmal der allergröbste Überblick:
- Which GCode commands make a 3D Printer move?
- How can I use vvvv to generate GCode?
- Setting up vvvv to communicate with a 3D Printer in real-time via USB
- Using sensor feedback as influence on data generation
###Which GCode commands make a 3D Printer move?
For basic printing, you need only one move command:
G01 or short G1 (with optional XYZ / EF values).
This is a “work” move, which means that the printer
can extrude material while moving.
There’s a rapid “travel move” as well:
G00 or short G0 (with optional XYZ / F values).
This is used to quickly change positions without extruding.
For example, a standard quad (a=1) can be drawn by these commands:
G0 X0 Y0 (travel to origin point) G1 X0 Y1 (move up) G1 X1 Y1 (move right) G1 X1 Y0 (move down) G1 X0 Y0 (move left / back to origin)
Speed / Feed
Without further information, the G0 and G1 will execute with the default feed speed (“F”) that is specified in the firmware of the microcontroller board. If an F value was previously set, it will be used until it is overwritten by a new F value:
G0 F4800 (set all G0 commands to 4800mm/min) G1 F1200 (set all G1 commands to 1200mm/min) G0 X0 Y0 (travels at F4800) G1 X8 Y5 (moves at F1200) G1 F2400 X42 Y33 (moves at F2400)
Absolute vs. relative
GCode can be run in absolute (G90) or relative (G91) coordinates, or a combination of both. Choose whichever is most practical for your project.
Imagine the printhead being at position X10 Y10. Then, sending a
G91 (relative mode) G1 X+4 Y-2
will move the printhead to position X14 Y8.
The same code in absolute mode will behave very different:
G90 (absolute mode) G1 X+4 Y-2
will move the printhead to X4 Y-2.
Note: Big difference! Very useful!
For safety and convenience reasons, there are several useful commands that come in handy when experimenting with patches for 3d printing. I combined the most useful ones into work cycles (commented) that can be sent as a block. A complete overview of all commands can be found in the link section below this article.
M117 homing! (display message "homing!") G21 (use mm units) G90 (use absolute positioning) G28 X0 Y0 (travel to XY zero origin) G28 Z0 (travel to Z zero) G92 E0 (set extruder to zero) G1 Z15 F2000 (move Z up 15mm)
M117 heating up (display message) M107 (disable fan, just in case it was still on) M190 S55 (set bed temperature to 55°C) M109 S210 (set nozzle temperature to 210°C)
GCode is processed line-wise. Therefore, the M109 command will not be executed until M190 has reached the target temperature S55. Heating could also be done simultaneously in a one-line command, but because the nozzle heats up much faster than the print bed, it would ooze out any molten material and run dry long before the bed is hot enough. So, you might want to keep it like this.
M117 cooldown... (message) M104 S0 (set nozzle temp. to zero) M140 S0 (set bed temp. to zero) M107 (disable print fan) M84 (disable stepper motors)
Note: Unlike the M109 and M190 commands, the M104 and M140 will not wait for the temperature to settle. They will just set values and immediately proceed to the next command.
M117 feeding... G92 E0 (set extruder to zero) G1 F200 E3 (extrude 3mm filament) G92 E0 (set extruder to zero again, for a fresh start)
###How can I use vvvv to generate GCode?
Actually, generating GCode with vvvv is as simple as producing coordinates and formatting them in the right order to make it machine-readable. You could run our ceramics printer with just a bunch of xyz coordinates, since there’s is no hotend and all extrusion is manually controlled by an air compressor.
We should create all geometry in vvvv’s default scope of -1 to +1 and then map the values to our printer size. An Ultimaker Original has a build volume of roughly 200x200x200mm and let’s assume we’d like to print a cube of half that size:
It’s best to build a cube inside vvvv that ranges from x-1 y-1 z-1 (lower left front corner) to x+1 y+1 z+1 (upper right back corner), then map these values to a range from 0-200 (Ultimaker size) and finally multiply these values by some scaling factor (here: 0.5).
For additional control over the print result, you can also specify Feed speed and Extrusion distance individually. This sequence of FXYZE values can be converted into strings and combined as follows:
###Setting up vvvv to communicate with a 3D Printer in real-time via USB
The RS232 node can connect to any serial interface, like the arduino/ramps microcontroller boards that are used in today’s open source printers, mills, cnc routers or laser cutters. Once a command is successfully sent and processed, the board sends an “OK” message. In the image above, the “OK” is interpreted as a “bang” and is called “On Data”.
In our special case, “On Data” bangs a counter node, which just delivers the next index number everytime the counter is triggered. This is used as a selector for a getSlice node. GetSlice receives the whole bunch of xyz values that you generated (with a linear spread, for example) and then returns the value set or gcode line that is associated with the current index. This will be sent over the RS232 connection to the microcontroller, waiting for the next “OK” response…
###Using sensor feedback as influence on data generation
Since we are using vvvv and Arduino, it should be no problem to have some sensor inputs modify the way our 3d printing behaves. We can use this to produce unique 3d prints in semi-realtime.
For instance, the Width input pin of a circular spread could be 1 as long as a sensor reading is in a certain range. So, the printer creates a circular shape by default. If the sensor value is below this range, it should reduce the width of the circle and if the sensor reads a higher value, it should add some width.