Go Down

Topic: Ardiuno UNO, a4983 driver and stepper motor (Read 1 time) previous topic - next topic

itamar

Hi
My Motor doesn't move, i think its a problem with the code

Code: [Select]
// Stepper
    #include <Stepper.h>

    // steps value is 360 / degree angle of motor
    #define STEPS 200

    // create a object on pins 6 and 7
    Stepper stepper(STEPS, 6,7);

    void setup()
    {
    }
    void loop()
    {
    ///// Turn the stepper 200 steps with a 1 sec delay between steps at 60rpm
    /// then reverse the direction and do 50 steps at 20rpm with a 1sec delay between steps
    stepper.setSpeed(1);
    stepper.step(200);
    //delay(1000);
    //stepper.setSpeed(20);
    //stepper.step(-50);
    //delay(1000);
    }


i am using 12V battery, this motor:
http://www.sparkfun.com/datasheets/Robotics/SM-42BYG011-25.pdf

i am attaching a pic of the Arduino for you to look at.

hope somebody cold help me here...
Itamar

dxw00d

I can't see anything connected to the ground (GND) pins.

itamar

the GND is connected to  22/j (green wire)

dxw00d

There is nothing connected to the Arduino's ground pins.

itamar

sorry for the ignorant but i am not sure what do you mean..

i change the code a little bit and now theirs a movement of millimeter (left & right)

dxw00d

Whatever the board on the breadboard is, should have it's ground (or GND) connected to the Arduino's ground (GND - just below the 5v pin).

itamar

OK. isnt it the same as the GND above the 13 pin?

anyway i am getting the same result from the motor...

dxw00d

Sorry, you're right. The text was hidden by the wire.

dxw00d


itamar

are you talking about the "a4983 driver"?

John_S

Code: [Select]
    ///// Turn the stepper 200 steps with a 1 sec delay between steps at 60rpm
    /// then reverse the direction and do 50 steps at 20rpm with a 1sec delay between steps
    stepper.setSpeed(1);

1 sec delay between steps at 60 RPM doesn't make sense. If you have a 200 step motor and 60 RPM, it will need 200 steps per second, not 1. Likewise, 1 second between steps is about 60/200 RPM, or 0.3RPM.

stepper.setSpeed(1) sets your speed to 1 RPM, not 60. Try setting the value to 100 or so and see if it is actually working.
http://jsrintervalometers.blogspot.ca

Go Up