## microstepping resolution

Moderators: TomKerekes, dynomotion

ZooBDoo
Posts: 38
Joined: Tue May 07, 2019 4:35 pm

### microstepping resolution

How do I calculate and set the microstepping resolution with a SnapAmp setup? i.e. steps per revolution on a 200 ppr full step motor? Also, is there a maximum theoretical speed ( control limit not motor limit) for microstepping? What is the control repeatability in microstepping between the motor poles? i.e. the accuracy and repeatability of the currents between motor poles?

AZ

TomKerekes
Posts: 789
Joined: Mon Dec 04, 2017 1:49 am

### Re: microstepping resolution

Hi AZ,
How do I calculate and set the microstepping resolution with a SnapAmp setup?
SnapAmp uses a somewhat different microstepping approach that in a way avoids the concept of microsteps entirely. It applies sine/cosine currents to the motor coils based on floating point positions with virtually infinite resolution. However SnapAmp doesn't have infinite resolution of current control. It has 10-bits of resolution over 35Amps. Or ~35ma of current resolution. So the resolution depends on the amplitude of coil currents. For example for a 7Amp amplitude one increment of current would move:

arc-sin(35ma/7Amps) = 0.29 degrees of a cycle

0.000812 of a cycle = 0.0032 full step (308X micro-stepping resolution equivalent)
steps per revolution on a 200 ppr full step motor?
So again integer steps are not involved. Instead floating point "cycles" are used where 50 cycles is one rev on a 200 full step motor.
Also, is there a maximum theoretical speed ( control limit not motor limit) for microstepping?
Not really. Every 90us the desired currents based on the position (trajectory) are updated. Motor inductance, limited supply voltage, and such will be far more limiting.
What is the control repeatability in microstepping between the motor poles? i.e. the accuracy and repeatability of the currents between motor poles?
As stated above the current command resolution is 35ma. This is typically far better than what can be achieved mechanically due to friction, load disturbances, etc.

HTH
Regards,

Tom Kerekes
Dynomotion, Inc.

ZooBDoo
Posts: 38
Joined: Tue May 07, 2019 4:35 pm

### Re: microstepping resolution

Thanks for the quick reply.
In typical microstepping lingo it looks like the resolution for a 2.5 amp stepper motor would be 22428 microsteps per revolution. That's phenomenal! Even for a 1 amp motor it's 8971 ppr.

How is the motor current set? Is this done with the amplitude setting? Is this setting the peak of the sine current ? So would that be equivalent to the full current rating at one of the 200 full steps of the motor?

AZ

TomKerekes
Posts: 789
Joined: Mon Dec 04, 2017 1:49 am

### Re: microstepping resolution

Hi AZ,
How is the motor current set? Is this done with the amplitude setting? Is this setting the peak of the sine current ? So would that be equivalent to the full current rating at one of the 200 full steps of the motor?
Set the coil current amplitude using the Microstepper Amplitude parameter. Where a value between 0 - 1023 corresponds to 0 - 35Amps. When the position is at a peak of the sine wave the specified current will be applied to the coil.
Regards,

Tom Kerekes
Dynomotion, Inc.

ZooBDoo
Posts: 38
Joined: Tue May 07, 2019 4:35 pm

### Re: microstepping resolution

This is a continuation of this thread that was started many months ago and now I have the system running.
I was a bit surprised when I noticed I could hear and feel the stepper rotating with the high resolution it was supposed to be running with.
At 3.8 amps, Microstepper amplitude at 110 the calculated resolution is about 60,000 steps per rev.
I can feel the detents as it rotates at low speed ( speed of 5 ) see attached set up file. Stepper is axis channel 1.
At speed of 20 they are very noticable physically and audibly.

I expected that with the high resolution it would be virtually silent with no noticable detents.

I also cannot get the Lead compensation to change the at-speed current.
The power supply is 80 volts
Speed of 5 current peak is 3.5 nice sine wave.
10,= 3.5 nice sine wave.
15 = 3.4 wave is straightening out to more of a triangle but still has rounded peaks, no change with Lead Comp at 0 or 1000
20 = Curr A = 2.7, Curr C = 2.5 No change with lead comp 0 - 1000

