Write your own gcode spraying script

home Forums iMatrixSpray Software Write your own gcode spraying script

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #275
    Markus Stoeckli

    The fastest way to get started with your own spaying script is to use existing code and to modify it. The iMatrixSpray has two boards inside: a Raspberry Pi board which is programmed to run the web server and to assemble the code (gcode format) which is then send to a second board for execution on the hardware. This process of downloading the gcode to the 2nd board is also what you see on the left side of the user interface once you start the spray.

    Obviously, you could modify the web server code to fit your specific needs. Much simpler and faster is to generate a gcode file on your computer and upload this to the device for execution. You may test this process by using you favorite text editor to generate a file with some name .gcode (e.g. “helloworld.gcode”). Place some code into the file, e.g.


    and upload the file to the raspberry pi by dragging it on the web interface. Now you can select and execute this file.

    To get a “real” spray protocol, I recommend to start by modifying the existing Python script which is used to generate the gcode file. It can be found here: https://github.com/stoeckli/iMatrixSpray/blob/master/octoprint/server.py

    Some constants are a the top (lines 43) and the spray code starts at line 344. Extract the code into your favorite Python development environment and start modifying the program to generate a file to your needs.

    A word of caution: use water to test the spay, as the matrix solution might clog you capillary if you don’t wash it properly after the spray… Also, you might want to detach the spay head from the moving parts if you test some fun stuff.


    Good afternoon Markus,

    How can you modify the default/standard method and then recreate the gcode?

    We are currently able to open the python script of the default method, edit the parameters but then not export back into the gcode for use with the software?

    Is there a simple way to achieve this?

    Kind regards,

    Manuel Galli

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.