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


BIO X (Build 1)BIO X (Build 2)
Refer to this articleRefer to the "G-code guide for the BIO X (Build 2)" article


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. Giving 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. 


The G-code pre-structure should contain the following commands: 


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


2. Developing the code structure


There are three main types of G-code commands:


  • T commands define the tool to be used, either the printheads or the photocuring modules.
  • G commands refer to positioning control.
  • M commands are advanced function command

 

2.a. T commands


CommandParametersDescription
T
{0-2 / 10-11}
Changing tools
  • Printheads: 0-1-2 (from left to right).
  • Photocuring modules: 10-11 (from left to right).

2.b. G commands


The coordinate system of the BIO X is centered on the calibration position. The latter corresponding to the (X0,Y0,Z0) position.


CommandParametersDescription
G0
Xnnn Ynnn Znnn Fnnn
Absolute travel move command
  • X, Y, Z parameters define the arrival point of the tool. The parameters are expressed in millimeters.
  • F parameter is the translation speed expressed in mm/min. If F parameter is absent, the latest F set value will be used.
G1Xnnn Ynnn Znnn Ennn Fnnn
Absolute move command
  • X, Y, Z parameters define the arrival point of the tool. The parameters are expressed in millimeters.
  • E parameter controls extrusion. If E>0, material will be extruded. If E=0 or E<0 or E parameter is absent, the system will not extrude material.
  • F parameter is the translation speed expressed in mm/min. If F parameter is absent, the latest F set value will be used.
G4Snnn Pnnn
Pause command
  • S parameter is expressed in seconds
  • P parameter is expressed in milliseconds 
G7Xnnn Ynnn Znnn Ennn FnnnRelative move command
Note: This commands works the same as G1 but uses relative moves instead. 
  • X, Y, Z parameters define the tool's movement length from the current position. The parameters are expressed in millimeters.
  • E parameter controls extrusion. If E>0, material will be extruded. If E=0 or E<0 or E parameter is absent, the system will not extrude material.
  • F parameter is the translation speed expressed in mm/min. If F parameter is absent, the latest F set value will be used.
G92Xnnn Ynnn ZnnnSet position
  • Set the current position to X, Y and Z parameters. If no parameters are given, the position is assumed to be (X0,Y0,Z0).


2.c. M Commands


The following list of commands can be used in G-code files for the BIO X. Unknown commands or incorrect parameters might be ignored by the software.


  • Extrusion and pressure


Pneumatic, temperature-controlled and thermoplastic printheads are concerned by the following commands. 

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


CommandParametersDescription
M750 
Tn Pnnn 
Start material extrusion
Note: This is a dual command, the machine sets the pressure and extrudes material. If P parameter is omitted, the currently set pressure for the active tool is used.
  • T parameter indicates which printhead is concerned. Accepted values are 0, 1 or 2.
  • P specifies the set pressure in kPa. If a printhead is not pressure-based, this command does nothing.
M751 
Tn 
Stop material extrusion
Note: It is recommended that an M750 command is followed by an M751command for the same printhead before an M750 command for another printhead is sent. 
  • Printhead T(0-1-2) will stop extruding 
M773 
Tn Pnnn 
Set printhead pressure
Note:  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. Unlike command M750, M773 does not trigger extrusion.
  • T parameter indicates which printhead is concerned. Accepted values are 0, 1 or 2.
  • P specifies the set pressure in kPa. If a printhead is not pressure-based, this command does nothing. 


  • Temperature


CommandParametersDescription
M771
Tn Pnnn
Turn on printhead temperature control
  • T parameter indicates which printhead is concerned. Accepted values are 0, 1 or 2.
  • P specifies the set temperature in degree Celsius. Accepted values are dependent on the printhead type. 
    • Pneumatic printheads: 30°C to 65°C
    • Temperature-controlled printhead: 4°C to 65°C
    • Thermoplastic printhead: 50°C to 250°C
    • EMD printhead: 30°C to 65°C 
    • Syringe pump printhead: 30°C to 65°C 
