Let's Make Robots!

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:

Seeeduino Mega fully Assembled

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.

 

Molon Mystery

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.

A4983 Stepper Motor Driver Carrier

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!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ezekiel181's picture

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.

OddBot's picture

If it does't work after your grounds are connected then I would suspect that either you have wired up the stepper incorrectly or that it is a 24V stepper.

wayland's picture

I'm actually using an old computer power supply. :P

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?

 

OddBot's picture

CODE:
I think it is not visibly doing anything because you tell the motor to step forward and then 1000mS later you tell it to step backward. Leave the direction set high or low in the setup and just toggle the step in your loop. If the motor is not turning then you have probably wired something wrong.

POWER:
Those sort of stepper motors often require 12V or more. It is ok to powere your Mega with the USB but remember that unless your USB ground is connected to the ground of the powersupply for the stepper motor driver board then nothing will happen because no signal will pass from the Mega to the motor controller.

If you want to make a 3D printer then I suggest an old computer power supply will be perfect as it has both 5V and 12V supplies.