Fighting with computers

Computers are not always friendly.

Tuesday, September 15, 2015

How to do a CNC milling farm.

One of my current projects requires to run two, maybe more in the near future, DIY CNC machines. Machine controller is USB-based and a PC could be used to send g-code to machine controller.
However, we have tried a different approach that proved successful: using a cheap tablet instead of a PC.

It all started by testing the excellent program GCodePrintr by Mathias Dietz. This software is designed so people can use a 3D printer directly from a tablet. You can stream a g-code file for printing to the printer plus you can do all the usual manual functions of moving the axis around. Besides, a graphical simulation of the print is represented on the display. And in the few tests I did, printing speed did not seemed to be compromised because the lower tablet performance (compared to a PC).

However, uploading a file from Dropbox or using some FTP app for sending g-code files to the tablet was not very convenient as required user time spent at the tablet. But one feature of GCodePrintr came to the rescue: There is a Network Receive feature you can use to send a g-code file to the app. It needs to be enabled in the program configuration and it uses TCP port 53232. Once that feature is enabled you can send your file to the app and in a few seconds it can be received via wifi.

That was almost all we needed. However, the app will show a dialog box after receiving a file from the network asking the user whether they want to start streaming the file to the printer right away. That was a problem because still some user action was needed at each tablet. I suggested the developer that a welcome feature would be to add some special data to g-code file so the user intervention could be removed at will. Fortunately for me, that was something it was already taken care of in the software. I just needed to send some magic bytes before my g-code file for triggering the automatic start feature (now without user intervention).

So what was left was to create a simple way for the operator to send files to our two machines. Operator was using a Windows computer (not my choice though). So I created a couple of bat files on the desktop in such a way that operator will drop the desired g-code file on the desired machine's .bat file (named after the machine).

What each .bat file does is to send the file contents using ncat software (netcat did not work reliably for us) and it inserts a new record in a sqlite3 database to keep track of each one of the files being processed for accounting purposes.

So now the operator just replaces the stock material on each machine and drags a new file onto the machine icon to get a new job started. Database registers the start time-stamp of each job so a good estimate of each job duration can be obtained.

Initially the program, being designed for 3D printing, did not allow "bed" sizes large enough for our needs nor it will properly draw G0/G1 non-extruding moves. However all this has been fixed as the developer has been very receptive to these suggestions for this new use case of the app.

A similar solution could have been done using Raspberry Pi using Octoprint but without an additional keyboard and local display the manual operations, when needed, could not easily be done locally.

Please note that a 3D printing farm could use the exact same approach, just connecting a 3D printer to the OTG USB adapter of each tablet.

Happy g-code streaming!

0 Comments:

Post a Comment

<< Home