Motor Shield V2 - free pins?

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
silvideo
 
Posts: 10
Joined: Tue Nov 23, 2021 7:09 pm

Motor Shield V2 - free pins?

Post by silvideo »

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!

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Motor Shield V2 - free pins?

Post by adafruit_support_bill »

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

User avatar
silvideo
 
Posts: 10
Joined: Tue Nov 23, 2021 7:09 pm

Re: Motor Shield V2 - free pins?

Post by silvideo »

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.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Motor Shield V2 - free pins?

Post by adafruit_support_bill »

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.

User avatar
silvideo
 
Posts: 10
Joined: Tue Nov 23, 2021 7:09 pm

Re: Motor Shield V2 - free pins?

Post by silvideo »

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

User avatar
silvideo
 
Posts: 10
Joined: Tue Nov 23, 2021 7:09 pm

Re: Motor Shield V2 - free pins?

Post by silvideo »

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.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Motor Shield V2 - free pins?

Post by adafruit_support_bill »

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

User avatar
silvideo
 
Posts: 10
Joined: Tue Nov 23, 2021 7:09 pm

Re: Motor Shield V2 - free pins?

Post by silvideo »

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

User avatar
silvideo
 
Posts: 10
Joined: Tue Nov 23, 2021 7:09 pm

Re: Motor Shield V2 - free pins?

Post by silvideo »

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

#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.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Motor Shield V2 - free pins?

Post by adafruit_support_bill »

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.

User avatar
silvideo
 
Posts: 10
Joined: Tue Nov 23, 2021 7:09 pm

Re: Motor Shield V2 - free pins?

Post by silvideo »

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!

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Motor Shield V2 - free pins?

Post by adafruit_support_bill »

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.

User avatar
silvideo
 
Posts: 10
Joined: Tue Nov 23, 2021 7:09 pm

Re: Motor Shield V2 - free pins?

Post by silvideo »

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.

User avatar
silvideo
 
Posts: 10
Joined: Tue Nov 23, 2021 7:09 pm

Re: Motor Shield V2 - free pins?

Post by silvideo »

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!

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”