{ "info": { "author": "Nikolay Khabarov", "author_email": "2xl@mail.ru", "bugtrack_url": null, "classifiers": [], "description": "|Build Status|\n\n.. figure:: https://cloud.githubusercontent.com/assets/8740775/26766365/14796b54-4999-11e7-8ca2-9428a45878ab.png\n :alt: \n\nPyCNC is a free open-source high-performance G-code interpreter and\nCNC/3D-printer controller. It can run on a variety of Linux-powered\nARM-based boards, such as Raspberry Pi, Odroid, Beaglebone and others.\nThis gives you a flexibility to pick a board you are most familiar with,\nand use everything Linux has to offer, while keeping all your G-code\nruntime on the same board without a need to have a separate\nmicrocontroller for real-time operation. Our choice of Python as main\nprogramming language significantly reduces code base compared to C/C++\nprojects, reduces boilerplate and microcontroller-specific code, and\nmakes the project accessible to a broader audience to tinker with.\n\nRealtime Motor Control in Linux?\n================================\n\n| Typically there is no way to control stepper motors from Linux runtime\n environment due to the lack of real time GPIO control. Even kernel\n based modules can not guarantee precise control of pulses for\n steppers. However, we can use a separate hardware module, DMA (Direct\n Memory Access) which provides high precision for GPIO outputs. This\n module can copy bytes which represent GPIO states from RAM buffer\n directly to GPIO with some clock based on main chip internal\n oscillator without using CPU's cores. Using such approach this project\n generates impulses for moving stepper motors and that is very precise\n way regardless CPU load and OS time jitter.\n| This approach also allows to use Python language for this project.\n Typically, Python is not good choice for real time application, but\n since project just needs to set up DMA buffers and hardware will do\n the rest, Python become the perfect choice for easy development of\n this project.\n\n| Video demo - `YouTube video `__\n| And the original video when PyCNC was just a prototype `YouTube\n video `__\n\nCurrent gcode and features support\n==================================\n\n- Commands G0, G1, G2, G3, G4, G17, G18, G19, G20, G21, G28, G53, G90,\n G91, G92, M2, M3, M5, M30, M84, M104, M105, M106, M107, M109, M114,\n M140, M190 are supported. Commands can be easily added, see\n `gmachine.py <./cnc/gmachine.py>`__ file.\n- Four axis are supported - X, Y, Z, E.\n- Circular interpolation for XY, ZX, YZ planes is supported.\n- Spindle with rpm control is supported.\n- Extruder and bed heaters are supported.\n- Hardware watchdog.\n\nWatchdog\n========\n\nPyCNC uses one of DMA channels as hardware watchdog for safety purpose.\nIf board, OS or PyCNC hangs this watchdog should disable all GPIO\npins(by switching them into input state, for RPi this would be GPIO0-29)\nin 15 seconds. Since there is a high current and dangerous devices like\nheated bed, extruder heater, this feature should prevent uncontrollable\noverheating. But don't count on such software features too much, they\ncan hang too or output MOSFET become shorted, use hardware protection\nlike thermal cutoff switches in your machines.\n\nHardware\n========\n\n| Currently, this project supports Raspberry Pi 1-3. Developed and\n tested with RPI3. And there is a way to add new boards. See\n `hal.py <./cnc/hal.py>`__ file.\n| *Note: Current Raspberry Pi implementation uses the same resources as\n on board 3.5 mm jack(PWM module), so do not use it. HDMI audio works.*\n\nConfig\n======\n\n| All configs are stored in `config.py <./cnc/config.py>`__ and contain\n hardware properties, limitations and pin names for hardware control.\n| Raspberry Pi implementation should be connected to A4988, DRV8825 or\n any other stepper motor drivers with DIR and STEP pin inputs. Default\n config is created for Raspberry Pi 2-3 and this wiring config:\n\n+-------------------+----------------+----------------------------+-------------------+\n| Circuit name | RPi pin name | RAMPSv1.4 board pin name | Note |\n+===================+================+============================+===================+\n| X step | GPIO21 | A0 | |\n+-------------------+----------------+----------------------------+-------------------+\n| X dir | GPIO20 | A1 | |\n+-------------------+----------------+----------------------------+-------------------+\n| steppers enable | GPIO26 | A2, A8, D24, D34, D38 | all steppers |\n+-------------------+----------------+----------------------------+-------------------+\n| Y step | GPIO16 | A6 | |\n+-------------------+----------------+----------------------------+-------------------+\n| Y dir | GPIO19 | A7 | |\n+-------------------+----------------+----------------------------+-------------------+\n| Z dir | GPIO13 | D48 | |\n+-------------------+----------------+----------------------------+-------------------+\n| Z step | GPIO12 | D46 | |\n+-------------------+----------------+----------------------------+-------------------+\n| E1 step | GPIO6 | D36 | reserve |\n+-------------------+----------------+----------------------------+-------------------+\n| E1 dir | GPIO5 | D34 | reserve |\n+-------------------+----------------+----------------------------+-------------------+\n| E0 dir | GPIO7 | D28 | |\n+-------------------+----------------+----------------------------+-------------------+\n| E0 step | GPIO8 | D26 | |\n+-------------------+----------------+----------------------------+-------------------+\n| Z max | GPIO11 | D19 | |\n+-------------------+----------------+----------------------------+-------------------+\n| Z min | GPIO25 | D18 | |\n+-------------------+----------------+----------------------------+-------------------+\n| Y max | GPIO9 | D15 | |\n+-------------------+----------------+----------------------------+-------------------+\n| Y min | GPIO10 | D14 | |\n+-------------------+----------------+----------------------------+-------------------+\n| X max | GPIO24 | D2 | |\n+-------------------+----------------+----------------------------+-------------------+\n| X min | GPIO23 | D3 | |\n+-------------------+----------------+----------------------------+-------------------+\n| heater bed | GPIO22 | D8 | |\n+-------------------+----------------+----------------------------+-------------------+\n| heater 2 | GPIO27 | D9 | uses for fan |\n+-------------------+----------------+----------------------------+-------------------+\n| heater 1 | GPIO18 | D10 | |\n+-------------------+----------------+----------------------------+-------------------+\n| ser 1 | GPIO17 | D11 | reserve |\n+-------------------+----------------+----------------------------+-------------------+\n| ser 2 | GPIO15 | D6 | reserve |\n+-------------------+----------------+----------------------------+-------------------+\n| ser 3 | GPIO4 | D5 | reserve |\n+-------------------+----------------+----------------------------+-------------------+\n| ser 4 | GPIO14 | D4 | reserve |\n+-------------------+----------------+----------------------------+-------------------+\n| I2C SCL | GPIO3 | - | to ads111x |\n+-------------------+----------------+----------------------------+-------------------+\n| I2C SDA | GPIO2 | - | to ads111x |\n+-------------------+----------------+----------------------------+-------------------+\n| ads1115 ch0 | - | A15 | heater 2 - nc |\n+-------------------+----------------+----------------------------+-------------------+\n| ads1115 ch1 | - | A14 | bed sensor |\n+-------------------+----------------+----------------------------+-------------------+\n| ads1115 ch2 | - | A13 | extruder sensor |\n+-------------------+----------------+----------------------------+-------------------+\n| ads1115 ch3 | - | - | not connected |\n+-------------------+----------------+----------------------------+-------------------+\n\n| So having Raspberry Pi connected this way, there is no need to\n configure pin map for project. `RAMPS\n v1.4 `__ board can be used for this\n purpose. Full reference circuit diagram and photos of assembled\n controller(click to enlarge):\n| |circuit small| |sample front small| |sample back small| |sample\n mounted small|\n\nUsage\n=====\n\n| Just clone this repo and run ``./pycnc`` from repo root. It will start\n in interactive terminal mode where gcode commands can be entered\n manually.\n| To run file with gcode commands, just run ``./pycnc filename``.\n| Optionally, ``pycnc`` can be installed. Run\n\n.. code:: bash\n\n sudo pip install .\n\nin repo root directory to install it. After than, ``pycnc`` command will\nbe added to system path. To remove installation, just run:\n\n.. code:: bash\n\n sudo pip remove pycnc\n\nPerformance notice\n==================\n\n| Pure Python interpreter would not provide great performance for high\n speed machines. Overspeeding setting causes motors mispulses and\n probably lose of trajectory. According to my tests, Raspberry Pi 2 can\n handle axises with 400 pulses on mm with top velocity ~800 mm per min.\n There is always way out! :) Use JIT Python implementation like PyPy.\n RPi2 can handle up to 18000 mm per minute on the machine with 80 steps\n per millimeter motors with PyPy.\n| *Note: Raspbian has outdated PyPy version in repositories(v4.0).\n Moreover v4.0 has issue with ``mmap`` module implementation. Use PyPy\n v5.0+, download it for your OS from\n `here `__.*\n| PyPy installation:\n\n.. code:: bash\n\n wget wget https://bitbucket.org/pypy/pypy/downloads/pypy2-v5.7.1-linux-armhf-raspbian.tar.bz2\n sudo mkdir /opt/pypy\n sudo tar xvf pypy2-v5.7.1-linux-armhf-raspbian.tar.bz2 --directory /opt/pypy/ --strip-components=1\n sudo ln -s /opt/pypy/bin/pypy /usr/local/bin/pypy\n\nProject architecture\n====================\n\n.. figure:: https://user-images.githubusercontent.com/8740775/27770129-c8c3592c-5f41-11e7-8a9c-254d5a88ed77.png\n :alt: \n\nDependencies\n============\n\nNothing for runtime. Just pure Python code. For uploading to PyPi there\nis a need in ``pandoc``:\n\n.. code:: bash\n\n sudo dnf install pandoc\n sudo pip install pypandoc\n\nGCode simulation\n================\n\nJust a link, mostly for myself :), to a nice web software for gcode\nfiles emulation (very helpful for manual creating of gcode files):\nhttps://nraynaud.github.io/webgcode/\n\nLicense\n=======\n\nsee `LICENSE <./LICENSE>`__ file.\n\nAuthor\n======\n\nNikolay Khabarov\n\n.. |Build Status| image:: https://travis-ci.org/Nikolay-Kha/PyCNC.svg?branch=master\n :target: https://travis-ci.org/Nikolay-Kha/PyCNC\n.. |circuit small| image:: https://user-images.githubusercontent.com/8740775/28233810-40773186-6902-11e7-8496-5750babfcf44.jpg\n :target: https://user-images.githubusercontent.com/8740775/28233650-d64060e0-6900-11e7-8605-6475384fd2f7.png\n.. |sample front small| image:: https://user-images.githubusercontent.com/8740775/28233812-407820c8-6902-11e7-8de1-35c03509c0e5.jpg\n :target: https://user-images.githubusercontent.com/8740775/28233649-d6402800-6900-11e7-8dca-cd35c8292e0c.jpg\n.. |sample back small| image:: https://user-images.githubusercontent.com/8740775/28233879-db96ea1c-6902-11e7-9298-11150476084b.jpg\n :target: https://user-images.githubusercontent.com/8740775/28233648-d63fa0c4-6900-11e7-8fab-2055e035a6cb.jpg\n.. |sample mounted small| image:: https://user-images.githubusercontent.com/8740775/28233811-40777e8e-6902-11e7-8899-5991860d182c.jpg\n :target: https://user-images.githubusercontent.com/8740775/28233652-d65f82ea-6900-11e7-9e80-d8b0c9238f95.jpg\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Nikolay-Kha/PyCNC", "keywords": "CNC 3D printer robot raspberry pi", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pycnc", "package_url": "https://pypi.org/project/pycnc/", "platform": "", "project_url": "https://pypi.org/project/pycnc/", "project_urls": { "Homepage": "https://github.com/Nikolay-Kha/PyCNC" }, "release_url": "https://pypi.org/project/pycnc/1.1.0/", "requires_dist": null, "requires_python": "", "summary": "CNC machine controller", "version": "1.1.0" }, "last_serial": 3115830, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "7946f4d780ca661d114a0c48c6d4cf34", "sha256": "129eae8411060bdbca07a052c808a865085fdab70e10d0b1f2810a75c7334072" }, "downloads": -1, "filename": "pycnc-0.1.2.tar.gz", "has_sig": false, "md5_digest": "7946f4d780ca661d114a0c48c6d4cf34", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25299, "upload_time": "2017-05-14T14:59:33", "url": "https://files.pythonhosted.org/packages/9a/2a/b1baeda0625411fea053974111ed5accf824525b8b42e14f652de0c09390/pycnc-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "226fb1336e71fbfe3848841bc49cf276", "sha256": "1382373ba7a48ca51707fbcf0600631571660e0b6680b95f06d9d60551fa294a" }, "downloads": -1, "filename": "pycnc-0.1.3.tar.gz", "has_sig": false, "md5_digest": "226fb1336e71fbfe3848841bc49cf276", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 32946, "upload_time": "2017-06-11T23:45:35", "url": "https://files.pythonhosted.org/packages/52/13/9d80dd1ecd822cf041c10cf997e7cde80525e33500db1696a2fba7bf4e18/pycnc-0.1.3.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "ea88b6523d1e38e37c5d3dbd959ebfd3", "sha256": "c99319191781dc55f960d865bb334778633ecf69d5ab6e4a6a792286be3c7cf6" }, "downloads": -1, "filename": "pycnc-1.0.0.tar.gz", "has_sig": false, "md5_digest": "ea88b6523d1e38e37c5d3dbd959ebfd3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 41827, "upload_time": "2017-07-15T01:09:01", "url": "https://files.pythonhosted.org/packages/a2/05/2aba02f1fac84a8be2a7bbd789a081cf32634e35e2cb499693f9b694df8b/pycnc-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "32adb9756a474d6542b44dd77d2de348", "sha256": "3befcdb11548509e2f1e63b525caeea1cf3d8977a244b5e1671bb91cfd1db1e2" }, "downloads": -1, "filename": "pycnc-1.1.0.tar.gz", "has_sig": false, "md5_digest": "32adb9756a474d6542b44dd77d2de348", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 42944, "upload_time": "2017-08-22T21:47:54", "url": "https://files.pythonhosted.org/packages/39/dc/9bd405d6e8bdee246b836fb699dc7026da64f73dab51387bbcba229aa9c7/pycnc-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "32adb9756a474d6542b44dd77d2de348", "sha256": "3befcdb11548509e2f1e63b525caeea1cf3d8977a244b5e1671bb91cfd1db1e2" }, "downloads": -1, "filename": "pycnc-1.1.0.tar.gz", "has_sig": false, "md5_digest": "32adb9756a474d6542b44dd77d2de348", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 42944, "upload_time": "2017-08-22T21:47:54", "url": "https://files.pythonhosted.org/packages/39/dc/9bd405d6e8bdee246b836fb699dc7026da64f73dab51387bbcba229aa9c7/pycnc-1.1.0.tar.gz" } ] }