Mixed power sources, stepper motors, arduino, and pololu stepper driver

I'm building a 3D printer and I'm a little over my head. Right now I'm trying to make sure most of my components play nice with each other with some simple code and only one motor.  Here's my set-up:

I have a seeeduino mega. More on the pinouts later. It's being powered via USB and I don't know if that's okay.

 

I have some of these cheap stepper motors, 95 cents each and with basically no specifications at all. They have four leads, so they're definitely bipolar. I don't really have to use these, but I would prefer to, since, you know, I have them.

0J1420.200.jpg

Then, I have a pololu stepper motor driver with soldered-on header pins. If I get one of these to work I'm gonna buy more, but I don't want to spend the money without proof-of-concept. 

I think I have the stepper motor correctly hooked up to pins 1a-2b, but I might be wrong. VMOT and GRD are connected to a 12V PC power supply. VDD and GND are connected to the 5V output on the same power supply and, of course, the ground. MS1, MS2, MS3 (which are used to control microstepping - all of them off means a full step according to pololu), RESET, SLEEP, STEP, and DIR all go to the arduino. 

Here is my arduino code:

 

int enable =  22;

int MS2 = 23;

int MS2 = 24;

int MS3 = 25;

int reset = 26;

int sleep = 27;

int stp = 28;

int direct = 29;

 

 

void setup()   {                

  pinMode(enable, OUTPUT);   

  pinMode(MS1, OUTPUT); 

  pinMode(MS2, OUTPUT);    

  pinMode(MS3, OUTPUT);   

  pinMode(reset, OUTPUT); 

  pinMode(sleep, OUTPUT); 

  pinMode(stp, OUTPUT);

  pinMode(direct, OUTPUT); 

 

  digitalWrite(enable, LOW);

  digitalWrite(sleep, HIGH);

  digitalWrite(reset, HIGH);

}

 

 

void loop()                     

{

  delay(10);   

  digitalWrite(direct, HIGH);  

  digitalWrite(stp, HIGH);   

  delay(10);                 

  digitalWrite(stp, LOW);    

  delay(1000);    

  digitalWrite(direct, LOW);  

  digitalWrite(stp, HIGH);   

  delay(100);                 

  digitalWrite(stp, LOW); 

  delay(900); 

}

 

 

All good, right? Well, the problem is that this produces a spectacular display of nothing. I have a couple of problems here but don't know how valid they are. 

1) Is it okay to have the arduino powered by USB but the motor controller powered by the power supply? 

2) How should I proceed testing the motors? There is a current-limiting potentiometer on the stepper driver and they can drive up to 2A. Again, I have no specs on the motors. Should I just turn it up until I see something?

3) Is my code okay? The datasheet says STEP is triggered by a high to low change, so that seems like it should work. But then again, I'm a little inexperienced with stepper motors. 

I would just tinker with these, but I'm not very experienced with high voltage/current power supplies and I don't want to ruin something or kill myself. 

Also, if nothing else works, I'm totally fine with ditching the surplus steppers and buying new, specification-laden ones. But you know.

All help is really appreciated. Really. Thanks!

I’m actually using an old

I’m actually using an old computer power supply. :stuck_out_tongue:

The thing is, I’m not getting anything at all with that code. I’ve had my fingers on the motor shaft. I’ve also tried all one direction, and nothing.

But yeah, I’m powering that motor with 12V which seems like it should be about right. I can make that motor stall with a 9V battery (albeit with not very much torque), and I’m not getting anything like that.

Yeah, I definitely should try connecting the USB and power supply.ground together or maybe just make it all power supply. I will do that as soon as I get a chance.

After I do all that, though, everything should be working, correct? And if it doesn’t, I just up the current until it does?

 

My bet would be stepper

My bet would be stepper motor wires connected wrong. Disconnect the stepper and short 2 of the contacts then try twisting the rotor in your fingers. If you feel a little bit of friction then those are the 2 ends of one of the coils and should be 1A-1B, and same for the other pair.