Stepper motor just turns forward..not backward.

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
bebeam
 
Posts: 7
Joined: Tue Aug 18, 2015 3:44 pm

Stepper motor just turns forward..not backward.

Post by bebeam »

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!

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

Re: Stepper motor just turns forward..not backward.

Post by adafruit_support_bill »

I provide 12V 1A to the arduino board
how are you limiting the current to 1A?
and jumper vin pins are connected together.
If you are supplying external power, you should not use the VIN jumper. https://learn.adafruit.com/adafruit-mot ... wer-supply
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.

User avatar
bebeam
 
Posts: 7
Joined: Tue Aug 18, 2015 3:44 pm

Re: Stepper motor just turns forward..not backward.

Post by bebeam »

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

Image

and then I used this one.

Image


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

If you are supplying external power, you should not use the VIN jumper. https://learn.adafruit.com/adafruit-mot ... wer-supply
Without the VIN jumper, my motor shield couldn't get the power. Probably I couldn't understand exactly about the power.
Could you watch the video above the link? I would like to know why the problems happened.

Many thanks!

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

Re: Stepper motor just turns forward..not backward.

Post by adafruit_support_bill »

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.

User avatar
bebeam
 
Posts: 7
Joined: Tue Aug 18, 2015 3:44 pm

Re: Stepper motor just turns forward..not backward.

Post by bebeam »

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
Now I've checked the soldering again, but the problem is still same..
Which pins should I check especially?
Please post the code you are using to test.
I used this code.

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);
}

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

Re: Stepper motor just turns forward..not backward.

Post by adafruit_support_bill »

The important pins for the shield are GND, +5v, VIN, SDA and SCL.

User avatar
bebeam
 
Posts: 7
Joined: Tue Aug 18, 2015 3:44 pm

Re: Stepper motor just turns forward..not backward.

Post by bebeam »

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

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

Re: Stepper motor just turns forward..not backward.

Post by adafruit_support_bill »

Those headers should not cause any problems.

Please post the output of the serial monitor while the test program is running.

User avatar
bebeam
 
Posts: 7
Joined: Tue Aug 18, 2015 3:44 pm

Re: Stepper motor just turns forward..not backward.

Post by bebeam »

http://youtu.be/1S299BdEysw
Here is the video that is showing my motor and Serial console in Arduino.

Thanks!!

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

Re: Stepper motor just turns forward..not backward.

Post by adafruit_support_bill »

Not sure what is going wrong there. Does it behave the same way if you run it as stepper #2 (M3-M4)?

User avatar
bebeam
 
Posts: 7
Joined: Tue Aug 18, 2015 3:44 pm

Re: Stepper motor just turns forward..not backward.

Post by bebeam »

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.

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

Re: Stepper motor just turns forward..not backward.

Post by adafruit_support_bill »

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?

User avatar
bebeam
 
Posts: 7
Joined: Tue Aug 18, 2015 3:44 pm

Re: Stepper motor just turns forward..not backward.

Post by bebeam »

The problem was solved.
I tested again with a adafruit's motor and finally it worked well.
The motor shield also worked well.

Thanks!

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

Re: Stepper motor just turns forward..not backward.

Post by adafruit_support_bill »

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.

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

Return to “Arduino Shields from Adafruit”