andrewmcgr / klipper_tmc_autotune Goto Github PK
View Code? Open in Web Editor NEWTMC stepper driver autotuning Klipper python extra
License: GNU General Public License v3.0
TMC stepper driver autotuning Klipper python extra
License: GNU General Public License v3.0
Add this motors
[motor_constants motech-mt-1703hs168a]
#Extruder Motor tevo
resistance: 1.65
inductance: 0.0036
holding_torque: 0.45
max_current: 1.68
steps_per_revolution: 200
[motor_constants motech-mt-1704hs168a]
#Motor Y tevo
resistance: 1.65
inductance: 0.0028
holding_torque: 0.55
max_current: 1.68
steps_per_revolution: 200
[motor_constants ldo-42sth48-2004mah_vrn]
resistance: 1.45
inductance: 0.002
holding_torque: 0.40
max_current: 2.0
steps_per_revolution: 400
If a custom motor constant is defined after the "autotune_tmc" entry in the config, Klipper will throw an error similar to:
"Could not find motor definition '[motor_constants xxxxxxxxxxxxx]' required by TMC autotuning. It is not part of the database, please define it in your config!"
CAUSE: During the "init" part of the tmc_autotune component, it tries to locate the motor definition which hasn't been loaded yet.
RESOLUTION: I haven't done extensive testing with it, but moving the following 2 sections of code from "init" to "handle_ready" appears to work for me.
try:
motor = self.printer.lookup_object(self.motor_name)
except Exception:
raise config.error(
"Could not find motor definition '[%s]' required by TMC autotuning. "
"It is not part of the database, please define it in your config!"
% (self.motor_name))
if self.tuning_goal == TuningGoal.AUTO:
# Very small motors may not run in silent mode.
self.auto_silent = self.name not in AUTO_PERFORMANCE_MOTORS and motor.T > 0.3
self.tuning_goal = TuningGoal.SILENT if self.auto_silent else TuningGoal.PERFORMANCE
def handle_ready(self):
if self.tmc_init_registers is not None:
self.tmc_init_registers(print_time=print_time)
self.fclk = self.tmc_object.mcu_tmc.get_tmc_frequency()
if self.fclk is None:
self.fclk = 12.5e6
try:
motor = self.printer.lookup_object(self.motor_name)
except Exception:
raise config.error(
"Could not find motor definition '[%s]' required by TMC autotuning. "
"It is not part of the database, please define it in your config!"
% (self.motor_name))
if self.tuning_goal == TuningGoal.AUTO:
# Very small motors may not run in silent mode.
self.auto_silent = self.name not in AUTO_PERFORMANCE_MOTORS and motor.T > 0.3
self.tuning_goal = TuningGoal.SILENT if self.auto_silent else TuningGoal.PERFORMANCE
self.tune_driver()
Hello
In my setup I intend to switch the 48V to the TMC5160 drivers on only when needed, so when i boot everything up VMot is 0V. Under these conditions autotune will cause an error and will make klipper go into shutdown
The Error:
"Internal error during ready callback: Unable to write tmc spi 'stepper_x' register CHOPCONF"
When I remove the autotune sections from the printer.cfg all works as intended, could it be that klipper doesn't write to those registers until the motors are enabled and autotune alters this behavior ?
Greetings O
Hi, can somebody share driver settings for 2240? I tune my sensorless values this isnt problem but I am not sure about rest ... I want to move from 2209, I am not able find sense_resistor value for BTT 2240 v1.0 I also have right now sensorless homing ... so it will be fun and hope no any magic smoke! :)
I know how to set SPI endstop_pin will be tmc2240_ .... diag pin i also same
And I should home faster, i will set it to 50 ...
[stepper_x]
step_pin: PF13
dir_pin: PF12
enable_pin: !PF14
rotation_distance: 40
microsteps: 64 #32
full_steps_per_rotation:200 #set to 400 for 0.9 degree stepper
endstop_pin: tmc2209_stepper_x:virtual_endstop #!PG6
position_min: 0
homing_speed: 40 #Max 100
homing_retract_dist: 0
homing_positive_dir: true
[tmc2209 stepper_x]
uart_pin: PC4
interpolate: false
run_current: 0.976
sense_resistor: 0.110
stealthchop_threshold: 0
diag_pin: ^PG6 # use the same pin that was previously the endstop_pin!
Hi there!
Thats really awesome. Can you add support for the Stepper Online 17HS19-2004S1?
Its a fairly popular Stepper and its listed in V2 BOM.
Thanks!
Can you please add a multi instances support to your install script
If a custom motor constant is defined after the "autotune_tmc" entry in the config, Klipper will throw an error similar to:
"Could not find motor definition '[motor_constants xxxxxxxxxxxxx]' required by TMC autotuning. It is not part of the database, please define it in your config!"
CAUSE: During the "init" part of the tmc_autotune component, it tries to locate the motor definition which hasn't been loaded yet.
RESOLUTION: I haven't done extensive testing with it, but moving the following 2 sections of code from "init" to "handle_ready" appears to work for me.
try:
motor = self.printer.lookup_object(self.motor_name)
except Exception:
raise config.error(
"Could not find motor definition '[%s]' required by TMC autotuning. "
"It is not part of the database, please define it in your config!"
% (self.motor_name))
if self.tuning_goal == TuningGoal.AUTO:
# Very small motors may not run in silent mode.
self.auto_silent = self.name not in AUTO_PERFORMANCE_MOTORS and motor.T > 0.3
self.tuning_goal = TuningGoal.SILENT if self.auto_silent else TuningGoal.PERFORMANCE
def handle_ready(self):
if self.tmc_init_registers is not None:
self.tmc_init_registers(print_time=print_time)
self.fclk = self.tmc_object.mcu_tmc.get_tmc_frequency()
if self.fclk is None:
self.fclk = 12.5e6
try:
motor = self.printer.lookup_object(self.motor_name)
except Exception:
raise config.error(
"Could not find motor definition '[%s]' required by TMC autotuning. "
"It is not part of the database, please define it in your config!"
% (self.motor_name))
if self.tuning_goal == TuningGoal.AUTO:
# Very small motors may not run in silent mode.
self.auto_silent = self.name not in AUTO_PERFORMANCE_MOTORS and motor.T > 0.3
self.tuning_goal = TuningGoal.SILENT if self.auto_silent else TuningGoal.PERFORMANCE
self.tune_driver()
Tried to use this with LDO 2504AH on Octopus v1.1 with TMC2209(s) and senseless homing doesn't appear to be working even with a value of 255 the X Axis is crashing into the gantry.
I add 2504ah
to the motor_database.cfg
but looks the same as 2504ac
`#####################################################################
#####################################################################
[include motor_database.cfg]
[autotune_tmc stepper_x]
motor: ldo-42sth48-2504ah
sg4_thrs: 255
#Sensorless homing threshold, tune if using sensorless
voltage: 24.0
#Motor supply voltage for this stepper driver
[autotune_tmc stepper_y]
motor: ldo-42sth48-2504ah
sg4_thrs: 255
#Sensorless homing threshold, tune if using sensorless
voltage: 24.0
#Motor supply voltage for this stepper driver
[autotune_tmc stepper_z]
motor: omc-17hs19-2004s1
[autotune_tmc stepper_z1]
motor: omc-17hs19-2004s1
[autotune_tmc stepper_z2]
motor: omc-17hs19-2004s1
[autotune_tmc stepper_z3]
motor: omc-17hs19-2004s1
[autotune_tmc extruder]
motor: ldo-36sth20-1004ahg`
I have a GitHub with documentation on the Formbot Voron V0 Kit.
https://github.com/SrgntBallistic/Formbot-V0
I include information such as the motor model numbers, pictures of the motor drawings included by formbot and some starting 60% run_currents.
I linked to your repo to let ppl know autotune is an option.
A user noted the model numbers included in my docs (and the Formbot drawings) don't exactly match models in your DB. Some are only off by something like an extra -01
I actually haven't set up autotune yet. My question is how close are these? Close enough? Are there likely just small differences in model numbers for essentially the same motor?
The pics drawings for the motors are here
https://github.com/SrgntBallistic/Formbot-V0/blob/v0.2/Images/Motors/a-b-motors-drawing.jpg
https://github.com/SrgntBallistic/Formbot-V0/blob/v0.2/Images/Motors/z-motor-drawing.jpg
https://github.com/SrgntBallistic/Formbot-V0/blob/v0.2/Images/Motors/extruder-motor-drawing.jpg
Please add LDO-42sth60-2004AC which is used on Mellow VzBot330 kits Z-Axis:
[motor_constants ldo-42sth60-2004ac]
resistance: 1.4
inductance: 0.003
holding_torque: 0.6
max_current: 2.0
steps_per_revolution: 400
Thanks
According to BTT website. The tmc 2240 uses diag0 not diag1
Also for the Octopus Pro, it's seems diag0 is associated with motor0 and diag1 is associated with motor1.
I think there needs to be better clarification on how to configure the proper pin outs
Edit: so the diag numbering on the board is for assigning to each motor slot and the diag number is that one used by the driver. It's only for selecting the proper pin out for that motor
I have no idea if its working I have added everything I think.
#####################################################################
#####################################################################
[stepper_x]
step_pin: PC8
dir_pin: !PC9
enable_pin: !PA15
microsteps: 32
rotation_distance: 40
endstop_pin: tmc2240_stepper_x:virtual_endstop
position_min: -12
position_endstop: 132
position_max: 132
homing_speed: 50
homing_retract_dist: 0
homing_positive_dir: true
[tmc2240 stepper_x]
cs_pin: PD9
spi_speed: 1000000
spi_software_sclk_pin: PB13
spi_software_mosi_pin: PB15
spi_software_miso_pin: PB14
interpolate: True
run_current: 0.8
diag0_pin: ^!PD3
driver_SGT: 1
[stepper_y]
step_pin: PA10
dir_pin: !PA14
enable_pin: !PA13
microsteps: 32
rotation_distance: 40
endstop_pin: tmc2240_stepper_y:virtual_endstop
position_min: 0
position_endstop: 126
position_max: 126
homing_speed: 50
homing_retract_dist: 0
homing_positive_dir: true
[tmc2240 stepper_y]
cs_pin: PD8
spi_speed: 1000000
spi_software_sclk_pin: PB13
spi_software_mosi_pin: PB15
spi_software_miso_pin: PB14
interpolate: True
run_current: 0.8
diag0_pin: ^!PD2
driver_SGT: 1
#####################################################################
#####################################################################
[stepper_z]
step_pin: PC6
dir_pin: PC7
enable_pin: !PA9
rotation_distance: 40
microsteps: 32
endstop_pin: PC3
position_max: 110
position_min: -5
position_endstop: 0.4
homing_speed: 8
second_homing_speed: 3
homing_retract_dist: 5
[tmc2240 stepper_z]
cs_pin: PB10
spi_speed: 1000000
spi_software_sclk_pin: PB13
spi_software_mosi_pin: PB15
spi_software_miso_pin: PB14
interpolate: False
run_current: 0.976
[stepper_z1]
step_pin: PB12
dir_pin: !PB11
enable_pin: !PA8
rotation_distance: 40
microsteps: 32
[tmc2240 stepper_z1]
cs_pin: PB2
spi_speed: 1000000
spi_software_sclk_pin: PB13
spi_software_mosi_pin: PB15
spi_software_miso_pin: PB14
interpolate: False
run_current: 0.976
[stepper_z2]
step_pin: PB0
dir_pin: !PB1
enable_pin: !PC4
rotation_distance: 40
microsteps: 32
[tmc2240 stepper_z2]
cs_pin: PA6
spi_speed: 1000000
spi_software_sclk_pin: PB13
spi_software_mosi_pin: PB15
spi_software_miso_pin: PB14
interpolate: False
run_current: 0.976
#####################################################################
#####################################################################
[autotune_tmc stepper_x]
motor: omc-14hs20-1504s
sgt: 1
tuning_goal: autoswitch
[autotune_tmc stepper_y]
motor: omc-14hs20-1504s
sgt: 1
tuning_goal: autoswitch
[autotune_tmc stepper_z]
motor: omc-17hs19-2004s1
[autotune_tmc stepper_z1]
motor: omc-17hs19-2004s1
[autotune_tmc stepper_z2]
motor: omc-17hs19-2004s1
[autotune_tmc extruder]
motor: ldo-36sth17-1004ahg
#####################################################################
#####################################################################
[extruder]
step_pin: ebb36:PD0
dir_pin: !ebb36:PD1
enable_pin: !ebb36:PD2
rotation_distance: 22.52 # Calibrate rotation distance
gear_ratio: 50:10
microsteps: 32
full_steps_per_rotation: 200
filament_diameter: 1.75
nozzle_diameter: 0.400
heater_pin: ebb36:PB13
sensor_type: MAX31865
sensor_pin: ebb36:PA4
spi_bus: spi1
rtd_nominal_r: 100
rtd_reference_r: 430
rtd_num_of_wires: 2
max_temp: 290
min_extrude_temp: 150
min_temp: 0
control: pid # PID tune
pid_kp: 30.388
pid_ki: 1.647
pid_kd: 140.164
max_extrude_only_distance: 100.0
max_extrude_cross_section: 5
pressure_advance: 0.025 # calibrate pressure advance
pressure_advance_smooth_time: 0.040
[tmc2209 extruder]
uart_pin: ebb36:PA15
interpolate: false
run_current: 0.3 # set an appropriate current
sense_resistor: 0.110
Option 'toff' in section 'autotune_tmc stepper_x' must have minimum of 1
Hey and thanks for this cool piece of software. I used it since I build my Trident this summer and always wondered why my printer is a lot louder than most of the other printers I found and saw online and in real life. I had configured everything like recomended and tried to find the problem using Frix-x Shake Tune and the older versions from him.
This weekend I deaktivated TMC Autotune and the loud noise when moving diagonal (AB) and strong vibrations are gone.
What could have caused this?
My Printer:
Trident 300
TMC 2240 V1.0 for all the Axis.
Octopus V1.1
X and Y Motors: moons-ms17hd6p420I-05
X and Y stepper are in "performance mode" and at 24V.
interpolate: false
cs_pin: PC4
spi_speed: 500000
spi_bus: spi1
diag0_pin: !PG6
run_current: 1
stealthchop_threshold: 0
step_pin: PF13
dir_pin: PF12
enable_pin: !PF14
rotation_distance: 40
microsteps: 64 #Stock=32 but doesn´t change anything noise wise.
full_steps_per_rotation:200 #set to 400 for 0.9 degree stepper
endstop_pin: PG6
position_min: 0
The loud noise starts at 152mm/s excactly like a is switch is turned on.
Here are vibration graphs that show the difference:
With TMC Autotune:
Noise at A B movements with Autotune at 160mm/s.
https://github.com/andrewmcgr/klipper_tmc_autotune/assets/141996846/69a0a076-23ea-45fd-b092-591563b7d954
Hi, can you please add the Bondtech stepper motor found on all of their pancake style stepper motors?
This includes:
LGX Lite (v1 and v2)
Orbiter
HextrudORT
Sherpa Mini
The listing can be found here: https://www.bondtech.se/product/nema14-round-20mm-pancake-motor/
The TDS can be found here: https://www.bondtech.se/downloads/TDS/Bondtech-13013A-classH-36H020H-1004A-001.pdf
And the configuration is as follows:
[motor_constants 36H020H-1004A-001]
## Pancake Motor found on Bondtech Extruders: LGX Lite v1/2, Orbiter, Hextrudort, Sherpa Mini
resistance: 2.37
inductance: 0.0012
holding_torque: 0.08825985
max_current: 1.0
steps_per_revolution: 200
Some systems like Flsun's speeder pad (or the kiauh installer) allow configurations with multiple klipper installations on the same host.
You'll then have symlinked directories like printer_1_data, printer_2_data, etc in your home dir.
Accordingly you'll find that the service name is "klipper-1.service" which leads to the installation script of autotune aborting and the restart of the service failing (would have to be "sudo systemctl restart klipper-1").
i want to put this motor of the extruder biqu h2, in the motordatabase
[motor_constants bq-35BYGF0713-A-30HZT]
resistance: 2.3
inductance: 0.002
holding_torque: 0.110
max_current: 1.5
steps_per_revolution: 200
Hello, I'm trying to configure auto_autotune on my Ender 6 using SKR mini E3 V3 running v0.0.0-4766-gdgus-reloaded-230526-0-gbaae7f3a-inferred. I encounter this error. One guy on discord said that files need from tmc_autotune is not yet merge to gdgus-reloaded. Is there anything I can do to resolve this issue? Thank a lot and have a good day!
Hi guys,
Im getting this error after doing an update to your script
Internal error during connect: No module named enum
this is the log
Unhandled exception during connect
Traceback (most recent call last):
File "/home/pi/klipper/klippy/klippy.py", line 175, in _connect
self._read_config()
File "/home/pi/klipper/klippy/klippy.py", line 141, in _read_config
self.load_object(config, section_config.get_name(), None)
File "/home/pi/klipper/klippy/klippy.py", line 121, in load_object
mod = importlib.import_module('extras.' + module_name)
File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module
import(name)
File "/home/pi/klipper/klippy/extras/autotune_tmc.py", line 2, in
from enum import Enum
ImportError: No module named enum
webhooks client 1969438632: New connection
webhooks client 1969438632: Client info {'program': 'Moonraker', 'version': 'v0.8.0-86-ga7e154f'}
Unable to issue reset command on MCU 'mcu'
Unable to issue reset command on MCU 'rpi'
Unable to issue reset command on MCU 'sb2040'
webhooks client 1969438632: Disconnected
Restarting printer
After installing TMC autune, adding update manager to moonraker I've added the tmc autotune section to my printer.cfg
Now I get this error
Internal error during connect: No module named enum
Once the underlying issue is corrected, use the "RESTART"
command to reload the config and restart the host software.
Printer is halted
[tmc2209 extruder]
uart_pin: PC11
tx_pin: PC10
uart_address: 3
run_current: 0.300 #0.350
stealthchop_threshold: 999999
# interpolate: false
#########################
#######AUTO TUNE#########
#########################
[autotune_tmc stepper_x]
motor: creality-42-34
[autotune_tmc stepper_y]
motor: creality-42-34
[autotune_tmc stepper_z]
motor: creality-42-34
[autotune_tmc extruder]
motor: ldo-36sth17-1004ahg
Any suggestions on what I need to adjust to remove this error?
I installed the macros, configured the motors in tmc_autotune.cfg, can call "AUTOTUNE_TMC STEPPER=stepper_x", but nothings happens. Or: What is supposed to happen? I was expecting some kind of stepper movement or something?! What is to be expected.
And how to use it? Do I need to put some commands in my START macro? Or does the tool alter some printer.cfg file?
Sorry for asking these stupid sounding questions, but I don't see them answered. (And not asked, which makes me feel even more stupid ;) ).
Thanks
It appears that self.tuning_goal
always evaluates to TuningGoal.AUTO
at Line 161 in cmd_AUTOTUNE_TMC
even when the tuning goal is set in the config, which causes an error since self.auto_silent
is not defined.
It appears the issue is with Line 153 redefining self.tuning_goal
by grabbing it from the console instead of checking the config.
A safer option would probably be to change this to:
...
if 'TUNING_GOAL' in gcmd:
tgoal = gcmd.get('TUNING_GOAL', None).lower()
else:
tgoal = self.tuning_goal
...
Config:
[autotune_tmc stepper_x]
motor: omc-17hs15-1504s
tuning_goal: performance
[autotune_tmc stepper_y]
motor: omc-17hs15-1504s
tuning_goal: performance
[autotune_tmc stepper_z]
motor: omc-17hs15-1504s
tuning_goal: performance
[autotune_tmc extruder]
motor: ldo-36sth20-1004ahg
tuning_goal: silent
Log:
Internal Error on WebRequest: gcode/script
Traceback (most recent call last):
File "/home/michael/klipper/klippy/webhooks.py", line 256, in _process_request
func(web_request)
File "/home/michael/klipper/klippy/webhooks.py", line 436, in _handle_script
self.gcode.run_script(web_request.get_str('script'))
File "/home/michael/klipper/klippy/gcode.py", line 216, in run_script
self._process_commands(script.split('\n'), need_ack=False)
File "/home/michael/klipper/klippy/gcode.py", line 198, in _process_commands
handler(gcmd)
File "/home/michael/klipper/klippy/gcode.py", line 135, in <lambda>
func = lambda params: origfunc(self._get_extended_params(params))
File "/home/michael/klipper/klippy/gcode.py", line 144, in <lambda>
handler = lambda gcmd: self._cmd_mux(cmd, gcmd)
File "/home/michael/klipper/klippy/gcode.py", line 302, in _cmd_mux
values[key_param](gcmd)
File "/home/michael/klipper/klippy/extras/autotune_tmc.py", line 161, in cmd_AUTOTUNE_TMC
self.tuning_goal = TuningGoal.SILENT if self.auto_silent else TuningGoal.PERFORMANCE
AttributeError: 'AutotuneTMC' object has no attribute 'auto_silent'
It's personal preference but I like copy/pasteable config sections where the options that can be toggled are explained in the section. This way, I don't need to move between screens/windows to see what I can configure. One blob with the defaults are nice. Like in the Klipper docs.
Consider adding something like this to the README. This is an issue, rather than a PR since I don't know your preference and that matters most.
[autotune_tmc extruder]
# This parameter is used to retrieve the physical constants of the motor connected to the TMC driver
# Values: See DB
motor: ldo-36sth20-1004ahg
# Parameter to choose how to fine-tune the TMC driver using StealthChop and tailored parameters.
# By opting for auto, it will automatically apply performance for the X and Y axes and silent for the Z axis and extruder.
# autoswitch is an highly experimental choice that enables dynamic switching between silent and performance modes in real-time when needed.
# However, at the moment, this transition can potentially be troublesome, resulting in unwanted behavior, noise disturbances and lost steps.
# Hence, it is recommended to avoid using 'autoswitch' until its identified issues are fully addressed
# Values: auto, silent, performance, and autoswitch
# Default: auto
tuning_goal: auto
# Additional hysteresis to reduce motor humming and vibration at low to medium speeds and maintain proper microstep accuracy.
# Warning: use only as much as necessary as a too high value will result in more chopper noise and motor power dissipation (ie. more heat)
# Values: 0 to 8
# Default: 0
extra_hysteresis: 0
# Comparator blank time. This time must safely cover the TMC switching events.
# A value of 1 or 2 should be fine for most typical applications, but higher capacitive loads may require this to be set to 3.
# Also, lower values allow StealthChop to regulate to lower coil current values
# Values: 0 to 3
# Default: 2
tbl: 2
# Sets the slow decay time (off time) of the chopper cycle. This setting also limits the maximum chopper frequency.
# When set to 0, the value is automatically computed by this autotuning algorithm. Highest motor velocities sometimes
# benefit from forcing toff to 1 or 2 and a setting a short tbl of 1 or 0
# Values: 0 to 15
# Default: 0
toff: 0
# Sensorless homing threshold for TMC5160, TMC2240, TMC2130, TMC2660. Set value appropriately if using
# sensorless homing (higher value means more sensitive detection and easier stall)
# Values: -64 to 63
# Default: 1
sgt: 1
# Sensorless homing threshold for TMC2209 and TMC2260. Set value appropriately if using sensorless homing
# (lower value means more sensitive detection and easier stall). This parameter is also used as the CoolStep current regulation
# threshold for TMC2209, TMC2240 and TMC5160. A default value of 80 is usually a good starting point for CoolStep (in the case of TMC2209,
# the tuned sensorless homing value will also work correctly)
# Values: 0 to 255
# Default: 10
sg4_thrs: 10
# Voltage used to power this motor and stepper driver
# Values: 0.0 to 60.0
# Default: 24
voltage: 24
# Set the optional overvoltage snubber built into the TMC2240 and TMC5160. Users of the BTT SB2240 toolhead board should use it
# for the extruder by reading the actual toolhead voltage and adding 0.8V
# Values: 0.0 to 60.0
# Default: 0.0
overvoltage_vth: 0.0
Hi, how does this handle dual-Z on a single driver (such as the BTT SKR mini E3 v3)? I was previously providing extra current as two motors were running off one driver. Does this override the current setting I have in the tmc configuration?
Not an issue, Just a bit of improvement (maybe I'm wrong)
forcing lowercase in motor name
Makes it easier to copy & paste motor names from datasheets
self.motor = config.get('motor').lower()
self.motor_name = "motor_constants " + self.motor
try:
motor = self.printer.lookup_object(self.motor_name)
following error happens when i try to use autotune with fysetc-42HC40-204A-300N84:
TMC 'stepper_z' reports error: DRV_STATUS: 40150010 s2vsa=1(ShortToSupply_A!) cs_actual=21 stealth=1
the motors and drivers work fine if i comment out the whole auto tuning section for the Z, Z1, and Z2 drivers
[autotune_tmc stepper_z]
motor: fysetc-42HC40-204A-300N84
#tuning_goal: silent
## Make sure to update below for your relevant driver (2208 or 2209)
[tmc2209 stepper_z]
uart_pin: PA15
uart_address: 0
#interpolate: True
run_current: 1.2
hold_current: 1.0
sense_resistor: 0.110
#stealthchop_threshold: 0
[autotune_tmc stepper_z1]
motor: fysetc-42HC40-204A-300N84
#tuning_goal: silent
## Make sure to update below for your relevant driver (2208 or 2209)
[tmc2209 stepper_z1]
uart_pin: PC14
#interpolate: True
run_current: 1.2
hold_current: 1.0
sense_resistor: 0.110
#stealthchop_threshold: 0
[autotune_tmc stepper_z2]
motor: fysetc-42HC40-204A-300N84
#tuning_goal: silent
## Make sure to update below for your relevant driver (2208 or 2209)
[tmc2209 stepper_z2]
uart_pin: PC15
#interpolate: true
run_current: 1.2
hold_current: 1.0
sense_resistor: 0.110
#stealthchop_threshold: 0
Looking at autotune_tmc.py, it appears to be changing the run_current. However, during sensorless homing, I haven't found a way to query the run_current. As a resault, the following sensorless homing code would override the run_current autotune is setting:
{% set RUN_CURRENT_X = printer.configfile.settings['tmc2240 stepper_x'].run_current|float %}
{% set RUN_CURRENT_Y = printer.configfile.settings['tmc2240 stepper_y'].run_current|float %}
...
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={RUN_CURRENT_X}
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={RUN_CURRENT_Y}
If it doesn't already exist, can you please update the component so that it's returning the current for a specific motor? Something like:
{% set RUN_CURRENT_X = printer['autotune_tmc stepper_x'].run_current|float %}
Thanks
Hello, i cannot configure my printer to home with this script.
Here's my config:
[autotune_tmc stepper_x]
motor: moons-ms14hs5p4150
tuning_goal: auto
sg4_thrs: 45
voltage: 24
extra_hysteresis: 1
tbl: 2
[autotune_tmc stepper_y]
motor: moons-ms14hs5p4150
tuning_goal: auto
sg4_thrs: 45
voltage: 24
extra_hysteresis: 1
tbl: 2
[autotune_tmc extruder]
motor: moons-cse14hra1l410a
voltage: 24
And there is a dump of stepper_x using DUMP_TMC stepper=stepper_x command
2:33 AM
SG_RESULT: 00000036 sg_result=54
2:33 AM
PWM_AUTO: 00140030 pwm_ofs_auto=48 pwm_grad_auto=20
2:33 AM
PWM_SCALE: 00000030 pwm_scale_sum=48
2:33 AM
PWMCONF: 4f0e0c22 pwm_ofs=34 pwm_grad=12 pwm_freq=2 pwm_autoscale=1 pwm_autograd=1 pwm_reg=15 pwm_lim=4
2:33 AM
DRV_STATUS: 801f00c0 ola=1(OpenLoad_A!) olb=1(OpenLoad_B!) cs_actual=31 stst=1
2:33 AM
CHOPCONF: 230301c3 toff=3 hstrt=4 hend=3 tbl=2 vsense=1 mres=3(32usteps) dedge=1
2:33 AM
MSCURACT: 015d00ba cur_a=186 cur_b=-163
2:33 AM
MSCNT: 00000174 mscnt=372
2:33 AM
TSTEP: 000fffff tstep=1048575
2:33 AM
FACTORY_CONF: 0000000c fclktrim=12
2:33 AM
IOIN: 21000041 enn=1 pdn_uart=1 version=0x21
2:33 AM
OTP_READ: 0000000c otp_fclktrim=12
2:33 AM
IFCNT: 000000a2 ifcnt=162
2:33 AM
GSTAT: 00000000
2:33 AM
GCONF: 000001c4 en_spreadcycle=1 pdn_disable=1 mstep_reg_select=1 multistep_filt=1
2:33 AM
========== Queried registers ==========
2:33 AM
COOLCONF: 00000468 semin=8 seup=3 semax=4
2:33 AM
TCOOLTHRS: 00000125 tcoolthrs=293
2:33 AM
SGTHRS: 000000c8 sgthrs=200
2:33 AM
TPOWERDOWN: 00000014 tpowerdown=20
2:33 AM
TPWMTHRS: 000fffff tpwmthrs=1048575
2:33 AM
IHOLD_IRUN: 000c1f1f ihold=31 irun=31 iholddelay=12
2:33 AM
SLAVECONF: 00000200 senddelay=2
2:33 AM
========== Write-only registers ==========
Let me know if I should post something else. :)
Hello,
I took my time to track down motors for the Kingroon KP3S (I have one, love it):
[motor_constants kingroon_kp3s_4223_titan]
# Coil resistance, Ohms
resistance: 4.00
# Coil inductance, Henries
inductance: 0.004
# Holding torque, Nm
holding_torque: 0.130
# Nominal rated current, Amps
max_current: 1.00
# Steps per revolution (1.8deg motors use 200, 0.9deg motors use 400)
steps_per_revolution: 200
[motor_constants kingroon_kp3s_4232_b01943]
# Coil resistance, Ohms
resistance: 5.60
# Coil inductance, Henries
inductance: 0.008
# Holding torque, Nm
holding_torque: 0.360
# Nominal rated current, Amps
max_current: 1.00
# Steps per revolution (1.8deg motors use 200, 0.9deg motors use 400)
steps_per_revolution: 200
[motor_constants kingroon_kp3s_4240]
# Coil resistance, Ohms
resistance: 2.40
# Coil inductance, Henries
inductance: 0.0037
# Holding torque, Nm
holding_torque: 0.420
# Nominal rated current, Amps
max_current: 1.50
# Steps per revolution (1.8deg motors use 200, 0.9deg motors use 400)
steps_per_revolution: 200
Source:
https://kingroon.com/products/nema-17-stepper-motor-3d-printer-motor
https://kingroon.com/products/42-stepper-motor?_pos=2&_sid=228ca9d16&_ss=r
https://www.lazada.co.th/products/kingroon-part-stepper-motor-42-40-nema17-square-motors-3d-printer-parts-i4867418365-s20345135285.html?spm=a2o4m.tm80167383.2074280300.1.7e5ajW2SjW2SPK.7e5ajW2SjW2SPK
Just finished configuring autotune, and noticed that my steppers returned to humming on idle - like they did before setting my stealthchop_threshold to 1 from 0.
I am guessing this klipper is no longer reading this setting from the printer.cfg.
What other lines are no longer relevant when autotune is active?
ex. can I remove the run_current lines from my config as well?
Also, is there a way to get the minimum stealthchop_threshold back to 1 with autotune active so my steppers stop humming so much on idle?
used in Siboor Voron 0.1 Young edition
official specs from: https://discord.com/channels/1030697720312234054/1031541938043768902/1167287064849547375
[motor_constants ldo-42sth40-1684AC]
resistance: 1.65
inductance: 0.0036
holding_torque: 0.45
max_current: 1.68
steps_per_revolution: 200
As my title suggests, I want a gcode command so that I can manually call the module to tune the motors rather than auto tune at start up.
Since my current setup uses a relay to control my 24v main power and the pin that controls relay was off by default on any errors, including the startup phase. With that I can prevent many potential safety issues such as a MOSFET breakdown of a heating element. However, this setup would lead to a start up issue which the module will try to communicate with tmc drivers while there is no power supply for the motors, thus the error would pop out. Unless I change the pin default state to 'ON' such that the power supply is connected to the motors during start up, the problem could be solved. But that lost the point of introducing the relay.
If the gcode command can be implementd, I can use the command together with gcode that controls the relay, so that whenever I turn on the power, the tuning process would also be done. Anyways, whether this can be acheived or not, thank you for your efforts!
Received this error when launching for the first time
Unhandled exception during connect
Traceback (most recent call last):
File "/home/pi/klipper/klippy/klippy.py", line 175, in _connect
self._read_config()
File "/home/pi/klipper/klippy/klippy.py", line 141, in _read_config
self.load_object(config, section_config.get_name(), None)
File "/home/pi/klipper/klippy/klippy.py", line 121, in load_object
mod = importlib.import_module('extras.' + module_name)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/pi/klipper/klippy/extras/autotune_tmc.py", line 2, in <module>
from enum import Enum
ImportError: No module named enum
To fix the problem, I ran:
$ source ~/klippy-env/bin/activate
$ pip install enum
$ deactivate
Hi, This is working so easy and great. I tried it for my custom Ender 3v2 Neo, but my Extruder motors are not listed. I would appreciate it if you could add the following motors update. 🙏
BIQU 42 Stepper Motor 40MM
Specifications
High:40mm
Shaft length:22mm
Color: Black
Phase number:2
Rated voltage: DC 3.6 Vs
Phase resistance:3.6*(1+10%) / phase
Steering(shaft extension):A-AB-B-clockwise
Maximum no-load operation frequency:>1000 PPS
Electrical strength:AC600V/1mA/1S
Moment of inertia:73 g.cm ²
Holding torque:≥450mN.m
Step angle:±1.8°
Rated current: DC 1.0a/phase
Phase inductance(1kHz):8X(1+20%)MH/phase
Positioning torque:25mV.m REF.
Maximum no-load starting frequency:≥800 PPS
Insulation resistance:≥100MΩ(DC 500V)
Insulation class: Class F
Quality:0.28Kg REF
Hello,
Printer V400
It use to work but since last update I'm getting this error
Klipper reports: ERROR
Section 'autotune_tmc stepper_a' is not a valid config section
Extract of printer.cfg :
########################################
########################################
[stepper_a]
step_pin: PE3
dir_pin: PE2
enable_pin: !PE4
microsteps: 64 # If you encounter an error while measuring the resonances. Replace the microsteps to 16 just for the duration of the test.
rotation_distance: 40
endstop_pin: ^PA15
homing_speed: 50
homing_retract_dist: 5.0
homing_retract_speed: 10
#angle: 210
#position_endstop: 415.0
#arm_length = 345.0
[tmc2209 stepper_a]
uart_pin: PD5
run_current: 1.2
interpolate: False
stealthchop_threshold: 0
[autotune_tmc stepper_a] # Enable if Klipper TMC Autotune is used
motor: flsun-v400-42
tuning_goal: performance
Versions :
klipper
v0.12.0-32-gf0753bd3
Klipper TMC Autotune
v0.2.0-119-ga9158f53
KlipperScreen
v0.3.7-3-g1c9f0f1f
mainsail
v2.8.0
moonraker
v0.8.0-206-g9ad8fed8
mcu(stm32f103xe)
Version: v0.12.0-32-gf0753bd3
Load: 0.01, Awake: 0.00, Freq: 72 MHz, Temp: 29°C
1
Host(aarch64, 32bit)
Version: v0.12.0-32-gf0753bd3
OS: Ubuntu 20.04.6 LTS
Thanks for your Help
Dear Andrew,
here the LKD stepper details (0.9° + 1.8°), these steppers are included in the Voron Kits of Copymaster3D.
[motor_constants lkd-42sth48-2004mah]
resistance: 1.45
inductance: 0.002
holding_torque: 0.40
max_current: 2.0
steps_per_revolution: 400
[motor_constants lkd-42sth48-2004ac]
resistance: 1.65
inductance: 0.003
holding_torque: 0.59
max_current: 2.0
steps_per_revolution: 200
Thank you for your work!!
Best regards
Richard
Hello installed your extension without any errors.
And did the necessary changes in printer.cfg.
Gave the command "AUTOTUNE_TMC STEPPER=stepper_x" but nothings happens.
No error, no message its done, and there is no change in any .cfg.
Did i do something wrong?
Hi,
Is it possible to add support for more creality stepper motors ? Mainly for 42-48 (Ender5 Plus Y axis and also Ender6 X and Y)
Thanks.
Autotune generate same config for 24 an 36V
On 36V motors have weird sound :)
[autotune_tmc stepper_x]
motor: moons-ms17hd6p420I-05
sgt: 1
[autotune_tmc stepper_y]
motor: moons-ms17hd6p420I-05
autotune_tmc set stepper_x hstrt=5
autotune_tmc set stepper_x hend=3
autotune_tmc set stepper_x pwm_freq=2
autotune_tmc set stepper_x sg4_thrs=10
autotune_tmc set stepper_x sg4_filt_en=True
autotune_tmc using max PWM speed 191.781706
autotune_tmc set stepper_x overvoltage_vth=3904
autotune_tmc set stepper_x pwm_autoscale=True
autotune_tmc set stepper_x pwm_autograd=True
autotune_tmc set stepper_x pwm_grad=11
autotune_tmc set stepper_x pwm_ofs=14
autotune_tmc set stepper_x pwm_reg=15
autotune_tmc set stepper_x pwm_lim=4
autotune_tmc set stepper_x tpwmthrs=1048575
autotune_tmc set stepper_x en_pwm_mode=False
autotune_tmc set stepper_x tpfd=0
autotune_tmc set stepper_x tbl=1
autotune_tmc set stepper_x toff=3
autotune_tmc set stepper_x tcoolthrs=305(32.0)
autotune_tmc set stepper_x sgt=1
autotune_tmc set stepper_x small_hysteresis=False
autotune_tmc set stepper_x semin=8
autotune_tmc set stepper_x semax=4
autotune_tmc set stepper_x seup=3
autotune_tmc set stepper_x sedn=0
autotune_tmc set stepper_x seimin=0
autotune_tmc set stepper_x sfilt=0
autotune_tmc set stepper_x iholddelay=12
autotune_tmc set stepper_x irundelay=0
autotune_tmc set stepper_x thigh=42(230.13804771088067)
autotune_tmc set stepper_x vhighfs=True
autotune_tmc set stepper_x vhighchm=False
autotune_tmc set stepper_x multistep_filt=True
autotune_tmc set stepper_y hstrt=5
autotune_tmc set stepper_y hend=3
autotune_tmc set stepper_y pwm_freq=2
autotune_tmc set stepper_y sg4_thrs=10
autotune_tmc set stepper_y sg4_filt_en=True
autotune_tmc using max PWM speed 191.781706
autotune_tmc set stepper_y overvoltage_vth=3904
autotune_tmc set stepper_y pwm_autoscale=True
autotune_tmc set stepper_y pwm_autograd=True
autotune_tmc set stepper_y pwm_grad=11
autotune_tmc set stepper_y pwm_ofs=14
autotune_tmc set stepper_y pwm_reg=15
autotune_tmc set stepper_y pwm_lim=4
autotune_tmc set stepper_y tpwmthrs=1048575
autotune_tmc set stepper_y en_pwm_mode=False
autotune_tmc set stepper_y tpfd=0
autotune_tmc set stepper_y tbl=1
autotune_tmc set stepper_y toff=3
autotune_tmc set stepper_y tcoolthrs=305(32.0)
autotune_tmc set stepper_y sgt=1
autotune_tmc set stepper_y small_hysteresis=False
autotune_tmc set stepper_y semin=8
autotune_tmc set stepper_y semax=4
autotune_tmc set stepper_y seup=3
autotune_tmc set stepper_y sedn=0
autotune_tmc set stepper_y seimin=0
autotune_tmc set stepper_y sfilt=0
autotune_tmc set stepper_y iholddelay=12
autotune_tmc set stepper_y irundelay=0
autotune_tmc set stepper_y thigh=42(230.13804771088067)
autotune_tmc set stepper_y vhighfs=True
autotune_tmc set stepper_y vhighchm=False
autotune_tmc set stepper_y multistep_filt=True
When defining the autotune_tmc sections for each motor, I am getting an error related to timelapse? This only occurs when using the autotune on motors z2, z3, and extruder on a V2.4. If I only define autotune for any combination of z0, z1, x, and y, no errors are thrown. Klipper, along with everything else on my printer, is fully up to date.
klippy(7).log
Hi,
I'm battling to tune this motor and was happy to see it in the DB already. I did, however, find it very weird that such a small motor would have a 35mH inductance, as noted in the DB
[motor_constants siboor-35sth52-1204a] #Siboor BOM Voron 0.2 steppers resistance: 2.3 inductance: 0.035 holding_torque: 0.36 max_current: 1.2 steps_per_revolution: 200
I've actually measured the value with an inductance meter and can confirm you're missing a zero there. It's a 3.5mH motor, so it should read inductance: 0.0035
Sorry for the noob question, but can somebody explain hot this extension actually works? Installation steps are clear, but what is next, how it should be actually used? Should we run the script before printing to tune driver parameters? Will it be executed and perform adjustments while we are printing. Will it write new parameters to existing cfg or a new one? How can we understand that this extension is actually working (except inviting instrument tuner to listen printer's performance)?
It would be really nice to have few more paragraphs in the read me, explaining how this function works. If it has been described already in some other place, would appreciate if somebody can share link to it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.