First ever CNC machine controller implementation on pure Python
CNC machine controllers are typically implemented using the C or C++ programming language and running on OS-less or real time operating systems with simple microcontrollers.
I will describe how to build a CNC controller, a 3D printer in particular, using modern ARM boards — Raspberry Pi with a modern high level language — Python. Such a modern approach opens a wide range of integration options with other cutting edge technologies, solutions, and infrastructures, which makes the whole project developer friendly.
About the Project
Modern ARM boards typically use Linux as a reference operating system. This gives us the entire Linux infrastructure with all the Linux software packages. We can host a web server on a board, use a Bluetooth connectivity, use OpenCV for image recognition, build a cluster of boards, etc. These are well-known tasks that can be implemented on ARM boards, and they can be really useful for custom CNC machines. For example, auto positioning using compuvision can be very handy for some machines.
Linux is not a real time operating system. So, we can’t generate pulses with the required timings to control stepper motors directly from the board pins with running software, even as a kernel module. Then, how can we use steppers and high-level Linux features?
Obviously, we can use two chips — one microcontroller with a classic CNC implementation; and an ARM board connected to this microcontroller via UART. What if there are no suitable firmware features for this microcontroller? What if we need to control additional axes that are not implemented in the microcontroller?
Any modifications to the existing C/C++ firmware will require plenty of development time and efforts. Let’s see if we can make it easier and even save money on microcontrollers by simply removing them.
Want all the latest advances and tech news sent directly to your inbox?
Powered by WPeMatico
Gurupriyan is a Software Engineer and a technology enthusiast, he’s been working on the field for the last 6 years. Currently focusing on mobile app development and IoT.