How to make stepper motor move?

Hi,

i am very new to esphome. i have managed to get esphome on a D1 ESP8266 Mini and want to have a swich in homeassistant, when on the stepper motor is supposed to turn.

this is the config for esphome:

esphome:
  name: discomotor

esp8266:
  board: d1_mini

# Example configuration entry
stepper:
  - platform: uln2003
    id: disomotor
    pin_a: GPIO5
    pin_b: GPIO4
    pin_c: GPIO0
    pin_d: GPIO2
    max_speed: 250 steps/s

    # Optional:
    acceleration: inf
    deceleration: inf

what are the next steps, i am really struggeling to find out what to do :confused:
thanks a lot!!

Hey there,
you might already have read the warning at the top of this page:

image

This means that your esphome device now knows your stepper motor but you need to link control options against it. You could define a button or an input_number, you can define a Home Assistant service, and many more.

Please check out these links:

You could start with something like this:

number:
  - platform: template
    name: "Template number"
    optimistic: true
    min_value: 0
    max_value: 100
    step: 1
    on_value:
      then:
        - stepper.set_target:
            id: disomotor_stepper
            target: !lambda "return x;"
1 Like

Hi,

thanks a lot!
and thanks for your start hint :slight_smile: → but what is that? is that ment to be in the esphome configuration? or where is that supposed to go?

Cheers

Yes to yaml esp

Never mind! i have managed to get it to move to a defined step. but how would i make it to run indefinitely?

Thanks!!

Hey Johannes,
did you read a bit through the esphome docu and the links I’ve sent you? Did you get my example working? You should have a slider in Home Assistant to control the motor in some way. Did you get that far?

Next you need to think about your use case. What do you want to achieve? Can you explain it in simple technical words? Happy to help with the steps