# Difference between revisions of "Stepper"

Jump to: navigation, search

## General Setup

Used Stepper: 17HM19-2004S

Driver Voltage: 37V

Driver: TMC2130

Max RPM reached with the motor, unloaded: 3600RPM This is the limit of the driver. It runs from the internal oscillator at 12.1MHz. Measure by giving a 9.765kHz pulse and read out register TSTEP as 0x277 (DEDGE=true).

## Take One, Lifting Weights

Driver Configuration is basically the recommended default from the datasheet for a coil current of about 2A:

```reg 0x6c -> 0x200100c3
reg 0x10 -> 0x00061c02
reg 0x91 -> 0x0000000a
reg 0x80 -> 0x00003144
reg 0x93 -> 0x000001f4
reg 0xf0 -> 0x000401c8
```

For very slow step rates stealthChop was disabled

Load Testing at 1/256 microstepping. Testing done lifting a weight by winding a rope on a cylinder with effective radius of 16.5mm.

```9.5kHz 2250g
19.5kHz 2150g
39kHz 2240g
58.5kHz 2220g
78kHz 2240g
97.5kHz 2230g
117kHz 2230g
137kHz 2130g
156kHz 2150g
195kHz 2030g
234kHz 2050g
312kHz 2030g
468kHz 1700g
624kHz 1300g
936kHz 740g
1092kHz 556g
1400kHz 250g
1700kHz 150g
```

Source for torque curve from datasheet: https://www.omc-stepperonline.com/download/17HM19-2004S_Torque_Curve.pdf

Full data sheet of the motor: https://www.omc-stepperonline.com/download/17HM19-2004S.pdf

## Take Two, Weight Spinning

The idea here is to measure the torque at a given RPM by testing how fast the stepper can accelerate to a higher RPM. This way the measurement is not limit to the length of a linear motion as in the previous chapter.

### Lost step detection

With each round the rotor goes through a photo interruptor. The controller has an internal counter to keep track of the current angle with respect to an arbitrary reference. The home command puts the controller into a mode where it resets the counter if the rotor goes through the interruptor. After that, with each round it checks if the interruptor signal asserts during a given window around the reference. The window can be programmed and is currently set to +/- 4 full steps.

### Measurement

We spin the motor to the RPM under test and try to accelerate it to the next higher RPM level. We use the interruptor signal to detect lost steps. The acceleration directly corresponds to the torque the motor can generate at the given RPM.

We now have a detailed torque curve RPM vs. Ncm.

Do the same for deceleration

Repeat everything with the other set of weights.

The following series are all done with two 50g weights. The full setup corresponds roughly to a moving mass of 11kg when using a 16T pulley.

### 1st Series

The following graph shows the max acceleration in RPM/s in steps of 200 RPM.

Driver config (just pasted here for reference):

```       reg 0x04 -> 0x00000000
reg 0xec -> 0x200100c3
reg 0x90 -> 0x00061802
reg 0x91 -> 0x0000000a
reg 0x80 -> 0x00003144
reg 0x93 -> 0x000001f4
reg 0xf0 -> 0x000401c8
```

### StealthChop

4 Series with StealthChop

```       tmcw(TMCR_CHOPCONF,
TMC_CHOPCONF_DEDGE |
(2 << TMC_CHOPCONF_TBL_SHIFT) |
(7 << TMC_CHOPCONF_HEND_SHIFT) |
(2 << TMC_CHOPCONF_HSTRT_SHIFT) |
(5 << TMC_CHOPCONF_TOFF_SHIFT));
tmcw(TMCR_IHOLD_IRUN,
( 6 << TMC_IHOLD_IRUN_IHOLDDELAY_SHIFT) |
(24 << TMC_IHOLD_IRUN_IRUN_SHIFT) |
( 3 << TMC_IHOLD_IRUN_IHOLD_SHIFT));
tmcw(TMCR_TPOWER_DOWN, 0x0a);
tmcw(TMCR_GCONF,
TMC_GCONF_DIAG0_INT_PUSHPULL |
TMC_GCONF_DIAG1_PUSHPULL |
TMC_GCONF_DIAG1_STALL |
TMC_GCONF_DIAG0_OTPW |
TMC_GCONF_EN_PWM_MODE
);
tmcw(TMCR_TPWMTHRS, 0);
tmcw(TMCR_PWMCONF,
TMC_PWMCONF_PWM_AUTOSCALE |
(  1 << TMC_PWMCONF_PWM_GRAD_SHIFT) |
(200 << TMC_PWMCONF_PWM_AMPL_SHIFT));
```

## Series with light carriage, corresponds to ~1.0kg

### StealthChop vs. SpreadCycle at 40V

The maximum acceleration is limited by the test at around 115kRPM/s.