Connection to custom linear axis via TCP-interception is possible

Hey!

Just wanted to share my current approach to control external axis and collect some opinions.

I’m using the xTool F1 with the slider table to quickly exchange blanks or engrave larger designs. To achieve that, I attached my own stepper controller to the slider-motor and used an arduino to send step/dir commands (with a small Gcode interpreter on the arduino). I also soldered two wires to the rotation knob that controls the lift so the arduino can also move the z-axis up and down.

Now for the fun part:
Lightburn sends gcode commands on a TCP-connection so I implemented a ‘man-in-the-middle-attack’ by creating a small python-script that connects to the TCP-port of the laser and opens a local TCP-port to which Lightburn connects (just had to change the IP/Port in the lbdev-file). Every message in both directions is simply forwarded, but I now can filter everything. So in case a “G91 G1 Z10 F600 S0” comes from LB (aka ‘move Z up by 10mm’), I can send this command on a serial connection to my arduino which then moves the z-axis. The F1 simply ignores that command, so I don’t even have to suppress it.

There is of course no way to let the laser wait for the execution of such a command so I don’t think controlling a rotation unit would work with that approach, but for Repeat Marking it should be ok. (You could try to buffer the next commands and only send them to the laser after a motion is completed, but I haven’t checked if/when Lightburn triggers a timeout if no ‘ok’ comes back from the laser in time.

This also allows me to switch between the diode and IR laser on the F1. To switch to IR, a gcode has to be send to the laser. Now I can tell my man-in-the-middle to just add this command to the gcode-stream.

So if this approach could solve one of your issues, I’d be happy to share a bit of code (so far, it’s just a minimal poc).

Cheers!

@Kurtzy @Albroswift mention that you could be interested in this

3 Likes

Sounds like an interesting project. I’d like to see how you did it :slight_smile: It’s more for educational purposes, I don’t own an F1 :slight_smile:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.