node-stepper-wiringpi
node-stepper-wiringpi copied to clipboard
Two GPIO pin opened as the same time.
Hi,
first i need to thank you a lot for this great job! second i'm not an expert of raspberryPi or stepper motor so i could be wrong.
In my opinion you could have some problems in your code that makes stepper motors work wrongly and even heat a bit because of this.
Let's see the case of 4 pinCount, at each step you open 2 pins at the same time instead of one.
else if (thisModule.pinCount == 4) { switch (thisStep % 4) { case 0: // 1010 wpi.digitalWrite(thisModule.motorPin1, wpi.HIGH); wpi.digitalWrite(thisModule.motorPin2, wpi.HIGH); wpi.digitalWrite(thisModule.motorPin3, wpi.LOW); wpi.digitalWrite(thisModule.motorPin4, wpi.LOW); break; case 1: // 0110 wpi.digitalWrite(thisModule.motorPin1, wpi.LOW); wpi.digitalWrite(thisModule.motorPin2, wpi.HIGH); wpi.digitalWrite(thisModule.motorPin3, wpi.HIGH); wpi.digitalWrite(thisModule.motorPin4, wpi.LOW); break; .........
in my opinion the script should open only one pin at each step, otherwise the motor will not know in which direction should go.
But i repeat again, i'm not an expert and it could be my motor that needs to work in the way described by me, so i could be wrong. Anyway after adjusting your script and opening only one PIN at step it work correctly. I'm using a kuman 28BYJ-48 stepper motor with the driver ULN2003, i got them from amazone.
I believe 2 pins are opened for half stepping which gives you a better control over step resolution
@Squitys Do you mind sharing this part of your script ? or just tell in which order you opened which pin ?