CNC machine controller
PyCNC is a free open-source high-performance G-code interpreter and CNC/3D-printer controller. It can run on a variety of Linux-powered ARM-based boards, such as Raspberry Pi, Odroid, Beaglebone and others. This gives you a flexibility to pick a board you are most familiar with, and use everything Linux has to offer, while keeping all your G-code runtime on the same board without a need to have a separate microcontroller for real-time operation. Our choice of Python as main programming language significantly reduces code base compared to C/C++ projects, reduces boilerplate and microcontroller-specific code, and makes the project accessible to a broader audience to tinker with.
Realtime Motor Control in Linux?
Current gcode and features support
- Commands G0, G1, G2, G3, G4, G17, G18, G19, G20, G21, G28, G53, G90, G91, G92, M2, M3, M5, M30, M84, M104, M105, M106, M107, M109, M114, M140, M190 are supported. Commands can be easily added, see gmachine.py file.
- Four axis are supported - X, Y, Z, E.
- Circular interpolation for XY, ZX, YZ planes is supported.
- Spindle with rpm control is supported.
- Extruder and bed heaters are supported.
- Hardware watchdog.
PyCNC uses one of DMA channels as hardware watchdog for safety purpose. If board, OS or PyCNC hangs this watchdog should disable all GPIO pins(by switching them into input state, for RPi this would be GPIO0-29) in 15 seconds. Since there is a high current and dangerous devices like heated bed, extruder heater, this feature should prevent uncontrollable overheating. But don’t count on such software features too much, they can hang too or output MOSFET become shorted, use hardware protection like thermal cutoff switches in your machines.
|Circuit name||RPi pin name||RAMPSv1.4 board pin name||Note|
|steppers enable||GPIO26||A2, A8, D24, D34, D38||all steppers|
|heater 2||GPIO27||D9||uses for fan|
|I2C SCL||GPIO3||to ads111x|
|I2C SDA||GPIO2||to ads111x|
|ads1115 ch0||A15||heater 2 - nc|
|ads1115 ch1||A14||bed sensor|
|ads1115 ch2||A13||extruder sensor|
|ads1115 ch3||not connected|
sudo pip install .
in repo root directory to install it. After than, pycnc command will be added to system path. To remove installation, just run:
sudo pip remove pycnc
wget wget https://bitbucket.org/pypy/pypy/downloads/pypy2-v5.7.1-linux-armhf-raspbian.tar.bz2 sudo mkdir /opt/pypy sudo tar xvf pypy2-v5.7.1-linux-armhf-raspbian.tar.bz2 --directory /opt/pypy/ --strip-components=1 sudo ln -s /opt/pypy/bin/pypy /usr/local/bin/pypy
Nothing for runtime. Just pure Python code. For uploading to PyPi there is a need in pandoc:
sudo dnf install pandoc sudo pip install pypandoc
Just a link, mostly for myself :), to a nice web software for gcode files emulation (very helpful for manual creating of gcode files): https://nraynaud.github.io/webgcode/
see LICENSE file.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size pycnc-1.1.0.tar.gz (42.9 kB)||File type Source||Python version None||Upload date||Hashes View hashes|