mirror of
https://github.com/esphome/esphome.git
synced 2026-11-10 15:15:57 +00:00
125 lines
3.0 KiB
YAML
125 lines
3.0 KiB
YAML
stepper:
|
|
- platform: tmc2209
|
|
id: tmc2209_step_dir
|
|
uart_id: uart_bus
|
|
address: 0
|
|
step_pin: ${step_pin}
|
|
dir_pin: ${dir_pin}
|
|
enn_pin: ${enn_pin}
|
|
diag_pin: ${diag_pin}
|
|
rsense: 110 mOhm
|
|
vsense: false
|
|
ottrim: 1
|
|
run_current: 800mA
|
|
hold_current: 400mA
|
|
microsteps: 16
|
|
max_speed: 2000 steps/s
|
|
acceleration: 1000 steps/s^2
|
|
deceleration: 1000 steps/s^2
|
|
on_stall:
|
|
- stepper.report_position:
|
|
id: tmc2209_step_dir
|
|
position: 0
|
|
- stepper.set_target:
|
|
id: tmc2209_step_dir
|
|
target: 0
|
|
on_status:
|
|
- logger.log:
|
|
format: "Driver event %u active %d"
|
|
args: [event, active]
|
|
|
|
- platform: tmc2209
|
|
id: tmc2209_serial
|
|
uart_id: uart_bus
|
|
address: 1
|
|
index_pin: ${index_pin}
|
|
clock_frequency: 12MHz
|
|
analog_current_scale: true
|
|
max_speed: 1000 steps/s
|
|
on_status:
|
|
- if:
|
|
condition:
|
|
lambda: "return event == tmc22xx::DRIVER_EVENT_OVERTEMPERATURE_PREWARNING && active;"
|
|
then:
|
|
- tmc2209.disable: tmc2209_serial
|
|
|
|
esphome:
|
|
on_boot:
|
|
then:
|
|
- tmc2209.configure:
|
|
id: tmc2209_step_dir
|
|
inverse_direction: true
|
|
microsteps: 8
|
|
interpolation: true
|
|
enable_spreadcycle: false
|
|
tpwm_threshold: 0
|
|
- tmc2209.configure:
|
|
id: tmc2209_serial
|
|
microsteps: !lambda "return 32;"
|
|
- tmc2209.currents:
|
|
id: tmc2209_step_dir
|
|
run_current: 1A
|
|
hold_current: 0.5A
|
|
iholddelay: 4
|
|
tpowerdown: 20
|
|
standstill_mode: freewheeling
|
|
- tmc2209.currents:
|
|
id: tmc2209_serial
|
|
irun: 20
|
|
ihold: !lambda "return 5;"
|
|
- tmc2209.stallguard:
|
|
id: tmc2209_step_dir
|
|
threshold: 50
|
|
tcool_threshold: !lambda "return 400;"
|
|
- tmc2209.coolconf:
|
|
id: tmc2209_step_dir
|
|
semin: 5
|
|
semax: 2
|
|
seup: 1
|
|
sedn: 0
|
|
seimin: true
|
|
- tmc2209.chopconf:
|
|
id: tmc2209_step_dir
|
|
toff: 4
|
|
tbl: 2
|
|
hend: 0
|
|
hstrt: !lambda "return 5;"
|
|
- tmc2209.pwmconf:
|
|
id: tmc2209_serial
|
|
pwm_ofs: 36
|
|
pwm_grad: 14
|
|
pwm_freq: 1
|
|
pwm_autoscale: true
|
|
pwm_autograd: true
|
|
pwm_reg: 4
|
|
pwm_lim: 12
|
|
- tmc2209.enable: tmc2209_serial
|
|
- stepper.set_target:
|
|
id: tmc2209_serial
|
|
target: 1000
|
|
- tmc2209.disable:
|
|
id: tmc2209_step_dir
|
|
|
|
sensor:
|
|
- platform: tmc2209
|
|
tmc2209_id: tmc2209_step_dir
|
|
update_interval: 10s
|
|
actual_current:
|
|
name: Actual Current
|
|
stallguard_result:
|
|
name: StallGuard Result
|
|
motor_load:
|
|
name: Motor Load
|
|
pwm_scale_sum:
|
|
name: PWM Scale Sum
|
|
pwm_scale_auto:
|
|
name: PWM Scale Auto
|
|
pwm_ofs_auto:
|
|
name: PWM Offset Auto
|
|
pwm_grad_auto:
|
|
name: PWM Gradient Auto
|
|
- platform: tmc2209
|
|
tmc2209_id: tmc2209_serial
|
|
stallguard_result:
|
|
name: Serial StallGuard Result
|