Pages: [1]   Go Down
Author Topic: Ardiuno UNO, a4983 driver and stepper motor  (Read 1119 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Code:
// 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


* 4.JPG (635.09 KB, 1632x1224 - viewed 46 times.)
Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What is the board on the breadboard?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

are you talking about the "a4983 driver"?
Logged

Canada
Offline Offline
Sr. Member
****
Karma: 0
Posts: 318
Sometimes teaching, always learning,
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
    ///// 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.
Logged


Pages: [1]   Go Up
Jump to: