LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Angular Position Measurement of a Stepper Motor

Hello,

in a pretty complex VI, I want to generate a continuous pulse train in order to drive a stepper motor.

Next, I want to stop the pulse train when the stepper motor reached a certain position. Therefore, I want to measure the position of the stepper motor using an angular encounter.

To minimize the probability of software errors, I used the example for angular position measurements to post it here, as I have the same problem as in my program:

 

When I run the pulse train very slowly (around 1 Hz), the "data-indicator" alternates between 0 and 0.75 each step: 0  0.75   0   0.75   0 ...

From my understanding, I should be getting an increasing number, as the angular position increases with every step by (in my case) 15 degr.

I cannot really understand the alternation.

 

Thanks for any help.

 

0 Kudos
Message 1 of 6
(3,684 Views)

Let's ignore the pulse train for a moment.  Can you connect the encoder on its own and test it out, rotating the shaft by hand?  When you do this, does it read properly?

0 Kudos
Message 2 of 6
(3,678 Views)

Thanks for the answer.

Now I just used the "measure angular position" example, and turned the motor by hand.

Here the results for the different decoding types:

X1: nothing (stays at 0)

X2: nothing (stays at 0)

X4: the result described before: alternating between 0 and 0.75

2 pulse counting: the values decrease continuously... So I get negative values for both directions! One full rotation gives me something like -6xx in either direction.

 

Really confusing. I wired channel A and B to PFI0 and PFI1 on my USB 6211.

 

Thankful for any hints.

0 Kudos
Message 3 of 6
(3,662 Views)

I tried the same thing with the MAX. Creating the task, running the test. Same results.

I don't understand where my mistake might be. I turn the motor by hand, I checked the wiring. Smiley Frustrated

 

0 Kudos
Message 4 of 6
(3,648 Views)

If you have not already read "Encoder Measurements: How-To Guide" you may find it helpful as a starting point.  Sounds to me like a wiring problem, or possibly a bad encoder.  I assume you are not using the Z index, and that in addition to the A and B channels you've connect a ground reference.  I would check the A and B channels independently.  You could do this by setting up a simple DAQmx counter task for each channel and see if it counts up as you rotate the shaft.  You might also catch the pulses with an oscilloscope, or with a multimeter if you rotate the shaft slowly. 

0 Kudos
Message 5 of 6
(3,647 Views)

Thanks,

I tried the independant counting before:

Using channel B - I can count probably,

however, channel A does not work.

From my understanding it sould do the same just 90 degr out of phase as opposed to channel B (?). If that is correct, I think a faulty encounter is the only way I can explain the issue...

0 Kudos
Message 6 of 6
(3,644 Views)