CNC Controller in Python

Projects CNC Controller in Python

Supporting legacy technologies and hardware is always expensive and time consuming. Using modern architectures and popular languages like Python disrupts the whole industry allowing it to drastically shorten the time to market and decrease proof-of-concept efforts. As the result, it reduces the learning curve of CNC in general.

Moreover, using modern tools opens a wide range of integration options with other cutting edge technologies, solutions, and infrastructures making the whole market more customer centric.

The solution uses DMA (Direct Memory Access) on the chip hardware module that just copies the buffer of GPIO states allocated in the RAM to the actual GPIO registers. And this copying process is clocked by the system clock and works completely independently from the CPU cores. So, the sequence of pulses for axis stepper motors are generated in the memory, and then DMA sends them precisely.

As for access to the processor registers, it's implemented with the /dev/mem system device. It can be developed with different languages, but Python is a very simple language that provides a great development experience. Of course, Python’s performance is not that good, but on the other hand, modern ARMv7 processor performance is more than enough to run it.

The video below demonstrates the developed with Python solution running on Raspberry Pi 2 with Linux.


Read more about the case study here.

The source code is available here: