UNO for Bipolar Stepper Motor control

Hey friends, I am struggling to get a bipolar stepper up and running. The model has been discontinued and the datasheet is nowhere to be found on the internet, but here are the specs:

Minebea / Astrosyn bi-polar stepper motor. 5 volt, 0.4 amp, 12.5 ohms, 12.5 ohm coils. Shaft diameter (4.992mm) 0.2"D x 0.4"L. 1-5/8" square x 7/8" high. Four leads (Y, R, BK, OR) with four-pin socket connector.

I am trying to use the TB6612FNG dual motor driver from Pololu with an Arduino UNO to no avail. I found this resource linked to on the Pololu site and made the connections based off of that. But the shaft is not spinning. I would appreciate any help that I receive. Below is my code. Thanks!

int positionOne = 8; 
int positionTwo = 9; 
int positionThree = 10; 
int positionFour = 11; 

void setup()
{
}

void loop()
{
  digitalWrite(positionOne, LOW); 
  digitalWrite(positionTwo, HIGH); 
  digitalWrite(positionThree, HIGH); 
  digitalWrite(positionFour, LOW); 
  delay(1); 

  digitalWrite(positionOne, LOW);
  digitalWrite(positionTwo, HIGH); 
  digitalWrite(positionThree, LOW);
  digitalWrite(positionFour, HIGH);
  delay(1);

  digitalWrite(positionOne, HIGH); 
  digitalWrite(positionTwo, LOW); 
  digitalWrite(positionThree, LOW);
  digitalWrite(positionFour, HIGH); 
  delay(1); 

  digitalWrite(positionOne, HIGH);
  digitalWrite(positionTwo, LOW); 
  digitalWrite(positionThree, HIGH); 
  digitalWrite(positionFour, LOW); 
  delay(1); //delay_ms(1);
}

edit 1: also, I am pretty sure it requires 12V, so that is what I am using for VMOT on the driver pin-out.
edit 2: I removed unnecessary info as recommended.

first off, since this is about how to get a specific driver to work, anything other than discussing that motor or that drive is just confusing and should be avoided.

Thanks Dave, I edited the original post to make it clearer.

motor specs
5 volt, 0.4 amp
he motor has 4 leads, where
1 and 3 make up one coil and
2 and 4 make up the second coil.

a schematic of your exact wiring would be in order.

assuming you have AO1 and AO2 on coil 1 you are good.

you did not say if the motor does anything at all.
if it just vibrates, then you have one issue
if it does nothing, you have a different issue.

you are correct that you need 4 pins on the Arudino to drive it.

your program does not make sense to me.

int positionOne = 8; //#define POSITION_ONE PIN_10
int positionTwo = 9; //#define POSITION_TWO PIN_11
int positionThree = 10; //#define POSITION_THREE PIN_12
int positionFour = 11; //#define POSITION_pin FOUR PIN_13

what does this mean ?
is pin_10 on the Arudino ?

Are you sure that you know which lead pairs belong to the coils? If not, use an ohmmeter to determine them.

How did you set STBY high?

How are the PWM inputs on the driver connected?

as for driving the motor, I think you got that wrong.

I am going to use coil A and coil B to refer to the coils

it looks like you power coil A lead0 high and lead1 Low but at the exact same time, you also try to power coilB

try this :

power coilA lead0 high coilA lead1 LOW delay (1) open the circuit, and remove any signals from coil A, this will eleminate any control of the motor.

now power coilB lead0 high coilB lead1 LOW now remove all signanls from both.

what it appers you are doing is powering both coils at the same time.

a stepper needs to alternate. one coil charged. then off and it will discharge

then the next coil gets charged then discharged

then the first coil gets charged in reverse then discharged

then the second coil is charged in reverse then discharged.

this allows the step to occur.

|500x344

I downloaded Fritzing just for you guys. The 9V battery is a stand-in for a 12V power supply. They didn't have the Pololu version of the driver but they had the Sparkfun one so I used it in the mock-up. Anyways, to answer your questions:

dave-in-nj: assuming you have AO1 and AO2 on coil 1 you are good.

you did not say if the motor does anything at all. if it just vibrates, then you have one issue if it does nothing, you have a different issue.

your program does not make sense to me.

what does this mean ? is pin_10 on the Arudino ?

Yes, I have A01 and A02 on one coil and B01 and B02 on the second coil. The motor doesn't do anything at all, it doesn't vibrate or rotate. Those were before I edited the post, I am using digital pins 8, 9, 10, and 11.

jremington: Are you sure that you know which lead pairs belong to the coils? If not, use an ohmmeter to determine them.

How did you set STBY high?

How are the PWM inputs on the driver connected?

Yes, and I used the LED test (connecting an LED to the pin pairs and rotating the shaft to create current and light up the LED) to determine which pairs were which. Motor pins 1 and 3 are one coil and pins 2 and 4 are the second coil, which is weird but that's how it is. I set Standby high by connecting it to 5V from the Arduino. I connected the PWM inputs to the 5V as well, like the guy on the embeddedrelated page said.

dave-in-nj: what it appers you are doing is powering both coils at the same time.

a stepper needs to alternate. one coil charged. then off and it will discharge

then the next coil gets charged then discharged

then the first coil gets charged in reverse then discharged

then the second coil is charged in reverse then discharged.

this allows the step to occur.

Yeah, aren't you supposed to power both coils at the same time in that order for one step to occur (for a bipolar stepper)? 0110 -> 0101 -> 1001 -> 1010. Two pins are changing at a time and at no point are both pins on the same coil the same. This in a loop should make the motor spin, right?

whole step is one coil only.

coilA charged coilA off coilB charged coilB off

one coil, then the other, then the first.... that is whole step.

coilA charged by itself then coilA remans charged and coilB is charged coilA is off, coil B remains charged coilA reverse charge and coilB remains charged coilB is off, coilA reverse remains charges.

this is half step. one coil, then both, then just the second, then both, and so on....

that is the best you can get with a simple H-bridge

01-- --10 10-- --01

the above if full step. below is half step.

01-- 0101 --01 1001 10-- 1010 --10

Thank you so far for the help, but I haven’t gotten it to work yet. I used the following for full-stepping, but it didn’t work:

int positionOne = 8; 
int positionTwo = 9;  
int positionThree = 10; 
int positionFour = 11;  

void setup()
{
}

void loop()
{
  digitalWrite(positionOne, LOW); 
  digitalWrite(positionTwo, HIGH); // first coil
  digitalWrite(positionThree, LOW); 
  digitalWrite(positionFour, LOW); 
  delay(1); 

  digitalWrite(positionOne, LOW); 
  digitalWrite(positionTwo, LOW); 
  digitalWrite(positionThree, HIGH); // second coil
  digitalWrite(positionFour, LOW);
  delay(1);

  digitalWrite(positionOne, HIGH); // first coil again
  digitalWrite(positionTwo, LOW); 
  digitalWrite(positionThree, LOW);
  digitalWrite(positionFour, LOW); 
  delay(1); 

  digitalWrite(positionOne, LOW); 
  digitalWrite(positionTwo, LOW);  
  digitalWrite(positionThree, LOW); 
  digitalWrite(positionFour, HIGH); /second coil again
  delay(1); 
}

What did I do wrong?

Response #7 is not correct. In full step mode, with a bipolar motor, both coils are always activated. The step is accomplished by reversing the current direction in one coil.

What happened when you ran the last program posted?

If you mean the one I wrote from Response #9, nothing happened. It didn’t vibrate and the shaft didn’t rotate.

cosined:
If you mean the one I wrote from Response #9, nothing happened. It didn’t vibrate and the shaft didn’t rotate.

Then there is a really basic problem. The motor shaft should jump and become hard to turn if current is flowing through either or both of the coils, so it seems that the motor is not getting any power at all.

Measure the voltages at all the motor driver inputs and outputs with a multimeter, and let us know what you find.

Note: although Fritzing diagrams are almost completely useless (hand drawn schematics are almost always better), it did remind me that the power and ground tracks along both edges of protoboards are often separated right down in the middle. The way you have it drawn, the Arduino +5 and ground may not be connected to the motor driver +5 and ground. You may need jumpers across the divide.

Life would be very much easier if you use a specialized stepper motor driver. A Pololu A4988 would be suitable for your 0.4 amp motor.

Have a look at stepper motor basics and this simple stepper code.

...R

HI, Can you supply the part number of the motor please. And a picture of your project. What size protoboard are you using. If it is a long board then check that you have continuity along the full length of the red and blue rails down the sides of the protoboard. Some boards had a break halfway along. Do you have a DMM to measure circuit parameters? Tom..... :)

jremington:
It seems that the motor is not getting any power at all.

