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:
domingo, 31 de enero de 2016
sábado, 30 de enero de 2016
Note about exercise 9 from "type range" in Python Programs
In the exercise 9, in the exercises type range(), there is a part where you need a mathematical formula that you may not know. When i looked at the solution of the exercise (http://www.mclibre.org/consultar/python/ejercicios/ej_range_soluciones.html), i found:
inicial2=inicial//paso*paso+paso
Ok, but... what the hell was that??
To understand it, searched it for all over the web and after hours searching for it, i got tired because of the lack of positive results and I decided to take a paper and a pen and start doing the best thing I can do: thinking.
After two hours in front of a paper, I found the solution: The test to know if you have solved good the division!!!
I found a relation between that strange formula and the test of the division:
inicial//paso*paso+paso <=> D//d*c+c (Dividend/divisor*cocient+cocient)
That's where that formula comes from, in case that you are interested on it. Else, you may just need the formula to solve the problem. This entry of this blog is only to curious people like me who want to understand this better, like me.
If you still don't understand it well and you want to understand it better, you can ask it in the comments and i'll try to explain it the best i can!
inicial2=inicial//paso*paso+paso
Ok, but... what the hell was that??
To understand it, searched it for all over the web and after hours searching for it, i got tired because of the lack of positive results and I decided to take a paper and a pen and start doing the best thing I can do: thinking.
After two hours in front of a paper, I found the solution: The test to know if you have solved good the division!!!
I found a relation between that strange formula and the test of the division:
inicial//paso*paso+paso <=> D//d*c+c (Dividend/divisor*cocient+cocient)
That's where that formula comes from, in case that you are interested on it. Else, you may just need the formula to solve the problem. This entry of this blog is only to curious people like me who want to understand this better, like me.
If you still don't understand it well and you want to understand it better, you can ask it in the comments and i'll try to explain it the best i can!
Suscribirse a:
Entradas (Atom)