Close

Everything in GCODE

A project log for CIJ Printer

An Open Source Continuous Inkjet Printer

dominik-meffertDominik Meffert 04/09/2021 at 12:390 Comments

I just figured out how to send messages to the CIJ printer from the 3D printer controller, so that it can be completely controlled by GCODE. 

For doing so I used the i2c feature of the Marlin firmware to send the messages to an Arduino NANO which then sends the messages via serial to the MAX3232 and so to the CIJ printer.

On the Arduino NANO I used the code from the Arduino i2c slave receiver example:

#include <Wire.h>
void setup()
{
  Wire.begin(9);
  Wire.onReceive(receiveEvent);
  Serial.begin(9600);
}

void loop()
{
  delay(100);
}

void receiveEvent(int howMany)
{
  while (Wire.available())
  {
    Serial.write(Wire.read());
  }
}

Here is the gcode that I used:

(with a small change to print only 3 lines)

G28
M260 A9
M260 B84     ;T
M260 B104    ;h
M260 B105    ;i
M260 B115    ;s
M260 B32     ;Space
M260 B77     ;M
M260 B101    ;e
M260 B115    ;s
M260 B115    ;s
M260 B97     ;a
M260 B103    ;g
M260 B101    ;e
M260 B13     ;CR
M260 S1        
G1 X30.000 Y200.000 F2000
M106 P1 S255        
G1 X80.000 Y200.000 F2000
M106 P1 S0

M260 A9
M260 B119    ;w
M260 B97     ;a
M260 B115    ;s
M260 B32     ;Space
M260 B115    ;s
M260 B101    ;e
M260 B110    ;n
M260 B116    ;t
M260 B13     ;CR
M260 S1
G1 X30.000 Y185.000 F2000
M106 P1 S255
G1 X80.000 Y185.000 F2000
M106 P1 S0

M260 A9
M260 B119    ;w
M260 B105    ;i
M260 B116    ;t
M260 B104    ;h
M260 B32     ;Space
M260 B71     ;G
M260 B67     ;C
M260 B79     ;O
M260 B68     ;D
M260 B69     ;E
M260 B13     ;CR
M260 S1
G1 X30.000 Y170.000 F2000
M106 P1 S255
G1 X80.000 Y170.000 F2000
M106 P1 S0
G1 X150.000 Y170.000 F2000

So, now that this works the next thing would be writing a python script to create the GCODE for longer messages.

Discussions