{"id":15689682,"url":"https://github.com/gavinlyonsrepo/rpimotorlib","last_synced_at":"2025-04-04T13:12:58.818Z","repository":{"id":46700434,"uuid":"125781232","full_name":"gavinlyonsrepo/RpiMotorLib","owner":"gavinlyonsrepo","description":"A python 3 library to connect various motor systems to a raspberry pi single board computer","archived":false,"fork":false,"pushed_at":"2024-03-28T13:52:21.000Z","size":1983,"stargazers_count":297,"open_issues_count":2,"forks_count":73,"subscribers_count":29,"default_branch":"master","last_synced_at":"2024-04-26T16:32:12.830Z","etag":null,"topics":["28byj-48","28byj-48-motor","a3967","a4988","dc-motor","drv8825","drv8833","l298n","l9110s","library","motor","pigpio","python","python3","raspberry-pi","servo","sg90","stepper-motor","tb6612fng","uln2003"],"latest_commit_sha":null,"homepage":"https://gavinlyonsrepo.github.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gavinlyonsrepo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-19T00:35:51.000Z","updated_at":"2024-06-21T14:05:24.895Z","dependencies_parsed_at":"2023-01-20T18:10:15.689Z","dependency_job_id":"44983dbc-5772-476a-89f2-bf08328748ba","html_url":"https://github.com/gavinlyonsrepo/RpiMotorLib","commit_stats":{"total_commits":88,"total_committers":4,"mean_commits":22.0,"dds":0.09090909090909094,"last_synced_commit":"4df51fa307928467a5b0e4dcaf048cc259ad8954"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinlyonsrepo%2FRpiMotorLib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinlyonsrepo%2FRpiMotorLib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinlyonsrepo%2FRpiMotorLib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinlyonsrepo%2FRpiMotorLib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gavinlyonsrepo","download_url":"https://codeload.github.com/gavinlyonsrepo/RpiMotorLib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247182401,"owners_count":20897381,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["28byj-48","28byj-48-motor","a3967","a4988","dc-motor","drv8825","drv8833","l298n","l9110s","library","motor","pigpio","python","python3","raspberry-pi","servo","sg90","stepper-motor","tb6612fng","uln2003"],"created_at":"2024-10-03T18:04:03.572Z","updated_at":"2025-04-04T13:12:58.790Z","avatar_url":"https://github.com/gavinlyonsrepo.png","language":"Python","funding_links":["https://www.paypal.com/paypalme/whitelight976"],"categories":[],"sub_categories":[],"readme":"\n\n[![Website](https://img.shields.io/badge/Website-Link-blue.svg)](https://gavinlyonsrepo.github.io/)  [![Rss](https://img.shields.io/badge/Subscribe-RSS-yellow.svg)](https://gavinlyonsrepo.github.io//feed.xml)  [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/paypalme/whitelight976)\n\n# RpiMotorLib\n\n\n![ScreenShot dcmotor](https://github.com/gavinlyonsrepo/RpiMotorLib/blob/master/extra/images/RF310T11400.jpg)\n![ScreenShot Nema](https://github.com/gavinlyonsrepo/RpiMotorLib/blob/master/extra/images/nema11.jpg)\n![ScreenShot L298N](https://github.com/gavinlyonsrepo/RpiMotorLib/blob/master/extra/images/L298N.jpg)\n![ScreenShot A4988](https://github.com/gavinlyonsrepo/RpiMotorLib/blob/master/extra/images/A4988.jpg)\n\n## Table of contents\n\n  * [Table of contents](#table-of-contents)\n  * [Overview](#overview)\n  * [Installation](#installation)\n    * [From PyPi with pip or pipx](#from-pypi-with-pip-or-pipx)\n    * [From Github](#from-github)\n  * [Hardware](#hardware)\n    * [Stepper motors](#stepper-motors)\n    * [DC motors](#dc-motors)\n    * [Servos](#servos)\n  * [Software](#software)\n    * [File System](#file-system)\n    * [Dependencies](#dependencies)\n  * [Notes and issues](#notes-and-issues)\n    * [RPI 5](#rpi-5)\n    * [Two Motors simultaneously](#two-motors-simultaneously)\n    * [GPIO cleanup method](#gpio-cleanup-method)\n    * [pipx](#pipx)\n  * [See Also](#see-also)\n\n## Overview\n\n* Name: RpiMotorLib\n* Title: Raspberry pi motor library.\n* Description: \n\nA python 3 library to drive motor controllers and servos with a Raspberry pi.\n\nThese components supported are some of the most widely used by maker community.\nThere are three categories in library. Stepper motors, DC Motors and Servos.\nThe end user can import this library into their projects \nand then control the components with short snippets of code.\nThe library is modular so user can just import/use the section they need.\n\n* Project URL: [URL LINK](https://github.com/gavinlyonsrepo/RpiMotorLib)\n\n\n* Tested on Toolchains: \n    1. RPI 3 model B. Raspbian 10 Buster, 32 bit. Python 3.7.3.\n    2. RPI 3 model B. Raspbian 12 Bookworm, 64 bit. Python 3.11.2.\n    3. See notes for RPI 5 \n\n## Installation\n\nLatest version 3.3 (10-2024)\n\n### From PyPi with pip or pipx\n\nThe Python Package Index (PyPI) is a repository of software for the Python programming language.\nThe program is present in python package index, Pypi.\nInstall using *pip* or *pipx* to the location or environment of your choice.\nPackage name = rpimotorlib [Link](https://pypi.org/project/rpimotorlib/).\n\nNB see notes section for more on pipx. \n\n### From Github\n\nManually install from github\nThe package is also archived on github and can be manually download and installed \nvia python and setup.py. Not recommended.\n\n```sh\ncurl -sL https://github.com/gavinlyonsrepo/RpiMotorLib/archive/3.3.tar.gz | tar xz\ncd RpiMotorLib-3.3\npython3 setup.py build \npython3 setup.py install --user\n```\n\n## Hardware\n\nSupported Components: \n\n### Stepper motors\n\n| Motor tested | Motor controller| Help File URL link |\n| ----- | ----- | ----- |\n| Unipolar 28BYJ-48 | ULN2003 driver module | [URL](extra/Documentation/28BYJ.md)| \n| Bipolar Nema  | TB6612FNG Dual Driver Carrier | [URL](extra/Documentation/Nema11TB6612FNG.md) |\n| Bipolar Nema  | L298N H-Bridge controller module | [URL](extra/Documentation/Nema11L298N.md) |\n| Bipolar Nema  | A4988 Stepper Driver Carrier | [URL](extra/Documentation/Nema11A4988.md)|\n| Bipolar Nema  | DRV8825 Stepper Driver Carrier | [URL](extra/Documentation/Nema11DRV8825.md) |\n| Bipolar Nema  | A3967 Stepper Driver aka \"easy driver v4.4\" | [URL](extra/Documentation/Nema11A3967Easy.md)|\n| Bipolar (untested on hw)| LV8729 Stepper Driver Carrier  | [URL](extra/Documentation/Nema11LV8729.md)|\n| Bipolar (untested)| DV8833 Motor controller module | TODO |\n| Bipolar (untested)| L9110S Motor controller module | TODO |\n| Bipolar Nema | MX1508 Motor controller module | [URL](extra/Documentation/Nema11MX150X.md) |\n\n### DC motors\n\n| Motor | Motor controller| Help File URL link |\n| ----- | ----- | ----- |\n| DC Brushed Motor | L298N Motor controller module. | [ URL ](extra/Documentation/L298N_DC.md) |\n| DC Brushed Motor | L9110S Motor controller module. | [ URL ](extra/Documentation/L9110S_DC.md) |\n| DC Brushed Motor | DV8833 Motor controller module. | [ URL ](extra/Documentation/DRV8833_DC.md) |\n| DC Brushed Motor | TB6612FNG Dual motor driver carrier| [ URL ](extra/Documentation/TB6612FNG_DC.md) |\n| DC Brushed Motor | MX1508 Motor controller module| [ URL ](extra/Documentation/MX1508_DC.md) |\n| DC Brushed Motor | Transistor control | [ URL ](extra/Documentation/Transistor_DC.md) |\n\n### Servos\n\nThere are two different options for controlling the servo.\nWhen using Rpi_GPIO option you may notice twitching at certain\ndelays and stepsizes. This is the result of the \nimplementation of the RPIO PWM software timing. If the application requires\nprecise control the user can pick the pigpio library\nwhich uses hardware based timing. The disadvantage being they must install \na dependency(pigpio) and start its daemon.\n\n\n| Servo | Link |\n| ----- | ----- |\n| Servo software timing | [  RPi.GPIO module PWM ](extra/Documentation/Servo_RPI_GPIO.md) |\n| Servo hardware timing | [  pigpio library module PWM ](extra/Documentation/Servo_pigpio.md) |\n\n\n## Software\n\n1. Separate help files are in documentation folder to learn how to use library.\n    Click on the relevant URL link in tables in hardware section.\n2. Test files used during development are in test folder of repository.\n3. There is a \"Software matrix\" showing which classes are used to drive which components.\n    This is in the Software_Matrix.md file in extra/Documentation folder.\n\n\n### File System\n\n\nRpiMotorLib files are listed below:\n\n| File Path | Description |\n| ------ | ------ |\n| RPiMotorLib/RpiMotorLib.py |  stepper motor python library file |\n| RPiMotorLib/rpiservolib.py | servo python library RPi.GPIO  PWM file |\n| RPiMotorLib/rpi_pservo_lib.py | servo python library pigpio PWM file |\n| RPiMotorLib/rpi_dc_lib.py  |    DC python motor library  file |\n| documentation/*.md | 15 markdown library documentation files |\n| test/*Test.py | 14 python test files |\n| /usr/share/doc/RpiMotorLib/README.md | This help file |\n| RPiMotorLib/RpiMotorScriptLib.py | small script with meta data about library |\n\nA small script is installed to display version and help information.\nRun the information script by typing.\nRpiMotorScriptLib.py -[options]\n\n| Option          | Description     |\n| --------------- | --------------- |\n| -h  | Print help information and exit |\n| -v  | Print version information and exit |\n\n\n### Dependencies\n\n\n1. RPi.GPIO 0.6.3  [Rpi.GPIO pypi page](https://pypi.python.org/pypi/RPi.GPIO)\n\nA module to control Raspberry Pi GPIO channels.\nThis package provides a class to control the GPIO on a Raspberry Pi.\nThis should already be installed on most Raspberry Pis.\n\n2. pigpio 1.64-1 [Homepage](abyz.co.uk/rpi/pigpio/)\n\nThis Dependency is *Optional*, it is currently \nonly used in one of the two servo control options.\npigpio is a library for the Raspberry which allows \ncontrol of the General Purpose Input Outputs (GPIO).\n\n\n## Notes and issues\n\n### RPI 5\n\nWill NOT work on raspberry pi 5's at present as  RPi.GPIO does not work anymore due to change's in way raspberry pi 5  handles the peripheral access. See github issue #26\n\n### Two Motors simultaneously\n\nRunning two motors simultaneously, See github issue #11\n\nIf you want to control two or more steppers simultaneously, there are two basic setup\nfiles for using threading in test/Multi_Threading_Example folder. \n\n1. For Unipolar 28BYJ-48  MultiMotorThreading_BYJ.py\n2. For Bipolar DRV8825 Stepper MultiMotorThreading_DRV8825.py\n\n### GPIO cleanup method\n\nPotential Issue with GPIO.cleanup() method not working* See github issue #18 and #21\n\nSome users are reporting that GPIO.cleanup() does not work.\nIt does not switch off or \"cleanup\" GPIO as it should.\nThis is external function from RPi.GPIO. It is mainly used in the test scripts.\nIt is also called by the classes in DC motor if the cleanup method is passed argument \"true\".\nIf you see this issue simply don't use GPIO.cleanup() or remove GPIO.cleanup \nand clear the GPIO you set manually or use python \"del\" method to destroy the relevant class object,\nto free resources if you need them again.\n\n### pipx\n\nAs of pep668, Users on many systems will now get an error if they try and install packages on system\nwith pip(\"~environment is externally managed\"). One solution is to use pip to install to a virtual environment.\n\nAnother is to use package. **PIPX**, which installs packages globally into isolated Virtual Environments.\n\nThe first problem I had was getting my test files to \"see\" this isolated Virtual environment so they could import the modules. In test/pipx\nI have created two pipx examples files showing a solution. In example 1 I append the package location to sys.path using sys.path.insert\nand in example 2 I simply change the shebang at first line of file(the new shebang is from the pipx installed RpiMotorScriptLib.py file at .local/bin).\nI will learn more about pipx and see if there is a better solution.\n\nThe second problem after finding the correct path is the dependency RPi.GPIO module is not in the pipx venv. So must be \"injected\" into the venv.\nthis is because I did not include RPi.GPIO in the setup.py as it is always there globally(for most users).\nI will correct this in next update.\n\n```sh\npipx install rpimotorlib\npipx inject rpimotorlib RPi.GPIO\n```\n\n\n## See Also\n\n1. Partial port to Raspberry pi PICO SDK C++ at [link.](https://github.com/gavinlyonsrepo/Stepper_Motor_Control_PICO)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgavinlyonsrepo%2Frpimotorlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgavinlyonsrepo%2Frpimotorlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgavinlyonsrepo%2Frpimotorlib/lists"}