Turn any curtain into smart blinds

Obligatory TL;DR demo

Introduction

With being active in home automation for the last 5 years, I’ve by now (like most of you) automated all my lights and put temperature and humidity sensors on more places than strictly necessary. So, it only logical next step in my home automation journey is.. automating my curtains!

I quickly figured out that the off-the-shelf solutions are either expensiveneed charging or simply don’t exist for curtain rods. So the only logical step is to go the DIY route!

Materials

An important part of this build is that the solutions should work with the Bekräfta curtain rod since that is what I already had installed at home. So, what you will need:

3D printer for:

  • 1 timing belt clip,
  • 2 stepper motor mounts
  • 1 box for electronic
  • 1 lid

All 3D parts can be found here and here.

Installing the hardware

Alright, so I’m going to assume that you already have working curtains that move — reasonably — smoothly. First, let’s connect the mount to the brackets.

Overview of the stepper motor in one corner mounted to the IKEA bracket

Next, let’s add the timing belt and the clip around the stepper motors

Picture of the clip that connects the timing belt to the curtain.

We’re getting there!

The next step is to connect the belt clip to the belt and the curtains. Below you can find a schematic of how it will open and close the curtains. To connect the clips, I recommend first completely opening the curtains and then connecting the left curtain on the top of the timing belt and the right curtain on the bottom of the timing belt.

Schematic of curtains opening. The yellow lines represent the connector and tie-wrap connected to the ring of the curtain.
Schematic of curtains closing. The yellow lines represent the connector and tie-wrap connected to the ring of the curtain.

Now that the stepper motors are in place, it is time to wire everything up and put it in the enclosure to ensure WAF.

Schematic of how to connect stepper motors to ESP chip
Wiring overview. All credits to https://github.com/TrDA-hab. I only added a green line for the connection to the additional GPIO for the counter.
D1 > EN(ABLE) // Turns the steppers on/off before/after the operation
D2 > DIR(ECTION) // Sets the direction of the stepper
D3 > STEP // Does the actual turning of the stepper motor
D4 > STEP // Linking D3 back to D4 and STEP allows keeping track of the number of pulses that have been sent to the A4988 and thus telling the device what the current position is

Though this overview is pretty straightforward, there are some things to keep in mind:

  1. I didn’t use a stepper motor parallel board but split one cable into two
  2. Make sure to use high-quality connectors (I had some issues with one stepper not working due to this. Definitely hard to debug)
Picture of the box with the ESP8266, A4988 stepper drivers, power supply and the right stepper

Setting up the software

To make the stepper motors spin, we will be using Tasmota. Though Tasmota is a peace of home automation software that can do a lot, I will focus on setting it up for only the blinds here.

Note: I also considered ESPHome, since I also use that a lot and personally find it a bit easier to configure. During testing, I found out that the speed and torque of the stepper motors were significantly lower, unfortunately, so I stuck with Tasmota.

Install Tasmota on ESP chip

Example screen of Tasmotizer
  1. Download Tasmotizer.
  2. Open Tasmotizer
  3. Click on the Refresh button
  4. Note down which COM ports are already shown
  5. Connect your ESP8266 via USB
  6. Click on refresh again and select the newly added COM device
  7. Under ‘Select image’ click Release
  8. Click Tasmotize!
  9. Wait until done

Setup wifi

Example of Tasmota hotspot portal for setting up wifi
  1. Look for and connect to a wifi network called tasmota_XXXX
  2. Connect.
  3. A browser should open automatically. If not, go to http://192.168.4.1
  4. Fill in the Wifi SSID and Password.
  5. Save
  6. Connect to the same network and look up the IP-address
  7. You should be seeing the

Configuring Tasmota

Configuration example of Tasmota for automated curtains

Right, we’re getting there. Now it is time to configure the module so it knows which pins to use

  1. Go to Configuration > Configure Module
  2. Set Module Type to ‘Generic (0)’
  3. Save and wait until rebooted
  4. Go again to Configuration > Configure Module
  5. Set the following configuration:
