Adafruit motorshield v2 controlling problem

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
olivia17
 
Posts: 10
Joined: Wed Jul 29, 2015 2:53 pm

Adafruit motorshield v2 controlling problem

Post by olivia17 »

Dear all,

I'm using the adafruit motorshield board with an arduino board togerther to control 3 steppers, NEMA-17. 2 of the steppers are wired together to one motor port on the shield board (as I need them to walk at the same time), and another one is wired to the other port on the board. An external power supply is also wired with the board, and the working current is usually set to 1A. Also, Matlab serves as the commander.
Now everything is good except the preciseness of the motor steps. When I use commands like move(sx,10) (command in matlab to tell the motor to move 10 steps.) to control the motor continuously, the motor can't move the exactly same distance every time for the commands of 10 steps. And also, they can't follow the order of steps correctly each time. Sometimes, the motros don't move when it's told to move. What is the problem here? I'm very confused. I don't think the codes are wrong. Is there something unconsidered about the adafriut motor shield?

Here are the codes.

Code: Select all

delete(instrfind({'Port'},{'COM3'}));
a = arduino('COM3', 'uno', 'Libraries', 'Adafruit\MotorShieldV2');
shield = addon(a, 'Adafruit\MotorShieldV2');
addrs = scanI2CBus(a,0);
 
% Move cameras to the 1st imaging position 
sx = stepper(shield, 1, 200);     % 2 x-axis motors
sy= stepper(shield, 2, 200);      % y-axis motor
sx.RPM = 10;
sy.RPM = 10;
move(sy,585);
move(sx,500);
x = [70 70 0 -70 -70 0   70 70 0  -70 -70 -500];
y = [0  0  70  0    0   70  0  0    70  0   0   -795];

for i = 1:12
  % move motors
  move(sx,x(i)); 
  move(sy,y(i));
  pause(5)
end
Any idea and comment is welcomed! Thank you very much!

Olivia

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

Re: Adafruit motorshield v2 controlling problem

Post by adafruit_support_bill »

Not familiar with Matlab code, but it sounds like you may be a bit underpowered.

Assuming you are referring to the NEMA-17 motors we sell in the store, these require 350mA/phase at 12v. Since most stepping modes will energize both phases simultaneously, the total current required is 700mA per motor. With two motors wired in parallel, the current demand will be double. All together you will have a total 2.1A current draw at 12v. Limiting the supply to 1A is limiting power to the motors.

User avatar
olivia17
 
Posts: 10
Joined: Wed Jul 29, 2015 2:53 pm

Re: Adafruit motorshield v2 controlling problem

Post by olivia17 »

adafruit_support_bill wrote:Not familiar with Matlab code, but it sounds like you may be a bit underpowered.

Assuming you are referring to the NEMA-17 motors we sell in the store, these require 350mA/phase at 12v. Since most stepping modes will energize both phases simultaneously, the total current required is 700mA per motor. With two motors wired in parallel, the current demand will be double. All together you will have a total 2.1A current draw at 12v. Limiting the supply to 1A is limiting power to the motors.
Thank you so much for the reply ! I just tried to increase the current. However, continuous odd sound of the motors came in. Is that normal?

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

Re: Adafruit motorshield v2 controlling problem

Post by adafruit_support_bill »

continuous odd sound of the motors
Can you elaborate? 10 RPM with 200 steps/rev is about 33 steps/second. That should give you a low-pitch vibration plus a high-pitched whine from the PWM. It is not clear from your code what stepping mode is being used. Different stepping modes would have slightly different characteristic sounds.

User avatar
olivia17
 
Posts: 10
Joined: Wed Jul 29, 2015 2:53 pm

Re: Adafruit motorshield v2 controlling problem

Post by olivia17 »

adafruit_support_bill wrote:
continuous odd sound of the motors
Can you elaborate? 10 RPM with 200 steps/rev is about 33 steps/second. That should give you a low-pitch vibration plus a high-pitched whine from the PWM. It is not clear from your code what stepping mode is being used. Different stepping modes would have slightly different characteristic sounds.
Could you tell me how to check the stepping mode? I assume that's the default mode for the board in Matlab.

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

Re: Adafruit motorshield v2 controlling problem

Post by adafruit_support_bill »

I am assuming that MatLab is talking to some program that you load onto the Arduino. That program will be using the Adafruit Library and you should see the stepping mode specified in the calls to the "step()" function.

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

Return to “Other Arduino products from Adafruit”