Welcome to the world of bioprinting. In this document, we will explain how to craft your own print-file (g-code file) for use in your BIO X.


As an alternative to inputting a 3D model and letting the BIO X slice it into the toolpath, the user can directly input a toolpath in g-code format. This feature is meant for more advanced users who want to either tune their print files for optimal performance or to craft their own structure from scratch with full control over all parameters.


G-code is a low-level command format used for CNC machines and 3D printers. The g-code describes the movement of the machine and has special commands for functions like tool changes.


Here are the steps you should follow to write your own G-code. 


1. Give your bioprinter some context


Before you start giving your printer coordinates to move to, you should define an absolute plane of reference for the movements, a relative plane of reference for extrusion, and define that you are referring to a position in units of millimeters. Your pre-structure G-code should contain the following commands: 


Command
ParametersDescription
G90-Defines absolute coordinates.
G21-Set the position units to mm.
M83-Use relative distances for extrusion


2. Write the structure code


There are three main types of commands in G-code:


- T commands define the printhead to be used. BIO X has 3 printheads.

- G commands usually refer to the position.

- M commands are printer specific.


T commands


G-CodeParametersDescription
T
{0-4}
Switch between tools, tools 0-2 are printheads and 3-4 are the photocuring modules. Tool 0 is the bed-probing switch.


G commands


G-CodeParametersDescription
G0Xnnn Ynnn Znnn Fnnn
Absolute travel move move command.
X, Y, Z parameters are the position in space where to move to (in mm). The F2 parameter is the speed in mm/min
G1Xnnn Ynnn Znnn Ennn Fnnn
Absolute move command.
X, Y, Z parameters are the position in space where to move to (in mm). An incremental E value indicates extrusion. When the amount of material to dispense during the move1
The F2 parameter is the speed in mm/min
G4Snnn Pnnn
Dwell
Wait for S seconds and P milliseconds
G7Xnnn Ynnn Znnn Ennn Fnnn
Relative move
Works the same as G1, but uses relative move. The X, Y, Z parameters specify the length of the movement from the current position.
G92Xnnn Ynnn
Set position
Sets the current position to X and Y. If no parameters are given, the position is assumed to be 0, 0, 0 (this will also change the Z position).


If using a pneumatic printhead a positive E value will extrude material and a negative or absence of an E value will not extrude any material when using relative distance for extrusion.
If F parameter is absent the latest set F value for the tool will be used



The coordinate system in BIO X is centered on the calibration position. One a printhead is calibrated, that position becomes the (0,0,0) position. 


To print a small square the G-code should look like this:


T0

G1 Z0.4 F4800; go to first layer height

G1 X10 Y10 F1200; 

G1 X-10 E1

G1 Y-10 E1

G1 X10 E1

G1 Y10 E1


This g-code will print a square 20mm to a side centered around (0,0) at 1200 mm/min (or 20mm/s) using printhead 1.




M Commands


Here is a list of commands that can be used in your g-code file. Other commands might be ignored by the software. Any parameters not valid for a command will also be ignored.


G-CodeParametersDescription
M400
Finish all moves
Pause until all commands up till this point are executed.
Extrusion and Pressure*
M750
Tn Pnnn
Extrude material3
Starts extruding material using a printhead. T specifies the printhead number (starts from 1) and P specifies the pressure (in kPa). If P is omitted, the currently set pressure for the active tool is used.4
M751Tn
Stop extruding material for a printhead.
M773Tn Pnnn
Set pressure of a printhead
T specifies the printhead and P specifies the pressure in kPa5.
Temperature
M771Tn Pnnn
Turns on printhead heating for all printheads.
Photocrosslinking and lighs
M805Tn Pnnn

T: Set Toolhead [(0-2) if running the photocrosslinking toolhead]  
[T3 = left module, T4 = right module].

P: Set LED intensity. The intensity is between 0 and 255. If set to 0, the UV module will be turned off. If set to 255, the UV module will be turned on.

M810Rnnn Ennn Bnnn Wnnn
Set the color of the chamber lights
The value is between 0 and 255. R is for Red, E is for Green (Emerald), B is for Blue and White is for White.
Electromagnetic Droplet Printhead
M2065Tn Snnn

Set open time in each valve on/off cycle. 

Since the EMD printhead controls the electromagnetic valve in a cyclic fashion, the valve open time in each cycle defines the amount of ink that will be dispensed. 

T value defines the EMD printhead mount (0,1,2)

S value defines the valve open time in each cycle in microseconds.  

M2067Tn Snnn

Set cycle time (period). Defines frequency.

T value defines the EMD printhead mount (0,1,2).

S value defines cycle time in  micoseconds. Period is 1/Frequency.  

M750
Tx Py Dz
Extrude from printhead ‘x’ at pressure ‘y’.  Dispense time ‘z’ (in milliseconds).
Syringe Pump Printhead
M2032Tn Sy

Set a printhead extrusion rate.

T value defines the syringe printhead mount (0,1,2). 

S value defines extrusion rate in nanoliters/second. 

M2045Tn E/R

Set the syringe move to either extrude or retract direction

T value defines the syringe printhead mount (0,1,2). 

E sets the motor direction to extrude; R sets the motor direction to retract. 

M2047Tn E/REither fully extrude or fully retract the syringe

T value defines the syringe printhead mount (0,1,2). 

E sets the motor direction to extrude; R sets the motor direction to retract. 

M2051Tn Vnnn

T value defines the syringe printhead mount (0,1,2).

V value defines the volume printhead will extrude in nanoliters. 

HD Camera Toolhead
C0filename.pngC0 takes an image using the HD Camera Toolhead. Follow with a code like “filename.png” to save the image with a specific file name.
Other commands
M823Pnnn
Safe park in a position
Puts the gantry in a built-in absolute position. Value can 1-3.6



3 It is highly recommended that an M750 command is followed by an M751 command for the same printhead before an M750 command for another printhead is sent.
4 It is recommended to set the pressure (using M773) and activate the wanted printhead using the T command before attempting to extrude with this command.

5 If a printhead does not use pressure, this command does nothing.
Position 1 moves the bed down and puts the gantry in the back. Position 2 moves the gantry out of the way and the bed up (used for UV sterilization). Position 3 moves the bed to the bottom and the gantry to the center.
7 The probe can not be used for printing

* The BIO X GUI can help you set a pressure without the need to include these commands in your g-code.


3. Insert end commands


End your G-code with the following commands:


G1 Z30; lower printbed 

M84; disable motors


Different file formats


The BIO X can handle several g-code file formats, .gcode and pp.gcode (or .stl.gcode). The pp.gcode is a processed file and is what the printer will execute, a .gcode file will be further processed and outputted as a .pp.gcode file before being executed.


A .pp.gcode file allows more control when crafting code as it will not be altered. A .gcode file, on the other hand, offers some more convenience like being able to set speed and UV curing in the GUI.


There is one key difference between the two formats: the numbering of printheads.


In pp.gcode mode printheads are numbered [1,5], where T4 and T5 are UV curing modules left and right.


In .gcode mode printheads are numbered [0,2].


NOTE: Using pp.gcode or stl.gcode files can result in damage to the bioprinter. Please contact support@cellink.com if you need assistance with g-code programming.