Blinds Control With ESP8266, Google Home and Openhab Integration and Webcontrol

30,233

288

12

About: I like to combine electronics like Arduino's, ESP8266 etc with 3D designing and 3D printing.

In this Instructable I show you how I added automation to my blinds. I wanted to be able to add and remove the automation it, so all installation is clip on.

The main parts are:

  • Stepper motor
  • Stepper driver controlled bij ESP-01
  • Gear and mounting bracket

I controll the blinds via Google Home, my Openhab server and a website.

You can still manually control the blinds, because when the blinds are not opening or closing automatically, the stepper motor is disabled.

Supplies:

I bought most components form Aliexpress

ESP8266: ESP-01

Stepper motor

A4988 stepper driver

Chain for controlling blinds

Buck converter

Power supply

I designed and printed the gear and mounting bracket myself

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Stepper Motor, Gears and Handles

I removed the gear from the curtain roller to re-engineer the gear in Fusion360. I experimented with different gears. Smaller gears gave a larger torque, but less grip on the ball-chain. A gear with 12 teeth worked best for me and I designed a mounting bracket to fit the stepper motor and the gear with the ball-chain.

I designed the handles to clip on the standard Luxaflex handles.

The STL files of all 3D parts are published on my Thingiverse page.

Step 2: Stepper Driver Hardware

The hardware consists of:

  • Step down (buck) converter (12V to 3.3V) to power the ESP-01 and the A4988 stepper driver
  • ESP-01 which connects to the WiFi network and controls the stepper driver (enable/disable, motor direction and steps)
  • Stepper driver A4988
  • Stepper motor (17HS4401)
  • Some electronic components

I soldered the female connectors to a perf board and connected the components mentioned above.

Step 3: Software

The code is published on my Github.

The program:

  • Connects to the WiFi network and MQTT server
  • Checks whether to state of the blinds is equal to the setting, if not it changes the state to match the setting. Then enable the stepper motor, execute the right number of steps. Disable the stepper motor.
  • A setting can be received via MQTT or via the Webserver.
  • The webserver may enter the HTTPUpdateServer mode to OTA update the firmware.

Disabling the stepper motor by setting the 'EN' pin of the A4988 driver is important to:

  • Reduce the amount of current used by the device if the setting remains the same (vast majority of the time)
  • Enable manual control of the blinds.

The HTTPUpdateServer is enabled at IP address/update. Before entering the update mode via the webserver, it changes the state to the CENTER state, since the program starts up in the CENTER state.

This is how I derived the number of steps:

The total length of cord between closed and opened is approximately 40 cm.
One revolution of the gear is approx. 7.5 cm.The total length of the cord is 40 / 7.5 = approx. 5.3 revolutions.
I don't want to stretch the cord and the device starts from the middle position, so I round it to 5 revolutions (2.5 in one and 2.5 in the other direction).
One revolution of the stepper motor is 200 steps, but I have set my stepper motor driver to quarter steps, so one revolution is 800 quarter steps. 5 revolutions is 4000 quarter steps (MAX_STEPS).
The close setting (CLOSE_STEPS) is 90% closed = 3600 steps; the open setting (OPEN_STEPS) is 10% = 400 steps.
The middle position (CENTER_STEPS) is 50% is 2000 steps and is the initial number of steps when the device starts.

Step 4: Assembly

My controller is shoven to the windowsill via the mounting bracket of the stepper motor

I designed a back end for the stepper motor containing the stepper driver and ESP-01.

Step 5: Home Automation

I have a Raspberry Pi Zero running Raspbian Stretch lite, NodeRed and Openhab 2.4.0

My Openhab items, rules and sitemap are on my Github.

The Google Home Openhab integration is described here.

If my TV is turned on via Openhab, blinds close according to the rule.

"Hey Google, set window blinds to 50"

In this case Node Red is only used for debugging purposes.

