A smart curtain motor with ESP32 and Home Assistant is one of the most satisfying home automation projects you can build in India. Imagine your curtains automatically opening at sunrise and closing when the afternoon sun heats up your room — all controlled via your smartphone or a voice command to Google Assistant. This project is especially popular in Indian homes where heavy curtains are used year-round for privacy and sun protection.
Table of Contents
- Project Overview and Components
- Choosing the Right Motor for Indian Curtains
- Wiring the ESP32 to Motor Driver
- ESPHome Configuration
- Home Assistant Integration
- Automation Ideas for Indian Homes
- Physical Installation Tips
- Frequently Asked Questions
Project Overview and Components
This smart curtain motor project uses an ESP32 microcontroller running ESPHome firmware, connected to a stepper or DC gear motor that drives your curtain rail. The total cost is typically between ₹800–₹1,500 in India — a fraction of commercial smart curtain motors like Zemismart or Yooda which cost ₹3,000–₹8,000.
Required Components
- ESP32 development board (38-pin or 30-pin)
- 28BYJ-48 stepper motor + ULN2003 driver (or DC gear motor + L298N)
- Hall effect sensor or optical endstop (for position detection)
- 5V power supply (sufficient for ESP32 + motor)
- 3D printed or aluminium curtain rail adapter
- Jumper wires and a small enclosure
Choosing the Right Motor for Indian Curtains
The choice of motor depends on your curtain weight and rail length. Indian homes typically use heavy cotton or blackout curtains weighing 500g–2kg per panel.
28BYJ-48 Stepper Motor (Recommended for Light Curtains)
This ₹80–₹120 stepper motor is ideal for lightweight curtains up to 1kg. Its built-in gear reduction provides good torque and precise position control. The ULN2003 driver module makes interfacing with ESP32 simple.
- Torque: 34.3 mN·m
- Steps: 2048 per revolution (in half-step mode)
- Operating voltage: 5V
- Best for: Single-panel curtains, lightweight fabric
DC Gear Motor with L298N (Recommended for Heavy Curtains)
For heavy Indian curtains, a 12V DC gear motor (RPM: 10–60) with L298N motor driver provides more torque. Add a limit switch or hall sensor to detect open/close positions.
- Torque: Up to 5–10 kg·cm depending on model
- Speed control via PWM
- Best for: Heavy blackout curtains, double-panel setups
Wiring the ESP32 to Motor Driver
For the 28BYJ-48 stepper with ULN2003:
ESP32 Pin → ULN2003
GPIO 12 → IN1
GPIO 14 → IN2
GPIO 27 → IN3
GPIO 26 → IN4
5V → VCC
GND → GND
Endstop (Open):
GPIO 34 → Left limit switch (NO)
GPIO 35 → Right limit switch (NO)
GND → Switch common
ESPHome Configuration
ESPHome has a built-in cover component that integrates seamlessly with Home Assistant. Here is a configuration for stepper-based curtains:
esphome:
name: curtain-motor
esp32:
board: esp32dev
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
api:
logger:
ota:
stepper:
- platform: uln2003
id: my_stepper
pin_a: GPIO12
pin_b: GPIO14
pin_c: GPIO27
pin_d: GPIO26
max_speed: 250 steps/s
sleep_when_done: true
cover:
- platform: endstop
name: "Living Room Curtain"
open_endstop: GPIO34
close_endstop: GPIO35
open_action:
- stepper.set_target:
id: my_stepper
target: 0
close_action:
- stepper.set_target:
id: my_stepper
target: 2048
stop_action:
- stepper.set_target:
id: my_stepper
target: !lambda return id(my_stepper).current_position;
Home Assistant Integration
Once ESPHome is flashed and connected to WiFi, Home Assistant discovers the curtain device automatically via mDNS. The curtain appears as a cover entity with full open/close/stop/position controls.
Lovelace Card for Curtains
type: cover
entity: cover.living_room_curtain
name: Living Room Curtains
show_buttons_control: true
show_position_control: true
show_tilt_position_control: false
You can also use the popular Mushroom Cover Card from HACS for a more visually appealing control with curtain icons that animate as the curtain moves.
Automation Ideas for Indian Homes
The real value of a smart curtain motor comes through automations. Here are India-specific ideas:
Sunrise/Sunset Automation
Automatically open curtains 30 minutes after sunrise and close them at sunset. In Indian cities, sunrise varies from 5:30 AM to 7:00 AM seasonally — Home Assistant uses your GPS coordinates for accurate local sunrise times.
alias: Morning Curtains
trigger:
- platform: sun
event: sunrise
offset: "+00:30:00"
action:
- service: cover.open_cover
target:
entity_id: cover.living_room_curtain
Temperature-Based Automation
Close curtains automatically when indoor temperature exceeds 32°C (common in Indian summers). Combine with an AM2302/DHT22 sensor to protect the room from afternoon heat.
Privacy Mode
Close all curtains when you activate “Guest Mode” or “Movie Mode” via a single dashboard button. Indian joint families particularly appreciate privacy automations.
Power Outage Awareness
Use a UPS/inverter monitor integration to ensure curtains retract to a safe position during power cuts — important since stepper motors lose their position memory when power is removed.
Physical Installation Tips
Installation is the trickiest part. Indian curtain rails vary widely — from simple plastic tracks to aluminium double-track systems.
Curtain Track Adapter
3D print or purchase a pulley adapter that attaches to your existing curtain track. The motor drives the pulley via a cord or direct gear meshing with the track.
Mounting the Motor Assembly
- Mount the motor at the wall end of the curtain track
- Use M3 screws and a custom bracket (easily 3D printable)
- Ensure the motor housing doesn’t touch the wall to avoid vibration noise
- Run 5V power cable along the curtain pelmet or wall edge
Position Calibration
After installation, calibrate the fully open and closed positions via Home Assistant’s developer tools. Store these as step counts in EEPROM so the motor remembers its position after power cuts.
Frequently Asked Questions
Can I use this system with track curtains (the type common in Indian flats)?
Yes. The most common Indian flat curtain tracks (plastic C-track or I-track) can be motorised with a cord-driven system. The motor pulls a looped cord attached to the curtain carrier. This approach requires no modification to your existing track.
What happens when power goes out?
For stepper motors, the curtain stays in its last position (motor holds when powered off). For DC motors, add a manual override cord so family members can open/close curtains without electronics. Always include a physical button for safety.
How much does this project cost in India?
A complete DIY smart curtain motor costs ₹700–₹1,500 per curtain depending on motor choice. This compares favourably to commercial smart curtain motors (₹3,000–₹8,000) while offering superior Home Assistant integration.
Is ESPHome mandatory or can I use Tasmota?
Both work, but ESPHome is strongly recommended for motor/cover control as it has native stepper motor and endstop support. Tasmota’s stepper support is limited and requires custom Berry scripting for position tracking.
Can I control curtains with Google Assistant or Alexa?
Yes. Once in Home Assistant, curtains can be exposed to Google Home or Alexa via the official Home Assistant cloud integration (Nabu Casa) or local voice assistants. Voice commands like “Hey Google, open the bedroom curtains” work seamlessly.
Add comment