Results 1 to 4 of 4
  1. #1

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

    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:

    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 -
    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.

  2. #2
    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 file - First 3D model was printed on this video:

    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.

  3. #3
    Hello Nikolay!Thank you for making this open source!I have replaced the main board of my Anet A8 printer.After many issues I have finally got to a point where all the motors work as well as heating and sensors.However I am unable to print due to the motors seem to run too much. When I execute `x5` it moves more than 5 cm. How can I figure out what values should go to the config of PyCNC? I use Cura, maybe a different slicer/gcode format needs to be chosen? Thanks!!

  4. #4
    Hello haxpanel,With x5 command axis shall move 5mm, not cm. Check your STEPPER_PULSES_PER_MM_ config, most probably you've chosen incorrect value for them.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts