Saturday, May 22, 2010

stepper driver noise and test code

i need to do some more work on my design i think, i can use one stepper driver alone and it works great but has soon has i get 2 or more on it, i dose now work nearly so well, i am not sure if it is a power issue i switched to a bigger wall wort, from 12V and 500 mA to one that is 12V 1000mA and it did seem to work a little better, so i will see if i have any  bigger ones and see what else i can find here too try.

but they all make allot more noise than they should, i added some capasitors and they helped allot but so far i need to figure out what my issue is, i think i will be remaking my board so that i can have a better power layout, and so that i have room to have the caps in the proper places.

that and i could use some help with my arduino, i am trying to figure out how to make my code so that all 3 steppers will turn at the same time, now they just do it one at a time. here is my code that i have modified from another site


/********************************************************
**         More info about the project at:             **
**  http://lusorobotica.com/viewtopic.php?t=103&f=106  **
**   by TigPT         at         [url=http://www.LusoRobotica.com]www.LusoRobotica.com[/url]  **
*********************************************************/
int dirPin1 = 3;
int stepperPin1 = 2;
int dirPin2 = 5;
int stepperPin2 = 4;
int dirPin3 = 7;
int stepperPin3 = 6;
int dirPin4 = 9;
int stepperPin4 = 8;

void setup() {
  pinMode(dirPin1, OUTPUT);
  pinMode(stepperPin1, OUTPUT);
  pinMode(dirPin2, OUTPUT);
  pinMode(stepperPin2, OUTPUT);
  pinMode(dirPin3, OUTPUT);
  pinMode(stepperPin3, OUTPUT);
  pinMode(dirPin4, OUTPUT);
  pinMode(stepperPin4, OUTPUT);
}

void step(boolean dir,int steps){
  digitalWrite(dirPin1,dir);
  delay(750);
  for(int i=0;i
    digitalWrite(stepperPin1, HIGH);
    delayMicroseconds(1000);
    digitalWrite(stepperPin1, LOW);
    delayMicroseconds(1000);
      }
  digitalWrite(dirPin2,dir);
  delay(750);
  for(int i=0;i
    digitalWrite(stepperPin2, HIGH);
    delayMicroseconds(1000);
    digitalWrite(stepperPin2, LOW);
    delayMicroseconds(1000);
      }
   digitalWrite(dirPin3,dir);
  delay(750);
  for(int i=0;i
    digitalWrite(stepperPin3, HIGH);
    delayMicroseconds(1000);
    digitalWrite(stepperPin3, LOW);
    delayMicroseconds(1000);
      }
   digitalWrite(dirPin4,dir);
  delay(50);
  for(int i=0;i
    digitalWrite(stepperPin4, HIGH);
    delayMicroseconds(50);
    digitalWrite(stepperPin4, LOW);
    delayMicroseconds(50);
  }
}


void loop(){
  step(true,1000);
  delay(600);
  step(false,1000);
  delay(600);
}

i can under stand code when i read it but i can never get it out how i want it, took me some time to get this too work.

i think there could be an issue with the fact all my step and dir pins are all beside each other. maybe that could be the cause of some of the noise, but if that was the case it should still do it, if there was just one stepper on it.

4 comments:

  1. Wall warts are really bad power. Most are just rectified ac with no regulation or smoothing. 1 amp is very low since each motor could be drawing 1.5 amps when running. I am assuming that your parts are similar to the makerbot stuff. Can you load the makerbot firmware and replicator G. It has an easy to use front end, just no stepper extruder support.
    Jeff

    ReplyDelete
  2. Try a computer power supply instead of a wallwart.
    If each motor takes 2A and your heater takes another 2A you'll need a supply that can deliver 10A at least.

    Also measure the voltage coming out of your power supply while you are using all three motors, if it drops more than 20% you need a better supply.
    No voltmeter? Get a cheap digital multimeter, you won't regret it...


    Step and dir pins being close to each other is definitely not a problem, stop worrying about that possibility ;-)

    ReplyDelete
  3. Try changing the step() bit to this:


    void step(boolean dir,int steps){
    digitalWrite(dirPin1,dir);
    digitalWrite(dirPin2,dir);
    digitalWrite(dirPin3,dir);
    digitalWrite(dirPin4,dir);
    delay(750);
    for(int i=0;i
    digitalWrite(stepperPin1, HIGH);
    digitalWrite(stepperPin2, HIGH);
    digitalWrite(stepperPin3, HIGH);
    digitalWrite(stepperPin4, HIGH);
    delayMicroseconds(1000);
    digitalWrite(stepperPin1, LOW);
    digitalWrite(stepperPin2, LOW);
    digitalWrite(stepperPin3, LOW);
    digitalWrite(stepperPin4, LOW);
    delayMicroseconds(1000);
    }
    }


    and leave the beginning, setup, and loop bits as they are. This will turn all 4 steppers at the same time.

    :-)

    Renoir

    ReplyDelete
  4. thanks for the tip, when i get a few more parts in i have an old psu that i will be modifying for thie project, but i need to find a resistor to give it a big enough load to stay on, kinda wish the old AT psu's were still available. they would be great for that kinda modding.

    but in the next few days i should be able to do something creative,

    ReplyDelete