Difference: SteppingMotor (2 vs. 3)

Revision 32017-10-16 - uli

Line: 1 to 1
 
META TOPICPARENT name="CourseExercises"

Stepping Motor Exercises

Goal:

Line: 20 to 20
 
  • 5V (check for “5V +” and “-” on the board)

  • Gnd

  • 4 phases denominated In0..In3

Changed:
<
<
The state of each of the In lines is shown on its corresponding LED. We will have to provide a sequence of

    In0 In1 In2 In3
In 0 coil1 1 0 0 0
In 1 coil2 0 1 0 0
In 2 coil1 0 0 1 0
In 3 coil2 0 0 0 1
>
>
The state of each of the In lines is shown on its corresponding LED. We will have to provide a sequence of pulses
  to make the motor move by 4 full steps. This is what we call single phase stepping where only 1 coil is energized at a time. In this case we have
Deleted:
<
<
coil1 coil2
+ 0
0 0
- 0
0 -
 
Added:
>
>
    Step 1 Step 2 Step 3 Step 4
In 1 coil 1 + 1 0 0 0
In 2 coil 2 - 0 1 0 0
In 3 coil 1 - 0 0 1 0
In 4 coil 2 + 0 0 0 1
 We can also drive the motor by energizing both coils as follows:
Deleted:
<
<
coil1 coil2
+ +
- +
- -
+ -
How does the corresponding table giving the values on the In0 .. In3 look like? This way of driving the motor is called double phase stepping. It needs more power since we always have both windings energized but it will also provide a higher torque.
 
Changed:
<
<
Last not least we can use a combination of single and double phase stepping to produce half steps. In this case the angular resolution is better by a factor of 2. The polarization table looks like this:
coil1 coil2
+ 0
+ +
0 +
- +
- 0
- -
0 -
+ -
>
>
    Step 1 Step 2 Step 3 Step 4
In 0 coil1 + 1 0 0 1
In 1 coil2 - 1 1 0 0
In 2 coil1 - 0 1 1 0
In 3 coil2 + 0 0 1 1
This way of driving the motor is called double phase stepping. It needs more power since we always have both windings energized but it will also provide a higher torque.
 
Added:
>
>
Last not least we can use a combination of single and double phase stepping to produce half steps. In this case the angular resolution is better by a factor of 2. The polarization table looks like this:
 
Added:
>
>
    Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7 Step 8
In 0 coil1 + 1 1 0 0 0 0 0 1
In 1 coil2 - 0 1 1 1 0 0 0 0
In 2 coil1 - 0 0 0 1 1 1 0 0
In 3 coil2 + 0 0 0 0 0 1 1 1
 Connect the stepping motor to the driver board and the driver board to the Raspberry Pi. The In0 .. In3 lines must be connected to GPIO pins (e.g. 17,18,27,22). Now set only the GPIO line, to which In0 is connected, to high, all the others to low and make sure that the corresponding LED lights up. Do the same thing for all the connected GPIO pins.

Exercise 2: Write a program to move the stepping motor by 2048 steps.

Use the single phase sequence to make the stepping motor move. One sequence corresponds to 4 full steps. Make sure to wait at least 25 ms in between each setting:

  • set 1 0 0 0, wait 25ms

Changed:
<
<
  • set 0 1 0 0, wait 25 ms …

>
>
  • set 0 1 0 0, wait 25 ms …

  Write a subroutine which moves the motor by 4 steps. Then call this subroutine 512 times. Use C arrays to define which In line corresponds to which GPIO line and a 2 dimensional array to mimic the above table.
Line: 78 to 72
 
  • -n or –numberOfSteps: number of steps (default 512)

  • -v or –velocity: velocity of movement

  • -s or –fullStep: full step (this is the default)

Changed:
<
<
  • -h or –halfStep: half step

>
>
  • -h or –halfStep: half step

  -- Uli Raich - 2017-05-11
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback