eg321 / esp32-motorized-roller-blinds

Control your motorized blinds with Web interface/ MQTT. Easy integration with automation systems like Home Assistant and OpenHab. 3d printing model for Leroy Merlin blinds.
https://www.thingiverse.com/thing:4093205
MIT License
88 stars 20 forks source link
home-assistant home-automation homeassistant openhab

Russian version available here.

Hi there!

The project is dedictated to control of motorized blinds’ operation and its integration into home automation systems (f.ex. Home Assistant and OpenHab).

The project developing consists of 2 major areas:

A bit details below...

ESP8266 / ESP32 firmware

I'm trying to keep compatibility with both platforms. Main differences between them:

If you would to connect 1 or 2 steppers only, use cheaper ESP8266 based controller (like Wemos D1 mini, NodeMCU, etc).

Features

Web-interface

Control blinds:

Set end-points:

Captive Portal

You'll be redirected to Captive portal after connecting to "esp-xxxx" WiFi network:

Fill pins for needed Steppers divided by comma and check pins for your mechanical buttons Up/Down (or disable it).

MQTT

Just do not setup MQTT details at Captive Portal, if you don't want to use MQTT.

MQTT details:

HomeAssistant integration

There is MQTT auto-discovery implemented for HomeAssistant with default MQTT prefix (requires HA v2021.11 at least). It assists you to create objects with correct configuration.

In case it does not work for you, you can add blinds manually. See examples below.

Config example for 2 roller blinds (replace "_chipId" with Chip id of your controller, watch it at registration topic - /ESP_Blinds/register):

cover:
  - platform: mqtt
    name: "Blind 1"
    device_class: "blind"
    command_topic: "ESP_Blinds/_chip_Id_/in"
    set_position_topic: "ESP_Blinds/_chip_Id_/in"
    set_position_template: '{"num": 1, "action": "auto", "value": {{ 100 - position }} }'
    position_topic: "ESP_Blinds/_chip_Id_/out"
    position_template: '{{ value_json.position1 }}'
    payload_open: '{"num": 1, "action": "auto", "value": 0}'
    payload_close: '{"num": 1, "action": "auto", "value": 100}'
    payload_stop: '{"num": 1, "action": "stop", "value": 0}'
    position_open: 0
    position_closed: 100
    optimistic: false

  - platform: mqtt
    name: "Blind 2"
    device_class: "blind"
    command_topic: "ESP_Blinds/_chip_Id_/in"
    set_position_topic: "ESP_Blinds/_chip_Id_/in"
    set_position_template: '{"num": 2, "action": "auto", "value": {{ 100 - position }} }'
    position_topic: "ESP_Blinds/_chip_Id_/out"
    position_template: '{{ value_json.position2 }}'
    payload_open: '{"num": 2, "action": "auto", "value": 0}'
    payload_close: '{"num": 2, "action": "auto", "value": 100}'
    payload_stop: '{"num": 2, "action": "stop", "value": 0}'
    position_open: 0
    position_closed: 100
    optimistic: false

Use same approach for other your blinds.

Mechanical part

The most popular option uses cheap 28BYJ-48 steppers, but in fact you can use any 4-pin stepper motors (dual winding steppers). 28BYJ-48 is most often used with the ULN2003 driver (better to use 12 volt version, it gives more torque).

I have developed 2 models for converting Leroy Merlin' roller blinds into motorized ones:

  1. for the old models. It looks like they are almost not sold anymore.
  2. for a new (will publish soon). The fixing holes match the original parts, so the curtains can be easily converted to motorized and vice versa.

3 printing models are available at 3d_parts directory or at Thingiverse directly with some instructions.

Future plans

Project history

This project appeared as fork of @nidayand repository originally.

Unfortunately, the project supported ESP8266 and 1 stepper only, plus it had not been updated for a long time. I added support for Platformio (for easier development), multiple steppers, and ESP32 later (so more than 2 steppers can be connected to single controller). It was published as v1.4.x.

Soon I wanted a more convenient motor control, a simple controller configuration without firmware re-build, but the original code was of little messy to maintain, although it worked. As a result, a large refactoring of the firmware took place - new classes and areas of responsibility were allocated.

In fact, it became clear that almost nothing remained of the old project (only the Web UI almost unchanged). This project was detached and now developing on its own tree.