Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two GPIO pin opened as the same time. #1

Open
Squitys opened this issue Apr 29, 2017 · 2 comments
Open

Two GPIO pin opened as the same time. #1

Squitys opened this issue Apr 29, 2017 · 2 comments

Comments

@Squitys
Copy link

Squitys commented Apr 29, 2017

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.

@coding-yogi
Copy link

I believe 2 pins are opened for half stepping which gives you a better control over step resolution

@Novivy
Copy link

Novivy commented Dec 13, 2019

@Squitys Do you mind sharing this part of your script ? or just tell in which order you opened which pin ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants