Need help with RpiMotorLib?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

183 Stars 49 Forks 85 Commits 0 Opened issues


RpiMotorLib : Raspberry Pi Motor Library : A python 3 library for various motors and servos to connect to a raspberry pi

Services available


Need anything else?

Contributors list

# 126,161
Arch Li...
74 commits
# 68,822
Visual ...
6 commits
# 35,068
2 commits
# 551,029
1 commit

RpiMotorLib, A Raspberry pi python motor library

ScreenShot dcmotor ScreenShot Nema ScreenShot L298N ScreenShot A4988

Table of contents


  • Name: RpiMotorLib
  • Title: Raspberry pi motor library.
  • Description:

A python 3 library for various motor controllers and servos to connect to a raspberry pi. These components are some of the most widely used by community. There are three categories in library. Stepper motors, DC Motors and Servos. The end user can import this library into their projects and then control the components with short snippets of code. The library is modular so user can just import/use the section they need.

  • Main Author: Gavin Lyons , website..
  • Project URL: URL LINK
  • History: is at repository in documentation.
  • Copyright: See in documentation.
  • Pull requests,bug reports, suggestions for new components and features welcome.


The library was initially tested and built on a raspberry pi 3 model b, Raspbian jessie 8.0 and python 3.4.2. It was also tested for Python (3.5.3) and Raspbian stretch 9. Also for Windows 10 users See issue number 2 at project Github URL.

Rpimotorlib is in the PYPI Link The Python Package Index (PyPI) is a repository of software for the Python programming language.

Make sure that python3 and pip3 have been installed on your machine, then:

sudo pip3 install rpimotorlib


rpiMotorLib files are listed below:

| File Path | Description | | ------ | ------ | | RPiMotorLib/ | stepper motor python library file | | RPiMotorLib/ | servo python library RPi.GPIO PWM file | | RPiMotorLib/ | servo python library pigpio PWM file | | RPiMotorLib/ | DC python motor library file | | documentation/.md | 15 markdown library documentation files | | test/ | 14 python test files | | /usr/share/doc/RpiMotorLib/ | This help file | | RPiMotorLib/ | small script with meta data about library |

A small script is installed to display version and help information. Run the information script by typing. -[options]

| Option | Description | | --------------- | --------------- | | -h | Print help information and exit | | -v | Print version information and exit |


  1. RPi.GPIO 0.6.3 Rpi.GPIO pypi page

A module to control Raspberry Pi GPIO channels. This package provides a class to control the GPIO on a Raspberry Pi. This should already be installed on most Raspberry Pis.

  1. pigpio 1.64-1 Homepage

This Dependency is Optional, it is currently only used in one of the two servo control options. pigpio is a library for the Raspberry which allows control of the General Purpose Input Outputs (GPIO).


Şeparate help files are in documentation folder to learn how to use library. Click on the relevant URL link in tables below. Test files used during development are in test folder of repo. Example snippets are also available in some of the documentation files. There is a libre office spreadsheet file in the Documentation folder called Matrix, which shows which class is used for which controller, or consult the docstring of the appropriate python file.

  1. Stepper motors

| Motor tested | Motor controller| Help File URL link | | ----- | ----- | ----- | | Unipolar 28BYJ-48 | ULN2003 driver module | URL| | Bipolar Nema 11 | TB6612FNG Dual Driver Carrier | URL | | Bipolar Nema 11 | L298N H-Bridge controller module | URL | | Bipolar Nema 11 | A4988 Stepper Driver Carrier | URL| | Bipolar Nema 11 | DRV8825 Stepper Driver Carrier | URL | | Bipolar Nema 11 | A3967 Stepper Driver aka "easy driver v4.4" | URL| | n/a | LV8729 Stepper Driver Carrier | URL|

Note: NEMA 11 bipolar stepper motors where used in tests but most other bipolar 4-pin motors of similar type should work as well.

  1. DC motors

| Motor | Motor controller| Help File URL link | | ----- | ----- | ----- | | DC Brushed Motor | L298N Motor controller module. | URL | | DC Brushed Motor | L9110S Motor controller module. | URL | | DC Brushed Motor | DV8833 Motor controller module. | URL | | DC Brushed Motor | TB6612FNG Dual Motor Driver Carrier| URL | | DC Brushed Motor | Transistor control | URL |

  1. Servos

| Servo | Link | | ----- | ----- | | Servo software timing | RPi.GPIO module PWM | | Servo hardware timing | pigpio library module PWM |

Note: There are two different options for controlling the servo. When using Rpi_GPIO option you may notice twitching at certain delays and stepsizes. This is the result of the implementation of the RPIO PWM software timing. If the application requires precise control the user can pick the pigpio library which uses hardware based timing. The disadvantage being they must install a dependency.


** Note 1 Running two motors simultaneously **

See github issue #11

If you want to control two steppers simultaneously, there are two basic setup file for using threading in test folder.

  1. For Unipolar 28BYJ-48
  2. For Bipolar DRV8825 Stepper

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.