CNC Making of – Control software (part 2)

Hi guys! I finally find some time to continue the blog 😄

Let’s go back to where we started… now let’s get a little more deep into the software. I’ll try to explain how the CNC works.

CNC Settings

After starting the program, the machine must be initialized, so the following settings must be set:

  1. Image size in mm;
  2. DPI (image resolution);
  3. Actual image width in mm;
  4. Probe thickness in mm;
  5. First step depth (default 0.1 for PCB);
  6. Depth of each step (default 0.02 for PCB);
  7. Total depth (default 0.2 for PCB);
  8. Transfer height (default 15);
  9. Diameter of the tip to be used.

Excluding the first three points and the 9th which are quite easy, let’s see the other settings in detail:

  • Probe thickness: is the thickness of the metal probe that is used as a sensor for the automatic levelling of the CNC with respect to the worktable;
  • First step depth: initial depth of the tip. This value should also be set according to the material you’re using to work, and sometimes the initial step is not the same as the next steps;
  • Depth at every step: depth of the tip in the steps following the first;
  • Total depth: total depth that the tip must reach to complete the machining;
  • Transfer height: is the height at which the tip must be found to transfer from one point to another of the piece when not working.

Program output

After setting all the required data the machine starts to load the image chosen at the program start and then begins to engrave it on the material (at the moment the CNC works on wood, copper and Plexiglas).

Current position X=0,000mm Y=0,000mm Z=0,000mm
Place probe for depth detection and press ENTER.
Step=0,00500
(0,000, 0,000, 0,000)
(0,000, 0,000, -15,000)
Place the tip and press INVIO.
Current position X=0,000mm Y=20,000mm Z=0,000mm
Place probe for depth detection and press ENTER.
Step=0,00500
(0,000, 20,000, 0,000)
(0,000, 20,000, -15,000)
Place the tip and press INVIO.
Current position X=20,000mm Y=20,000mm Z=0,000mm
Place probe for depth detection and press ENTER.
Step=0,00500
(20,000, 20,000, 0,000)
(20,000, 20,000, -15,000)
[ (-0,0500, 0,0500), (0,0500, 0,0000) ]

Matrix creation in progress…
Press ENTER to start processing…
PRESS THE 'S' KEY TO FINISH PROCESSING

This is the output that appears just before starting the CNC and indicates the self-levelling procedure of the worktable.

Image processing algorithm

The algorithm that allows to process the image assigns to each pixel of the figure a number, which refers to the “steps” made until that moment by the tip.
While the CNC engraves/draw the image, the progress of the work appears on the screen:

The green pixels are those already engraved and the red one indicates the next pixel that will be processed.

It may seem a simple algorithm but there are many things to consider and that make it more complex:

  • Optimize machine movements by finding the most efficient pixel path;
  • Optimize the control of the motors, make their movement smoother without making them “snap” when creating the image to avoid further vibrations;
  • Since the machine is handmade, it has some imperfections on the alignment of the parts that compose it, on the squaring of the axes and on the levelling of the working table. So I tried to solve/reduce these structural problems through the control software.

This video shows exactly what happens while the machine analyzes the image and draws it:

Conclusions

The program is not finished yet, there are always improvements to be made but I am satisfied with the result.

Now what I would like to try is to compare my program with one of those available for Arduino so I can analyze how it works and see how I can improve mine. 🙂

Stay tuned! 👋👋👋