CNC Making of – Control software (part 1)

Hi, guys! As announced in the last article today I will tell you a bit about the CNC program developed on Linux using the .NET Core libraries.

.NET Core

A small introduction on the subject: .NET Core has been created in order to be used on different operating systems, it’s open source and it’s modular, i.e. it allows to download and use only those libraries that can be considered necessary for their own purposes.

Visual Studio Code

So for me, who am a Linux developer, it was very convenient to be able to use C# to create my program. In addition, Microsoft has created a “reduced” version of Visual Studio that can also be used on non-Windows systems: Visual Studio Code. Through these tools it is therefore possible to write a portable program on different operating systems compatible with .NET Core.

Many people may wonder why I implemented a custom software and I didn’t use an existing one. The answer is simple: it served me to learn how things work, for example how to control a stepper motor or how to solve via software any mechanical imperfections of the machine. For this reason not only I didn’t use an existing software but I didn’t even use any library in general (for example WiringPi)!

Control software overview

Let’s move on to practical matters! 😁

At the moment the machine doesn’t support GCode format (for more information: http://passionecnc.altervista.org/showthread.php?tid=7) but it’s a feature that I would like to be able to implement in the future as it represents a standard in the world of numerical control machines whether CNC or 3D printers. So at the moment I only use images (.png, .jpg, etc…) to upload the projects to be realized on the machine.

The CNC program is a console program, without graphic interface (which can be implemented at a later date) that offers all the basic logic necessary to control the machine including:

  • the Raspberry GPIO control;
  • image processing;
  • allows you to choose the image processing mode (only the contour, the whole or the mode to make the holes);
  • in the future will also be added the possibility to choose the material to work on (wood, plastic, metals, etc.) by modifying the parameters of the CNC adapting them to the type of machining;
  • self-levelling of the tool with respect to the surface of the material to be machined;
  • control of the rotation speed of the drill motor.

As for the first point of the list, it must be said that the first experiments were done in Python because there are already native libraries that allow you to control the GPIO. I then implemented in C# a class that replicates the main Python commands related to GPIO.

As already said, the CNC program is not finished yet, but soon I hope to introduce many other features. At the moment however it contains enough functions to allow me to complete my first real project… 🤩

Translated with www.DeepL.com/Translator (free version)