-
Notifications
You must be signed in to change notification settings - Fork 9
Tmc428Math
To move RA in sidereal speed, we have to calculate the right settings for the TMC428 motor controller:
1. calculate closest upper and lower TMC428 parameter set for that speed, based on gear ratio of the mount and stepper motor resolution (fullsteps per rotation)
Parameters needed for speed calculation (based on TMC documentation):
| Signal | Description | Range or Value |
|---|---|---|
| RPM: | revolution per minute | |
| RPS: | revolution per second | |
| fsf[Hz]: | fullstep frequency | |
| µsf[Hz]: | microstep-frequency | |
| f_CLK: | clock frequency | 16MHz |
| velocity: | TMC428 speed parameter | 0..2047 |
| pulse_div: | divider for velocity, The higher the value, the less is the maximum velocity | 0..13 |
| µsrs: | microstep-resolution (µ-step per fullstep = 2^µsrs) | 0..7 [7 is mapped to 6 by the TMC428] |
| fs_ro: | fullsteps per rotation for a given stepper | for example: 100 for an “Escap P530” |
µsf[Hz] = f_CLK * velocity / (2^pulse_div * 2048 * 32)
fsf[Hz] = µsf[Hz] / 2^µsrs
fsf[Hz] = f_CLK * velocity / (2^pulse_div * 2048 * 32 * 2^µsrs )
RPM = fsf[Hz] * 60 / fs_ro
RPS = fsf[Hz] / fs_ro
RPM = f_CLK * velocity * 60 / (2^pulse_div * 2048 * 32 * 2^µsrs * fs_ro)
RPS = f_CLK * velocity / (2^pulse_div * 2048 * 32 * 2^µsrs * fs_ro)
=>
velocity = fsf[Hz] * 2^µsrs * 2^pulse_div * 2048 * 32 / f_CLK
velocity = RPM * fs_ro * 2^µsrs * 2^pulse_div * 2048 * 32 / (f_CLK * 60)
velocity = RPS * fs_ro * 2^µsrs * 2^pulse_div * 2048 * 32 / f_CLK
fsf_min (f_CLK=16MHz): 0.000466 and RPM_min (@fs_ro=100): 0.000279
- primary mount gear ratio (RA gear teeth) : 180 => 2° mount movement at the sky / turn
- secondary (motor) gear ratio: 12
180 * 12 => 0.1667° mount movement at the sky per stepper motor turn
- sidereal day: 86164.1 seconds
sidereal_turn_rate: 360° / 86164.1s = 0.004178°/s
Exact sidereal motor RPS_req: 0.004178°/s / 0.1667° = 0.025068 required for this mount, motor and gear values.
The TMC428Calculator.exe proposed these values as a close match:
f_CLK = 16MHz
velocity = 168
pulse_div = 8
2^µsrs = 64
fs_ro = 100
=> RPS_lower: 0.025034
and with:
f_CLK = 16MHz
velocity = 169
pulse_div = 8
2^µsrs = 64
fs_ro = 100
=> RPS_upper: 0.025183
But the same speeds will also be obtained with:
f_CLK = 16MHz
velocity = 1344
pulse_div = 11
2^µsrs = 64
fs_ro = 100
=> RPS_lower: 0.025034
and with:
f_CLK = 16MHz
velocity = 1352
pulse_div = 11
2^µsrs = 64
fs_ro = 100
=> RPS_upper: 0.025183
Therefore the highest possible velocity and pulse_div values will give the closest match to the RPS of 0.025068 necessary in this example:
f_CLK = 16MHz
velocity = 1345
pulse_div = 11
2^µsrs = 64
fs_ro = 100
=> RPS_lower: 0.025052 ( equals ~ 0.1 % error)
and with:
f_CLK = 16MHz
velocity = 1346
pulse_div = 11
2^µsrs = 64
fs_ro = 100
=> RPS_upper: 0.025071
We have now to switch periodically between RPS_lower and RPS_upper around RPS_req.
The (scaled) difference between RPS_lower and RPS_req. equals 16 and between RPS_upper and RPS_req. equals 3.
=>
We get our exact average RPS_req by driving the motor for 3 seconds with RPS_lower and 16 seconds with RPS_upper and so on…
(Of course quartz oscillator errors (drift, absolute and temperature variations) still remain, but these errors are much smaller in the range of 0.01 percent)