Hi.
I unpacked an Adafruit Motor Shield V2 for Arduino.
I connected a stepper motor (sm-42byg011-25,nema 16) to the shield and arduino uno, and upload example code (examples >> motor shield v2 library >> Stepper test) to the arduino board.
However, I've got a problem. The stepper motor just goes forward, even though in all the BACKWARD lines (e.g.) myMotor->step(100, BACKWARD, DOUBLE), the motor still goes forward.
I provide 12V 1A to the arduino board, and jumper vin pins are connected together.
I am not sure whether other rotate types (SINGLE, INTERLEAVE, MICROSTEP) are also working well.
In the SINGLE types command, the motor looks like they are not moving.
The cables from the moter are connected to the M1 and M2 block with this oder.
R Y - G B (my motor has blue line not a grey or black one)
ㅁ ㅁ ㅁ ㅁ ㅁ
M2 GND M1
I would like to know what cause this problems.
Thanks!
Stepper motor just turns forward..not backward.
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- bebeam
- Posts: 7
- Joined: Tue Aug 18, 2015 3:44 pm
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: Stepper motor just turns forward..not backward.
how are you limiting the current to 1A?I provide 12V 1A to the arduino board
If you are supplying external power, you should not use the VIN jumper. https://learn.adafruit.com/adafruit-mot ... wer-supplyand jumper vin pins are connected together.
Plug in the USB cable. Then connect the motor supply to the power terminal block on the shield. Do not place the jumper on the shield.
- bebeam
- Posts: 7
- Joined: Tue Aug 18, 2015 3:44 pm
Re: Stepper motor just turns forward..not backward.
how are you limiting the current to 1A?
How can I limit the current? Should I use a power supply machine? (sorry! I am not familiar with the electrical parts,
so I need more details about it, )
I used a power supply adapter and connected it to the arduino board.
Firstly, I tried with this adapter...
and then I used this one.
Both weren't working and I attached the video that is showing a current status of my stepper motor.
https://www.youtube.com/embed/nIrBwmwPWTc
Even though the command is in the BACKWARD code line, the motor just goes FORWARD..
Without the VIN jumper, my motor shield couldn't get the power. Probably I couldn't understand exactly about the power.
If you are supplying external power, you should not use the VIN jumper. https://learn.adafruit.com/adafruit-mot ... wer-supply
Could you watch the video above the link? I would like to know why the problems happened.
Many thanks!
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: Stepper motor just turns forward..not backward.
So you are powering the motors from the Arduino instead of the external power connector. That should be OK for a small motor like this one.
Some of your solder joints have not flowed well onto the solder pads. This guide shows how to fix those.
https://learn.adafruit.com/adafruit-gui ... n-problems
Please post the code you are using to test.
Some of your solder joints have not flowed well onto the solder pads. This guide shows how to fix those.
https://learn.adafruit.com/adafruit-gui ... n-problems
Please post the code you are using to test.
- bebeam
- Posts: 7
- Joined: Tue Aug 18, 2015 3:44 pm
Re: Stepper motor just turns forward..not backward.
Now I've checked the soldering again, but the problem is still same..Some of your solder joints have not flowed well onto the solder pads. This guide shows how to fix those.
https://learn.adafruit.com/adafruit-gui ... n-problems
Which pins should I check especially?
I used this code.Please post the code you are using to test.
Code: Select all
/*
This is a test sketch for the Adafruit assembled Motor Shield for Arduino v2
It won't work with v1.x motor shields! Only for the v2's with built in PWM
control
For use with the Adafruit Motor Shield v2
----> http://www.adafruit.com/products/1438
*/
#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_PWMServoDriver.h"
// Create the motor shield object with the default I2C address
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
// Or, create it with a different I2C address (say for stacking)
// Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61);
// Connect a stepper motor with 200 steps per revolution (1.8 degree)
// to motor port #2 (M3 and M4)
Adafruit_StepperMotor *myMotor = AFMS.getStepper(200, 1);
void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Stepper test!");
AFMS.begin(); // create with the default frequency 1.6KHz
//AFMS.begin(1000); // OR with a different frequency, say 1KHz
myMotor->setSpeed(10); // 10 rpm
}
void loop() {
Serial.println("FORWARD");
myMotor->step(100, FORWARD, DOUBLE);
Serial.println("BACKWARD");
myMotor->step(100, BACKWARD, DOUBLE);
}
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: Stepper motor just turns forward..not backward.
The important pins for the shield are GND, +5v, VIN, SDA and SCL.
- bebeam
- Posts: 7
- Joined: Tue Aug 18, 2015 3:44 pm
Re: Stepper motor just turns forward..not backward.
The problem is not solved, so I am still looking for the cause.
I am wondering whether the headers I attached on the board can be one of the possibility to cause the problems...
I am wondering whether the headers I attached on the board can be one of the possibility to cause the problems...
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: Stepper motor just turns forward..not backward.
Those headers should not cause any problems.
Please post the output of the serial monitor while the test program is running.
Please post the output of the serial monitor while the test program is running.
- bebeam
- Posts: 7
- Joined: Tue Aug 18, 2015 3:44 pm
Re: Stepper motor just turns forward..not backward.
http://youtu.be/1S299BdEysw
Here is the video that is showing my motor and Serial console in Arduino.
Thanks!!
Here is the video that is showing my motor and Serial console in Arduino.
Thanks!!
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: Stepper motor just turns forward..not backward.
Not sure what is going wrong there. Does it behave the same way if you run it as stepper #2 (M3-M4)?
- bebeam
- Posts: 7
- Joined: Tue Aug 18, 2015 3:44 pm
Re: Stepper motor just turns forward..not backward.
Yes, I did. However, the problem was not solved.
Do other people who use the same motor (like a nema17) have no similar problems like mine?
If there is no solution, I should buy another motor driver and test it with other ones.
Do other people who use the same motor (like a nema17) have no similar problems like mine?
If there is no solution, I should buy another motor driver and test it with other ones.
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: Stepper motor just turns forward..not backward.
The specifications for that motor are very similar to the one we sell here: https://www.adafruit.com/product/324
And we have very few problems with these.
The Motor shield itself seems to be functioning since it needs to exercise all 4 possible states of the H-bridges to drive the motor forward. The only difference in driving a motor backward is the order of those states.
I don't see any problems in the code, and from the output it seems to be running properly. Do you have access to another motor or another driver you could test with?
And we have very few problems with these.
The Motor shield itself seems to be functioning since it needs to exercise all 4 possible states of the H-bridges to drive the motor forward. The only difference in driving a motor backward is the order of those states.
I don't see any problems in the code, and from the output it seems to be running properly. Do you have access to another motor or another driver you could test with?
- bebeam
- Posts: 7
- Joined: Tue Aug 18, 2015 3:44 pm
Re: Stepper motor just turns forward..not backward.
The problem was solved.
I tested again with a adafruit's motor and finally it worked well.
The motor shield also worked well.
Thanks!
I tested again with a adafruit's motor and finally it worked well.
The motor shield also worked well.
Thanks!
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: Stepper motor just turns forward..not backward.
Thanks for the follow-up. It is not uncommon to find a stepper that runs better in one direction than the other. But I don't believe I have ever seen one that would always step in the same direction like that one.
Please be positive and constructive with your questions and comments.