I suppose with the current waves looking more like triangles than sine waves that would affect the rotational smoothness. I just didn't expect that the detents would be so noticeable at such a low speed.

In my application the motion smoothness isn't too big a deal, the positioning resolution is more of the issue and I expect that will be OK.

Any ideas about the smoothness and the lack of adjustability of the Lead compensation?

AZ
Attachments
HomeBrushlessCGI_0_2L.c

TomKerekes
Posts: 789
Joined: Mon Dec 04, 2017 1:49 am

### Re: microstepping resolution

Hi AZ,

Do your Stepper Motors have high inductance and back-emf? Please post your motor specifications. Are the motors loaded or unloaded?

Some years ago MICROSTEP_MODE was changed to operate in current mode rather than voltage mode so Lead Compensation is no longer applicable. SnapAmp has a digital current feedback loop where the PWM output (basically a voltage) is varied to maintain the desired current. It is basically P Gain where the commanded motor voltage is proportional to the error in current. The feedback loop P gains can be changed. The gains are an 8 bit number (0-255) which default to 16. You might try increasing those but take care not to go unstable. This code sets all 4 current loops on each SnapAmp to 16:

Code: Select all

``````	for (i=0; i<N_PWMS_SNAP; i++)
{
if (SnapAmpPresent>=1)
WriteSnapAmp(SNAP0+SNAP_CUR_LOOP_GAINS+i,16);  // set default current loop gains
if (SnapAmpPresent>=2)
WriteSnapAmp(SNAP1+SNAP_CUR_LOOP_GAINS+i,16);  // set default current loop gains
}
``````
Regards,

Tom Kerekes
Dynomotion, Inc.

ZooBDoo
Posts: 38
Joined: Tue May 07, 2019 4:35 pm

### Re: microstepping resolution

I'm not sure exactly how this current control is implemented but my understanding of it could explain the current distortions and smoothness issues I've seen on my steppers and brushless servos.. My understanding is that the best motor smoothness and lowest motor heating is achieved by matching the applied current waveforms to the motors BEMF waveform. A feedback based current loop may incur delays which will result in current distortions especially at higher speeds.

Is there a way that to revert back to the original commutation design so I could see the performance differences?

AZ.

TomKerekes
Posts: 789
Joined: Mon Dec 04, 2017 1:49 am

### Re: microstepping resolution

Hi AZ,
I'm not sure exactly how this current control is implemented but my understanding of it could explain the current distortions and smoothness issues I've seen on my steppers and brushless servos.
Steppers vs Brushless servo are completely different. SnapAmp's 3 Phase Brushless mode do operate in Voltage mode.

My understanding is that the best motor smoothness and lowest motor heating is achieved by matching the applied current waveforms to the motors BEMF waveform.
I don't follow this.

A feedback based current loop may incur delays which will result in current distortions especially at higher speeds.
I think this is unlikely. SnapAmp's current loop operates at 35KHz sample rate. Did you try adjusting the gains? I don't think you ever posted your motor specifications.

Is there a way that to revert back to the original commutation design so I could see the performance differences?
Not easily. You should be able to do it yourself with a User Program. You might set the Axis output to No Output, then take the sin and cosine of the destination and command the SnapAmp Full Bridges directly. WritePWM() can be used to command a "Voltage" to a SnapAmp Full Bridge (motor coil)

From KMotionDef.h

Code: Select all

``````// On board Power Amp PWM control

#define MAX_PWMR_VALUE 400		// Max value for PWMs in Recirculate mode
void WritePWMR(int ch, int v);  // Write to PWM - Recirculate mode (+ or - power then shorted)
#define MAX_PWM_VALUE 230		// Max value for PWMs in antiphase mode
void WritePWM(int ch, int v);   // Write to PWM - locked anti-phase mode (+ power then - power)

#define MAX_PWMC_VALUE 1000		// Max value for PWMs in Current Mode (SnapAmps only)
void WritePWMC(int ch, int v);  // Write to PWM - Current Loop mode - Always optimal decay``````
Regards,

Tom Kerekes
Dynomotion, Inc.