D3 > PWM 1
D4 > Counter 1
D2 > Relay 2
D1 > Relay_i 1
  1. Save and wait until rebooted
  2. Click on Console
  3. Enter the following commands in the console, tapping enter after every line (directly taken from the Tasmota documentation):

a) Set ShutterMode 4

Backlog PulseTime1 0; PulseTime2 0 // for relay Relay1i and Relay2
Interlock OFF // this is a global variable for all Relays or at least the RELAYS NOT in the Interlock group PWM1 and COUNTER1 defined

b) Enable Shutters

SetOption80 1 // this is a global variable for all Shutters

c) Configure Shutter 1 and test ShutterMode 1 is working

ShutterRelay1 1 // for relay Relay1i and Relay2

d) Set the stepper motor speed (optional setting)

ShutterFrequency 1500 // this is a global variable for all steppers (1000rpm by default)

e) Set at least a small ramp-up/ramp down period 1.0 second (optional)

ShutterMotorDelay1 1.0 // Stepper do not like infinite momentum. Ramp up/down speed allow much higher frequencies.

f) Restart Tasmota

Restart 1

Testing and doing shutter calibration

Now that we have everything wired up and the module configured, we should be able to control the steppers, nice! Let’s test them:

  1. Navigate to the console
  2. Enter ‘ShutterOpen1’ in the console (NB: Make sure to have the ShutterStop1 command ready since your motors will start spinning immediately! If it is the wrong way, they might get stuck)
  3. Enter ‘ShutterClose1’ to close them
  4. Optionally set ‘ShutterInvert1’ they are spinning the wrong way
  5. If your blinds are currently open, enter ‘ShutterSetOpen1’. If they are closed, enter ‘ShutterSetClose1’
  6. Set an initial number for the number of seconds it should take to open or close the current. Set these by entering ‘ShutterOpenDuration X’ and ‘ShutterCloseDuration X’
  7. Click on Main Menu and use the up and down arrow to try your setup
  8. Adjust the timings until you have something fully opens and closes the curtain
  9. Use the slider to set the curtain to 50% open
  10. Enter ‘ShutterSetHalfway1 50’ to also calibrate what 50% open is

Congratulations 🎉 !! You are now the official owner of a one-of-a-kind smart IKEA curtain that can be controlled while lying on the couch.

Optionally: connect with Home Assistant

The IoT curtain in the Home Assistant front-end

Of course, an IoT curtain is fun, but what we really want is to be able to run some automation, so everything goes automagically. Some automations I have at home:

  1. Open/close the curtain at sunrise/sunset.
  2. Auto-close the curtain when the sun is shining bright to prevent the floor from discolouring.
  3. Auto-close the curtain when I lock the backdoor and the sun is below the horizon.

Home Assistant is one of the best (if not the best) tools out there for running these kinds of automations. If you haven’t heard of them yet, check them out here.

What do you need to connect the curtain to Home Assistant?

  1. Go to the Console
  2. Enter ‘SetOption19 0’
  3. Go to the Main Menu > Configuration > Configure MQTT
  4. Enter the following values:
  5. Host > IP address of your broker, most likely the same as Home Assistant
  6. Port > Don’t change
  7. Client > Don’t change
  8. User > Enter User of MQTT Broker
  9. Password > Enter Password user in MQTT Broker
  10. Topic > Don’t change
  11. Full Topic > Don’t change
  12. Click Save
  13. Go to Home Assistant > Integrations > + Add Integration
  14. Search for Tasmota and click on it (more details here)
  15. Your curtain should show up under the Tasmota integration ready to be used 💃🏻

Wrap-up

That is it! For me personally, this was one of the tougher projects to get right, since they are a lot of custom things. I hope that I have been able to help you get started with your own smart curtains or inspire a completely different approach.

Additional readings and acknowledgements

Since this project runs on loads of cool open-source projects I would definitely recommend checking out the documentation and showing some ❤️ to the people who created those.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top