Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

DC & Stepper Motor Bonnet is now running backwards on a diff
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

DC & Stepper Motor Bonnet is now running backwards on a diff

by JC_LaFleur on Thu Jun 25, 2020 4:32 am

I have a DC & Stepper Motor Bonnet.
I had it connected to a Raspberry Pi model 2, had all my motor code written to make the stepper motor work like I wanted it to.
I took that same DC & Stepper Motor Bonnet and connected it to a brand new Raspberry Pi Zero W.
All the motor and DC input wires are connected exactly the same, same SD card, same python code, nothing has changed except that it is now connected to a Pi Zero W instead of the Pi 2.
Now the stepper motor is running in the reverse direction that it was on the Pi 2.
Can someone please explain why this is happening?
Really frustrating to have to go back into all my code and manually reverse the motor direction in there.
Any logical explanation for this behavior?
Thanks.

JC_LaFleur
 
Posts: 27
Joined: Thu May 28, 2020 10:29 pm

Re: DC & Stepper Motor Bonnet is now running backwards on a

by adafruit_support_bill on Thu Jun 25, 2020 5:08 am

Really frustrating to have to go back into all my code and manually reverse the motor direction in there.

No need to change any code. Just reverse one of the pairs of wires to the stepper.

adafruit_support_bill
 
Posts: 77937
Joined: Sat Feb 07, 2009 10:11 am

Re: DC & Stepper Motor Bonnet is now running backwards on a

by JC_LaFleur on Thu Jun 25, 2020 3:23 pm

That does not answer my question as to why this is happening.
What is the different between the Pi Zero W and the Pi 2 that would cause the stepper to run in reverse?
And wouldn't I have to reverse both coils on the stepper motor?
Reversing only one pair would drive the coils against each other, causing the motor to not turn at all, right?
I'm using a unipolar motor, not a bi-polar motor.
I would still like someone to answer this question.
Thanks

JC_LaFleur
 
Posts: 27
Joined: Thu May 28, 2020 10:29 pm

Re: DC & Stepper Motor Bonnet is now running backwards on a

by adafruit_support_bill on Thu Jun 25, 2020 4:22 pm

I don't know why the step phasing on a Pi-W would be different. But standard procedure for installing steppers is to test the direction and if it is backwards, swap the leads on one coil.
And wouldn't I have to reverse both coils on the stepper motor?
Reversing only one pair would drive the coils against each other, causing the motor to not turn at all, right?

No and no. Reversing one pair reverses the phase offset so the motor will step in the opposite direction.
I'm using a unipolar motor, not a bi-polar motor.

The same rule applies.

adafruit_support_bill
 
Posts: 77937
Joined: Sat Feb 07, 2009 10:11 am

Re: DC & Stepper Motor Bonnet is now running backwards on a

by JC_LaFleur on Fri Jun 26, 2020 1:48 pm

Thank you Bill !
Flipping one pair of wires indeed took care of the issue :-)
It still makes my brain itch as to why this is happening... but as long as everything is working like I need it to again I'll try to forget about it. :-P

Where on this forum would be the best place to ask general questions about python programming issues? Or would another forum like Stack Exchange be a better place?
I'm trying to figure out the simplest way to kill a bash script running as root from inside a python script which is also running as root on startup... preferably without having to use the PID#.


Thanks again :-)

JC_LaFleur
 
Posts: 27
Joined: Thu May 28, 2020 10:29 pm

Re: DC & Stepper Motor Bonnet is now running backwards on a

by adafruit_support_bill on Fri Jun 26, 2020 2:07 pm

For general Python programming there are lots of good resources such as StackExchange. However, CircuitPython does have some differences from standard Python. The CircuitPython forum is the best resource for CircuitPython specific questions since it is monitored by the developers of the language.: viewforum.php?f=60

adafruit_support_bill
 
Posts: 77937
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.