PC/CP320 Physical Computing
Raspberry Pi Stepper Motors
Overview
Stepper motors are common.
Objectives
- To introduce control of stepper motors with the Raspberry Pi
Background
Preparation
Equipment
- Raspberry Pi
- TTL-serial cable
- Stepper motor with controller board
Procedure
-
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?
-
Identify which pins have which function:
- power
- ground
- control signals
-
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.
-
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.
Wilfrid Laurier University
© 2019 Wilfrid Laurier University