Go Down

Topic: Can't Get My Motor and Driver Set Up Again (Read 1 time) previous topic - next topic

Asa Herring

Oct 15, 2013, 06:03 am Last Edit: Oct 15, 2013, 06:04 am by Asa Herring Reason: 1
http://www.youtube.com/watch?v=HljKA6N88uc&feature=youtu.be

I bought a couple of A4983
http://www.pololu.com/catalog/product/1202
replacement boards and hooked one up to my 1205
http://www.pololu.com/catalog/product/1205
motor. I had this running quite well a few months ago when I last had it all set up. I can't get it to run right. I don't know what I have done wrong.

The motor runs smoothly but slowly and it won't stop. I tried different sets of code and get the same results. I set the for loop to only run 10 steps. I added different delays but they are ignored. I thought that the Arduino wasn't getting updated so I took out the code void loop except for one integer. The motor reacted by not running and locking up like I thought that it would. When I put the write code back in, it runs as before.

What can I do to fix this?

This is one of the sets of code that I used.
Code: [Select]
   #define stepPin 42
   #define dirPin 44
   #define enablePin 46

   void setup()
   {
     // We set the enable pin to be an output
     pinMode(enablePin, OUTPUT);
     // then we set it HIGH so that the board is disabled until we
     // get into a known state.
     digitalWrite(enablePin, HIGH);
     Serial.begin(9600);
     Serial.println("Starting stepper exerciser.");
     pinMode(stepPin, OUTPUT);
     pinMode(dirPin, OUTPUT);
   }

   void loop()
   {
   int j;
   digitalWrite(enablePin, LOW);
   delayMicroseconds(2);
   digitalWrite(dirPin, HIGH);

   for(j=0; j<=10; j++)
     {
      digitalWrite(stepPin, LOW);
      delayMicroseconds(2);
      digitalWrite(stepPin, HIGH);
      delayMicroseconds(1000);
      Serial.println(j);
     }
     digitalWrite(enablePin, HIGH);
     delayMicroseconds(10000);
     //delay(3000);
     //while(j==10000)
     Serial.println(j);
     Serial.println("Loop");
}
I have an Arduino Mega 2560. I also have a (pH) BNC Sensor Shield,an I2C/SPI/Onewire Shield(I beleive that it an on board clock.)and a Breakout Board Shield, all three are from Andrew Oke. Additionally, I have a Stepping Motor but could certainly buy a Servo Motor instead if it is any better for what I want to do, short term/long term. Trying to read the lable, I guess that it is: Type 57BYG. 12 V/Phase, 20ohm, 0-6A/Phase 1.8 Deg/Step, No. 04052 with a K179 Stepper Driver board attached. I can't confirm that the board is fully funtional

Chagrin

You only have 10 milliseconds of delay (delayMicroseconds(10000);) between each of your loops of 10 steps.

What are your Serial.prints showing?

Asa Herring

#2
Oct 17, 2013, 03:29 pm Last Edit: Oct 17, 2013, 08:47 pm by Asa Herring Reason: 1
Thank you for responding. I tried different time periods and posted the wrong one.

I believe that I found the problem. I think that I have a problem with my pin 44 on the Arduino. When I move the three pin connector from 42, 44 and 46 to 32, 34, and 36, it runs just like before. It also works 43, 45 and 47.

Thanks again.
I have an Arduino Mega 2560. I also have a (pH) BNC Sensor Shield,an I2C/SPI/Onewire Shield(I beleive that it an on board clock.)and a Breakout Board Shield, all three are from Andrew Oke. Additionally, I have a Stepping Motor but could certainly buy a Servo Motor instead if it is any better for what I want to do, short term/long term. Trying to read the lable, I guess that it is: Type 57BYG. 12 V/Phase, 20ohm, 0-6A/Phase 1.8 Deg/Step, No. 04052 with a K179 Stepper Driver board attached. I can't confirm that the board is fully funtional

Go Up