Measure the voltages at all the motor driver inputs and outputs with a multimeter, and let us know what you find.

The way you have it drawn, the Arduino +5 and ground may not be connected to the motor driver +5 and ground. You may need jumpers across the divide.

That actually could be the case upon quickly checking it, I’ll give you a more concrete answer later since I have to go somewhere right now.
The breadboard is one from an Arduino kit, see the images below. I verified that the power and ground lines are continuous down the board.

Robin2:
Life would be very much easier if you use a specialized stepper motor driver. A Pololu A4988 would be suitable for your 0.4 amp motor.

Have a look at stepper motor basics and this simple stepper code.

You’re right, I am sure of it. My instructor for an instrumentation class gave me this chip though and I would hate to disappoint him and tell him I couldn’t get it to work. I checked those links, they’re pretty thorough. Good write-ups! But because of the mentioned circumstances, I really would like to get this driver working with the stepper.

TomGeorge:
Can you supply the part number of the motor please.
And a picture of your project.
What size protoboard are you using.
If it is a long board then check that you have continuity along the full length of the red and blue rails down the sides of the protoboard.
Do you have a DMM to measure circuit parameters?
Tom… :slight_smile:

The part number is an MINEBEA Astrosyn 17PY-Q202-03. It’s been discontinued and there is next to nothing on Google and Bing regarding it. That’s why I left out the part number in the first post.
Here’s some pictures, they’re probably not of much help. I am using a old variable power supply to power the 12V requirement of the motor.
I think it’s a half size protoboard? It’s not a full size.
Yes, there is continuity.
Yes, I have a multimeter and also an oscilloscope. I’ve been using the oscilloscope though to see what’s going on more effectively. I’ll check out the inputs and outputs in more detail when I return.
Here’s the pictures:

Thank you guys for your help so far.

jremington: Response #7 is not correct. In full step mode, with a bipolar motor, both coils are always activated. The step is accomplished by reversing the current direction in one coil.

What happened when you ran the last program posted?

when both coils are activated, the motor is halfway between a full step. you would be correct in that it would appear to do full steps, but it would actually be going from half way between one full step and the next.

in full step only one coil needs to be activated at a time, they just alternate. this is also called a wave drive. both wave and full step (2 coils activated) do the same thing, move from one step to the next you are correct that in order to step, the coils are energized in reverse from the last charge of that coil.

anything after half stepping and both coils are energized, but at varying currents so that the motor will be held in the balance of the magnetic fields.

Since the OP was having a problems, the idea of eliminating possible errors such as not getting the sequences correct would (in my mind) be to simplify things to the minimum required.

cosined: My instructor for an instrumentation class gave me this chip though and I would hate to disappoint him and tell him I couldn't get it to work. I checked those links, they're pretty thorough. Good write-ups! But because of the mentioned circumstances, I really would like to get this driver working with the stepper.

that is why post #1 was dead on. any discussion of other drivers is just confusing and not on topic. of course you can get other things to work, but that was not what was asked.

in looking at the data sheet, I am not sure what you do with the PWM input.

many stepper drivers have an enable pin.
many easy to use drivers, like the venerable L298 let you select the current by means of a resistor on an input pin.

it looks like PWM (each channel) and standby(pin 19) are always pulled high to let the unit step.

Alright, I checked the outputs and inputs. The outputs from the Arduino UNO (which are the same as the inputs of the TB6612FNG controller) work. I edited the code to have 2000ms delays to make it noticeable on the oscilloscope, and they're good. However, the outputs from the controller (inputs to the motor coils) aren't receiving high at any point. So the motor isn't getting powered... Maybe I hooked up the I/O's wrong by switching the polarities on the motor? The coils are definitely paired up correctly though. I'll try the four possible combinations to see if this was the problem. I wish the datasheet existed...

dave-in-nj: Since the OP was having a problems, the idea of eliminating possible errors such as not getting the sequences correct would (in my mind) be to simplify things to the minimum required.

You might be correct with the sequences in that I may have reversed the polarities for one or both of the coils, so the high-low sequence for a step wouldn't work. I'll check it as I mentioned above.

dave-in-nj: in looking at the data sheet, I am not sure what you do with the PWM input.

it looks like PWM (each channel) and standby(pin 19) are always pulled high to let the unit step.

I just followed what the person did in the tutorial using the TB6612FNG. I made those pins (and standby) go high accordingly, to 5V.