M801SnnnTurns on the printbed temperature control
  • S parameter indicates the printbed temperature in degree Celsius. Accepted values are between 4°C to 65°C.
M800-Turns off the printbed temperature control


  • Photocrosslinking and lights


CommandParametersDescription
M805
Tn Pnnn

Turn on/off photocuring modules

  • T parameter indicates which printhead or module is concerned. 
    • If photocuring toolheads are used, accepted values are 0, 1 and 2.
    • If built-in photocuring modules are employed, accepted values are 10 (left module) and 11 (right module).
  • P parameter sets the LED intensity between 0 and 255.
    • LED will be turned off for P0.
    • LED will be turned on for P255
M810Rnnn Ennn Bnnn WnnnSet the color of the chamber lights
  • R, E, B, N respectively stand for red, green, blue and white. Accepted values are between 0 and 255. 


  • Electromagnetic droplet (EMD) printhead


CommandParametersDescription
M2065
Tn Snnn

Set open time

Note: EMD printhead controls an electromagnetic valve in a cyclic fashion. The valve open time in each cycle defines the amount of ink that will be dispensed. 

  • T parameter indicates which toolhead slot is equipped with an EMD printhead. Accepted values are 0, 1 or 2.
  • S value defines the valve open time in each cycle, it is expressed in microseconds.  
M2067Tn SnnnSet cycle time

Note: The cycle time (period) defines the dispensing frequency (= 1/period)

  • T parameter indicates which toolhead slot is equipped with an EMD printhead. Accepted values are 0, 1 or 2.
  • S value defines the cycle time in microsecond.
M750Tx Py DzSetting up a continuous extrusion
Note: This commands prompts the instrument to extrude material from printhead "x" at pressure "y" during "z" milliseconds.
  • T parameter indicates which toolhead slot is equipped with an EMD printhead. Accepted values are 0, 1 or 2.
  • P is the pressure value in kPa.
  • D parameter is the dispensing time expressed in milliseconds.


  • Syringe pump printhead


CommandParametersDescription
M2032Tn Sy

Set extrusion rate

  • T parameter indicates which toolhead slot is equipped with an syringe pump printhead. Accepted values are 0, 1 or 2.
  • S value defines extrusion rate in nanoliters/second.
M2045Tn E/R

Set syringe move direction

Note: Sets the syringe move to either extrude or retract direction.

  • T parameter indicates which toolhead slot is equipped with an syringe pump printhead. Accepted values are 0, 1 or 2. 
  • E sets the motor direction to extrude and R sets the motor direction to retract.
M2047Tn E/RFull extrusion/retraction
Note: Either fully extrude or fully retract the syringe.
  • T parameter indicates which toolhead slot is equipped with an syringe pump printhead. Accepted values are 0, 1 or 2. 
  • E sets the motor direction to extrude and R sets the motor direction to retract.
M2051Tn Vnnn

Volumetric control of extrusion

  • T parameter indicates which toolhead slot is equipped with an syringe pump printhead. Accepted values are 0, 1 or 2. 
  • V parameter defines the volume extruded by the printhead. It is expressed in nanoliters.


  • HD camera toolhead


CommandParametersDescription
C0 
filename.png
Acquiring an image
Note: C0 command 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


CommandParametersDescription
M400
-
Finish all moves
Note: Pauses until all commands up till this point are executed.

M823PnnnSafe park in a position
  • Puts the gantry in a built-in absolute position. Accepted value can 1, 2 and 3.
    • 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 

3. Insert end commands


End your G-code with the following commands:


>>> G1 Z30; lower printbed 
>>> M84; disable motors


4. G-code example


The following code prints a small square (20 mm x 20 mm) centered around (X0;Y0) at 1200 mm/min using printhead 1:

>>>G90;
>>>G21; 
>>>>M83; 

>>>T0;
>>>G1 Z0.4 F4800;
>>>G1 X10 Y10 F1200;
>>>G1 X-10 E1;
>>>G1 Y-10 E1;
>>>G1 X10 E1;
>>>G1 Y10 E1;

>>>G1 Z30;
>>>M84;


5. 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,3].
  • 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.