From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

Stepper works in open loop mode but not in closed loop mode

Solved!
Go to solution

I am trying to get a closed loop stepper system to work. Motor is setup with 2000 microsteps per rev using an NI 2000 CPR encoder which really means 4000 cnts per rev in MAX. It works fine in open loop mode. It does strange things in closed loop mode like going back and forth like a washing machine. I am not talking chatter but large shaft rotations. I am not trying to code yet just get it working in MAX. I can disable the motor and turn the shaft by hand and 4000 cnts per rotation seems to be correct. I have used servos before and I was thinking this would be easy compared to that but it does not work. I am going backwards in some respects by going from servos to steppers. The reason is that the servos are causing a ton of EMI that is messing up other aspects of the test system. Open loop steppers are not accurate enough and I am getting slip and hysterisis that is causing things not to line up properly.

 

The system is controlled using a PCI-7344 motion control card and everything is connected to a UMI-7764 breakout box. A, A-, B, B-, IDX, IDX- are connected as well as the 5V line. I am assuming the PID parameters used for servos are not use for closed loop steppers.

 

Perry

0 Kudos
Message 1 of 2
(2,660 Views)
Solution
Accepted by topic author pgray

Ok looks like the problem is that the encoder was not set to the proper value in MAX. The problem is that the the CPR can be 2000, 4000, or 8000 depending on how the encoder is read. NI reads every transition so the CPR is 8000 and I could not find anything that said how it was being read in the documetation just that it could be any one of 3 values. So really the CPR of the encoder is 8000 not 2000. Another issue I encountered that the the encoder was reading clockwise in one direction and the motor clockwise was opposite. I think I changed the state from high to low on one of the encoder pulses in MAX and that fixed that.

 

You can read the encoder in MAX by pulling the power to the motor power supply and turning the shaft by hand. If the encoder value goes negative when you turn the shaft to the right then then change one of the pulses from high to low on the encoder in MAX. You can operate the motor in open loop mode and command it clockwise. If the motor turns to the right then you know that it is working properly.

 

 

Perry

0 Kudos
Message 2 of 2
(2,633 Views)