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.
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
Print a coupler
Print an adapter that connects the motor shaft to your blinds' tilt rod or wand.
Wire the driver
ULN2003 inputs IN1–IN4 to four ESP32 GPIOs, driver power from 5 V.
Configure ESPHome
Use the uln2003 stepper and a template cover with open and close step counts.
Calibrate
Count the steps between fully closed and fully open and set them in the config.
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: trueTip: 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.