Share

    Recommendations

    • Indoor Lighting Contest

      Indoor Lighting Contest
    • Make It Fly Challenge

      Make It Fly Challenge
    • Growing Beyond Earth Maker Contest

      Growing Beyond Earth Maker Contest

    12 Discussions

    0
    None
    dPortland

    17 days ago

    Been contemplating just the same project.
    But with a temperature sensor to open and close blinds.
    I plan on using an arduino pro mini at 3.3v with solar cells to power it. Just because I have them and it keeps things simple. Until the coding part.
    Thank you for the post.


    3 replies
    0
    None
    Wim3ddPortland

    Reply 16 days ago

    Thank you.
    Interesting to use solar power. How do you plan to power the stepper motor, which needs a lot of current/power? Do you plan to store the energy in batteries?

    0
    None
    dPortlandWim3d

    Reply 14 days ago

    That was my plan.
    We have vertical blinds. Cat approved.
    Offering me lots space for mounting solar cells on the blinds themselves. Close to the top enclosure for storage space for batteries, ECT. If I eliminate the board and line everything up flat. It will fit into existing space.
    Already have several pro mini 3.3v, solar panels, and batteries.
    If I can figure out a way to mount the stepper at the top. I will get the driver and motor. Then proceed with prototype.

    0
    None
    dPortlanddPortland

    Reply 14 days ago

    Also need to figure out a position indicater.
    Timed movement won't work.
    But the right prox might.

    0
    None
    vks007

    15 days ago

    It would be nice to see a video of the curtain rolling up and down and also how have you been able to control the curtain manually apart from via the motor.

    1 reply
    0
    None
    Wim3dvks007

    Reply 15 days ago

    Thanks for your comment.
    The stepper motor only tilts the blinds from opened (light) to closed (dark), see the added video The stepper motor is not powerful enough to raise the blinds. It also is not possible to lower the blinds from the motor position, since you have lower it with the raise and lower cord in a diagonal position.
    When the blinds are not opening or closing automatically, the stepper motor is disabled. This not only saves a lot of power, but also makes a manual control possible.

    0
    None
    LaurentM

    17 days ago

    Nice post. I've been thinking about how I could make my blinds smart and this looks like a nice cheap solution
    Can you share how you figured out the number of steps ?
    #define OPEN_STEPS 400#define CENTER_STEPS 2000#define CLOSE_STEPS 3600#define MAX_STEPS 4000

    1 reply
    0
    None
    Wim3dLaurentM

    Reply 16 days ago

    Thanks for your reaction, I hereby explain the number of steps. I you have other questions, do not hesitate to ask.
    The total length of cord between closed and opened is approximately 40 cm.
    One revolution of the gear is approx. 7.5 cm.
    The total length of the cord is 40 / 7.5 = approx. 5.3 revolutions.
    I don't want to stretch the cord and the device starts from the middle position, so I round it to 5 revolutions (2.5 in one and 2.5 in the other direction).
    One revolution of the stepper motor is 200 steps, but I have set my stepper motor driver to quarter steps, so one revolution is 800 quarter steps. 5 revolutions is 4000 quarter steps (MAX_STEPS).
    The close setting (CLOSE_STEPS) is 90% closed = 3600 steps; the open setting (OPEN_STEPS) is 10% = 400 steps
    The middle position (CENTER_STEPS) is 50% is 2000 steps and is the initial number of steps when the device starts (see lines 35 and 36 of the code).

    0
    None
    Guardempire

    17 days ago

    THX THX THX for sharing! This thing is now on my list to do next!!!

    1 reply
    0
    None
    verezz

    Question 27 days ago on Step 5

    As i see You use OpenHab automation software, what function of NodeRed is?

    1 answer
    0
    None
    Wim3dverezz

    Answer 26 days ago

    In this case I only used Node Red for debugging purposes in the development fase. See the attached screenshot below (it appears as a white picture)

    2019-07-30 19_07_58-Node-RED _ 192.168.10.104.png2019-07-30 19_12_45-Document1 - Word.png