Welcome! Log In Create A New Profile

Advanced

PyCNC - first CNC machine controller on pure Python for Raspberry Pi.

Posted by Nikolay-Kha 
PyCNC - first CNC machine controller on pure Python for Raspberry Pi.
May 14, 2017 03:00PM
Hello!
I'd like to present first ever CNC machine controller implementation on pure Python(even without dependencies or any C modules) for ARM based Linux boards. Hardware access layer(HAL) allows to implement support for almost any ARM SoC/CPU with suitable DMA module, but currently it is implemented for Raspberry Pi only. It already works on Raspberry Pi 2 and 3.

Typically, CNC machine controllers are implemented with C or C++ programming language and running on OSless or very real time operation systems. For example, Linux by default is not real time operation system and running LinuxCNC on it require to add special real time features to kernel. I believe that is very old approaches for building such controllers and it's high time to use modern ARM processors for CNC and use very high level programming languages like Python to provide easy development, flexibility and migration between hardware.

I managed to do this! First ever CNC controller implemented on pure Python on Raspberry Pi 2 running Linux, it's better to see, than read: [youtu.be]

How it works? It uses DMA(Direct Memory Access) on chip hardware module, which just copy allocated in RAM buffer of GPIO states to actual GPIO registers. And this copying process is clocked by system clock and works completely independently from CPU cores. So, I was needed just to generated pulses sequence for axis stepper motors in memory and DMA precisely sends it. As for access to processor registers, it's implemented with /dev/mem system device. That can be implemented with different languages, but Python is very simple language which provides better development experiences. Of course, Python performance is not good, but on the other hand, modern ARMv7 processor performance is more than enough to run it.

And the most pleasant part, I open sourced this project!
Project is here - [github.com]
There is a wiring diagram and running instructions in git repo.
It's just a begging of this project, currently, it supports just simple things - spindle control, linear interpolation and some basic gcode commands. I have plans in near feature to add round interpolation, 4th axis, temperature sensors, heaters support and implement fully functional 3D printer CNC controller.

Thank you for reading, hope it was interesting for you.
Re: PyCNC - first CNC machine controller on pure Python for Raspberry Pi.
May 21, 2017 02:45AM
Hi,

nice work ;-)
Re: PyCNC - first CNC machine controller on pure Python for Raspberry Pi.
May 21, 2017 06:14PM
Now PyCNC is compatible with HDMI monitors. So, PyCNC can be run directly from Raspberry Pi3 with mouse, keyboard and monitor: 
[youtu.be]
Also, I purchased a new frame — Chinese implementation of RepRap Prusa i3 in aluminum. Now I’m awaiting for delivery. 
As you may see, I’m going to implement full functional 3d printer with PyCNC, and RepRap Prusa i3 and Raspberry Pi3 will be reference devices for that.
Re: PyCNC - first CNC machine controller on pure Python for Raspberry Pi.
July 15, 2017 03:21AM
Hello!
Great news! PyCNC has full 3D printer implementation. Version 1.0.0 is released.
Also I made a hardware with RerRap Prusa i3, RAMPSv1.4 board and Raspberry Pi3. Circuit diagram and photos in repo's README.md file - [github.com]. First 3D model was printed on this video - [youtu.be]
Overall PyCNC supports:
- 4 axis - X, Y, Z, E;
- Linear interpolation;
- Circular(in XY, ZX, YZ planes) interpolation;
- Minimum end stops and homing procedure;
- Extruder and bed heaters;
- Spindle for engraving.

Edited 1 time(s). Last edit at 07/15/2017 03:29AM by Nikolay-Kha.
Sorry, only registered users may post in this forum.

Click here to login