Stepper DRV8825 -- Button press not working to run the motor?

I’m doing a test rig to be able to replace my arduino blinds with esphome. So this is the first time I’m really focusing a lot on esphome. And also my first time using displays, rtc, and motors with esphome.

I’m not sure if it’s the driver that is not compatible with esphome or I wired it all wrong, but I have a DRV8825 driver which is similar to A4988.

As it says on esphome, to run the motor, this is what I need:

  - platform: gpio
    pin:
      number: D4
      mode: INPUT_PULLUP
      inverted: True
    name: Button Up
    id: button_up
    on_press:
      then:
        - stepper.report_position:
            id: stepper_motor
            position: 0
        - stepper.set_target:
            id: stepper_motor
            target: 150

But I just can’t get the motor working. I’m not even sure why the Vref is 0. It should have at least 0.6v. I tested it on my arduino device, but the driver is working fine.

The entire script:

esphome:
  name: blinds-bedroom
  platform: ESP8266
  board: d1_mini

  on_boot:
    then:
    - ds1307.read_time
    - display.page.show: intro_page
    - delay: 2s
    - display.page.show: main_page
    #- lambda: id(oled).turn_on();
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  power_save_mode: none
  #output_power: 20.0
  fast_connect: on

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
#  password: "***"


#  # Enable fallback hotspot (captive portal) in case wifi connection fails
#  ap:
#    ssid: "Blinds-Bedroom Fallback Hotspot"
#    password: "***"

captive_portal:


#Time
time:
  - platform: homeassistant
    id: homeassistant_time
    on_time_sync:
      then:
        ds1307.write_time:
  - platform: sntp
    id: sntp_time
  - platform: ds1307
    id: ds_time

#Light Sensor
sensor:
  - platform: adc
    id: ambient_sensor
    pin: A0
    name: "Ambient Light"
    update_interval: '1s'
    unit_of_measurement: lux
    filters:
      - lambda: |-
          return (21 - (x * 21));

#Stepper Motor
stepper:
  - platform: a4988
    id: stepper_motor
    dir_pin: D8
    step_pin: D7
    max_speed: 250 steps/s
    acceleration: 200
    deceleration: 200
    
    #Optional
    sleep_pin: D6

#OLED Display
i2c:
  sda: D1
  scl: D2

display:
  - platform: ssd1306_i2c
    id: oled
    model: "SSD1306 128x32"
    address: 0x3C

    pages:
      - id: intro_page
        lambda: |-
          it.print(15, 12, id(calibri1), "Test Blinds.");
      - id: main_page
        lambda: |-
          it.strftime(0, 8, id(calibri1), TextAlign::BASELINE_LEFT, "%a, %B %d, %Y", id(ds_time).now());
          it.strftime(0, 18, id(calibri1), TextAlign::BASELINE_LEFT, "%I:%M:%S %p", id(ds_time).now());
          it.printf(0, 22, id(calibri1), "%.0f%% Lux", id(ambient_sensor).state);

binary_sensor:
  - platform: gpio
    pin:
      number: D4
      mode: INPUT_PULLUP
      inverted: True
    name: Button Up
    id: button_up
    on_press:
      then:
        - stepper.report_position:
            id: stepper_motor
            position: 0
        - stepper.set_target:
            id: stepper_motor
            target: 150

  - platform: gpio
    pin:
      number: D3
      mode: INPUT_PULLUP
      inverted: True
    name: Button Down
    id: button_down
    on_press:
      then:
        - stepper.report_position:
            id: stepper_motor
            position: 0
        - stepper.set_target:
            id: stepper_motor
            target: -150

font:
  - file: "fonts/times.ttf"
    id: calibri1
    size: 10
  - file: "fonts/times.ttf"
    id: calibri2
    size: 35
  - file: "fonts/calibri.ttf"
    id: calibri3
    size: 30

What is it that I’m missing that I can’t get the motor working? Could it be that the driver is incompatible (which I think is not really the case).

I just need the motor to move forward or backward with a press of a button. Can anyone help? Thanks.

Please don’t cross post the same message repeatedly.

Sorry.

Anyway, I had to dig through my old schematic and found out that I used the EN pin as the SLEEP pin. And I connected the SLEEP pin and RESET pin together and hooked it up on 3v3. This enabled the driver to send power to the motor. But I’m still trying to figure out how to get the motor to run continuously when the button is pressed and hold.

I bought the A4988 driver. DRV8825 is actually not compatible with ESPHome even if the pin configurations are nearly identical. I believe that the motor pins are not exactly the same.

@crispywisp I also found out the hard way that these are not compatible, have just ordered a4988, did you have success in the end with these?

This is the schematic I used, is this the same schematic as with the 4988?