Due to high demand expect some shipping delays at this time, orders may not ship for 3-4 business days. On MLK Day no orders will be shipped.
0

Motor Shield V2 - free pins?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Motor Shield V2 - free pins?

by silvideo on Wed Nov 24, 2021 11:34 am

Greetings, I am using this shield for the first time with an Arduino Uno. I need to add a push button to reverse the direction of a stepper.
I am unsure which pins are actively been used by the shield and which are free for me to add the push button as an input.
Would any one please let me know? I will appreciate any information I could receive.
Thanks in advance!

silvideo
 
Posts: 9
Joined: Tue Nov 23, 2021 7:09 pm

Re: Motor Shield V2 - free pins?

by adafruit_support_bill on Wed Nov 24, 2021 12:02 pm

You can use anything except SDA and SCL (A4 and A5 on an UNO).
https://learn.adafruit.com/adafruit-mot ... aq-2861883

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

Re: Motor Shield V2 - free pins?

by silvideo on Wed Nov 24, 2021 12:20 pm

Thank you so much for the prompt response and for providing the link; I see a lot of useful information!
Follow up question: could I safely connect the shield to a Mega256? I did try it and it worked fine but on the link you sent there is a reference to pins 20 and 21, which the shield did not use.
I am not sure if I would create an unsafe situation if I were to keep the Mega, motor shield and stepper working for a long time.
Thanks again.

silvideo
 
Posts: 9
Joined: Tue Nov 23, 2021 7:09 pm

Re: Motor Shield V2 - free pins?

by adafruit_support_bill on Wed Nov 24, 2021 2:22 pm

Yes, it will work with an R3 or later version of the Mega, since all R3 and later processors have SDA and SCL pins brought out on the headers next to the AREF pin.

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

Re: Motor Shield V2 - free pins?

by silvideo on Wed Nov 24, 2021 3:18 pm

Great!
Thanks again for the reply.
Happy thanksgiving day!

silvideo
 
Posts: 9
Joined: Tue Nov 23, 2021 7:09 pm

Re: Motor Shield V2 - free pins?

by silvideo on Thu Nov 25, 2021 11:46 am

Please, allow me to ask another question:
Since I am only driving one stepper with a very simple code, is there an alternative to control it besides the Motor Shield?
I am beginning to think that the Motor Shield is a bit of an overkill for this situation. Don't get me wrong: I really like it but is there a simpler controller you would recommend?
Thanks again for your time.

silvideo
 
Posts: 9
Joined: Tue Nov 23, 2021 7:09 pm

Re: Motor Shield V2 - free pins?

by adafruit_support_bill on Thu Nov 25, 2021 1:12 pm

What stepper motor are you using?

We have the TB6612B board which is the same driver used on the shield in a simpler form: https://www.adafruit.com/product/2448
The DRV8833 is another option: https://www.adafruit.com/product/3297

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

Re: Motor Shield V2 - free pins?

by silvideo on Thu Nov 25, 2021 5:14 pm

You guys are amazing!
Thanks for the reply and advice.

silvideo
 
Posts: 9
Joined: Tue Nov 23, 2021 7:09 pm

Re: Motor Shield V2 - free pins?

by silvideo on Wed Dec 01, 2021 5:22 pm

I am sorry, I neglected to tell you that I am using the NEMA 17 you sell with ID 324.

I got the TB6612 you suggested connected and working but noticed it is a bit jerky moving from step to step; that is as opposed to the Motor Shield which was very smooth at low rpm.
I am sure I am overseeing something and perhaps there is something I could add to the the code to make it work smoothly as it was with the Motor Shield.

If you do not mind, here is the simple code I am using:

Code: Select all | TOGGLE FULL SIZE
#include <Stepper.h>

const int stepsPerRevolution = 200;


Stepper myStepper(stepsPerRevolution, 4, 5, 6, 7);

void setup() {
 
  myStepper.setSpeed(6);
 
}

void loop() {
 
  myStepper.step(stepsPerRevolution/3);
  delay(2000);

  myStepper.step(-stepsPerRevolution/4);
  delay(2000);

  myStepper.step(stepsPerRevolution);
  delay(3000);

  myStepper.step(-stepsPerRevolution);
  delay(3000); 
}

Basically I am rotating an essential oil carrousel 1/3 or a rev forward, 1/4 back, then one full rev forward and one full rev backwards with a delay in between.

Is there anything you think is missing?
Thanks so much for any advice you cold provide to me.
Last edited by adafruit_support_bill on Wed Dec 01, 2021 5:41 pm, edited 1 time in total.
Reason: Please use [code] tags when posting code to the forums.

silvideo
 
Posts: 9
Joined: Tue Nov 23, 2021 7:09 pm

Re: Motor Shield V2 - free pins?

by adafruit_support_bill on Wed Dec 01, 2021 5:47 pm

Not sure what stepper modes you were using with the shield, DOUBLE stepping mode generates the most torque - but is not so smooth. INTERLEAVE and MICROSTEP modes divide up the steps to create less vibration - albeit with less torque.

The Arduino stepper library has only one mode - equivalent to the DOUBLE mode of the shield library.

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

Re: Motor Shield V2 - free pins?

by silvideo on Wed Dec 01, 2021 6:10 pm

Oh, that explains!
I was using MICROSTEP with the shield; it provided enough torque to move 30 5mm bottles of essential oils around the axis.
Is there another library I could include to set the steps to MICROSTEP?

You do not know how much I appreciate your help.
Thank you!

silvideo
 
Posts: 9
Joined: Tue Nov 23, 2021 7:09 pm

Re: Motor Shield V2 - free pins?

by adafruit_support_bill on Wed Dec 01, 2021 9:43 pm

Microstepping with the Tb6612 would require PWM pin control for the AIN1 and BIN1 pins. I don't know of any libraries that support that. www.pololu.com has a number of stepper controllers that have native microstepping support. That would give you the best of both worlds: microstepping plus high-speed step & direction control.

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

Re: Motor Shield V2 - free pins?

by silvideo on Wed Dec 01, 2021 11:39 pm

Thanks for the reply and explanation. I think I will research how to use PWM; it will be a good challenge for me.
I can always go back to the Motor Shield since I got very good results with it.
I appreciate you help and advice.

silvideo
 
Posts: 9
Joined: Tue Nov 23, 2021 7:09 pm

Re: Motor Shield V2 - free pins?

by silvideo on Wed Dec 08, 2021 7:10 pm

Greetings, please allow me to ask an unrelated question to this topic:

I got a few Perma-Proto half size breadboard today; I must say they are very cute.
However when I tried to add an Elegoo MB-V2, I noticed the pins do not match.

Do you guys have a similar power module that would fit the rails of the Perma?
Please let me know when you have a chance.

Thank you!

silvideo
 
Posts: 9
Joined: Tue Nov 23, 2021 7:09 pm

Please be positive and constructive with your questions and comments.