Hardware Reference
In-Depth Information
Table 6-3. Single-Character Commands
Char
Command
Char
Command
Q
Quit
0
12 o'clock (noon)
<
Slower steps
1
1 o'clock
>
Faster steps
2
?
Help
H
9
9 o'clock
J
Stepper mode 0
A
10 o'clock
K
Stepper mode 1
B
11 o'clock
L
Stepper mode 2
+/=
Step clockwise
P
Show current position
-
Step counterclockwise
O
Toggle drive on/off
The < and > commands double or halve the step time interval. This slows and
increases the rotational speed, respectively. Stepper modes can be changed using the J , K ,
or L commands. These reposition the stepper to 12 o'clock prior to changing modes. The
digits 0 through 9 and letters A and B reposition the shaft to point to the hour of the clock.
You can test whether your rotation is properly working by using the + and -
keystrokes to step one step clockwise or counterclockwise. Pressing O (the letter O, not
zero) toggles the drive power on or off for the motor. This is useful for turning off the
motor drive when you want to manually reposition the shaft.
The source code used in this program for gpio_io.c is provided in Chapter 10
of Raspberry Pi Hardware Reference (Apress, 2014), and timed_wait.c is provided in
Chapter 1. The main source module of interest is unipolar.c , which is presented at the
end of this chapter.
Testing
Be careful setting up this project because of the voltages involved. One careless wiring
error could bring higher voltage into your GPIO pins and fry the Pi. In the following
procedures, I refer to the driver PCB (as I used), but this procedure applies equally to
breadboarded circuits.
Here is the first part of the setup and checkout procedure:
1.
Set up the power to the driver PCB without connecting it to
the Raspberry Pi. Leave the motor unconnected also.
2.
Make sure that the driver inputs are not connected.
3.
Apply the power to the PCB. No LEDs will light if everything is
OK. No smoke? Good!
 
 
Search WWH ::




Custom Search