PC/CP320 Physical Computing

Raspberry Pi Stepper Motors


Stepper motors are common.


  1. To introduce control of stepper motors with the Raspberry Pi





  1. Datasheet Examination

    Look at the driver chip datasheet and the motor datasheet and the controller board datasheet
    to answer the following questions:
    Since the control signals are going from the Pi to the motor, is there any danger to the Pi if the motor supply voltage is above 3.3V?
    Is there diode protection in the chip to protect whatever is controlling it from EMF caused by the motor?

    Given that and the answer to the previous question, will optoisolators be needed on the inputs?
    What input voltage is required for a high? Can this be provided by the Pi?
    Note: The Pi power pin may not provide enough power for the motor. If that is the case then use the bench supply, but make sure your bench ground and the Pi ground are connected.
    How many pairs of coils are inside this stepper motor?

  2. Identify which pins have which function:
    • power
    • ground
    • control signals

  3. Motor Calibration

    Write a program to control the stepper using a set of GPIO pins and incorporating half-stepping.
    Hint: Start with stepper_test_2018.py

    Many stepper motors, such as this one, have internal gearing so that the external shaft takes many motor revolutions to make one complete shaft revolution.
    Modify your program to find the number of steps for a complete shaft rotation.
    Hint: The number of motor coils must divide evenly into the number of steps. Also, somewhere in the documentation the number of steps in a revolution should be specified.
    Demonstrate your motor in operation and explain your calculations to the lab supervisor.

  4. Program Refinement

    Modify your program so that you input the desired angle of rotation in degrees.
    Demonstrate your motor in operation and program to the lab supervisor.

    Modify your program so that, when you quit, the motor will be returned to the neutral position.
    Demonstrate your motor in operation and program to the lab supervisor.


To view pdf documents, you can download Adobe Acrobat Reader .
get Acrobat Reader
If you need to update a browser, you might try Firefox which is Get Firefox!
Since this page uses cascading style sheets for its layout, it will look best with a browser which supports the specifications as fully as possible.

If you are looking for an office package, with a word processor, spreadsheet, etc., you might try LibreOffice which is Get LibreOffice!

Go to the main page for the Department of Physics and Computer Science.

Valid XHTML 1.1

Valid CSS!

(Level AA)

Wilfrid Laurier University