Rasppberry Pi Stepper Motor Tutorial


This project has been designed to help students or hobbyists get started with driving stepper motors on the Raspberry PI. It covers two types of stepper motor namely unipolar and bipolar. The difference between these two is explained in the manual below. The principal hardware required to run stepper motors on a Raspberry PI consists of the following components:

  1. A Raspberry PI computer (all models)
  2. A single or dual stepper motor driver board
  3. As alternative to the above an I2C interface can be used
  4. Object orientated Python3 driver code
  5. One or two x 5-Wire "28BYJ-48" stepper Motor (unipolar motor) with ULN2803A driver
  6. Or
  7. A 12-volt #324 (Nema17) high torque stepper motor (bipolar motor) with A4988 H-Driver circuit
In the case of the high torque bipolar Nema17 stepper motor, this tutorial differs from most other tutorials on the Internet. First of all  most of them are still using out-of-date RPi.GPIO calls and are very basic.The Nema17 control programs now use PiZero and LGPIO to run and control the the motor. Also, most other tutorials show you how to turn the motor backwards and forwards but they don't show you how to control the motor using Limit Switches, Rotary Encoders or Push Buttons and other user driven inputs. This tutorial does show how to implement a user interface with example code which in the case of the Nema17 driver is using completely up to date GPIO libraries. On this page you will find the description of the project, Python source files, documentation for installation instructions, Download the constructors manual below (Requires Adobe PDF Reader).


Documentation          Download software
Raspberry PI Stepper Motor Stepper motor tar file


To extract software on the Raspberry Pi first download with wget and then extract it with tar

  1. mkdir pistepper
  2. cd pistepper
  3. wget https://bobrathbone.com/raspberrypi/packages/pi_stepper_motor.tar.gz
  4. tar -xvf pi_stepper_motor.tar.gz

Advert