Smart HomeEngineer

Smart Motorized Blinds with a Stepper Motor

Open the blinds at sunrise and close them when the room gets hot, using a stepper motor and ESPHome.

LevelEngineer
Time3 h
Est. cost~$40
Steps5

A 28BYJ-48 stepper geared down 64:1 has enough torque to turn the tilt wand of most blinds. ESPHome exposes it to Home Assistant as a cover you can open, close or set to any position.

Mission steps

  1. Print a coupler

    Print an adapter that connects the motor shaft to your blinds' tilt rod or wand.

  2. Wire the driver

    ULN2003 inputs IN1–IN4 to four ESP32 GPIOs, driver power from 5 V.

  3. Configure ESPHome

    Use the uln2003 stepper and a template cover with open and close step counts.

  4. Calibrate

    Count the steps between fully closed and fully open and set them in the config.

  5. Automate

    Open at sunrise, close when indoor temperature passes 27 °C or at sunset.

Code

stepper:
  - platform: uln2003
    id: blind_motor
    pin_a: GPIO4
    pin_b: GPIO5
    pin_c: GPIO6
    pin_d: GPIO7
    max_speed: 300 steps/s
    sleep_when_done: true

cover:
  - platform: template
    name: "Bedroom Blinds"
    open_action:
      - stepper.set_target: {id: blind_motor, target: 2048}
    close_action:
      - stepper.set_target: {id: blind_motor, target: 0}
    stop_action:
      - stepper.set_target: {id: blind_motor, target: !lambda return id(blind_motor).current_position;}
    optimistic: true

Tip: test every script on the bench before installing it in a moving machine.

Questions

Can it lift roller shades?

Heavy roller shades need a stronger motor (NEMA 17 with a driver like the TMC2209). The 28BYJ-48 is best for tilting slats.