In this practice, we have to control a stepper motor with our Raspberry Pi.
Things we need:
- 1 stepper motor
- 1 controler for the stepper motor
- 1 raspberry pi
- Wires
What we have to do in this practice is to connect all the wires on their possitions:
-The pins of the controller of Vcc and GND go to the same names, in the raspberry.
-The pin 1 of the controller go to the pin 11 of the raspberry (GPIO17).
-The pin 2 of the controller go to the pin 15 of the raspberry (GPIO22).
-The pin 3 of the controller go to the pin 16 of the raspberry (GPIO23).
-The pin 4 of the controller go to the pin 18 of the raspberry (GPIO24).
In our case, we will use the motor in Full Step, so this is the order of the coils that we are going to use:
D C B A
1 0 0 1
1 0 1 0
0 1 1 0
0 1 0 1
To increase the precision, the coils of our stepper motor are divided inside in 8 coils each one. Those coils are called "poles". This makes 32 steps needed to do a lap. Moreover, the motor has a reduction gear of 1/64 to increase even more the precision. This makes 32*64=2048 steps to do a complete turn.
Here, we can see the full code with comments:
