Software apps and online services
Hand tools and fabrication machines
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 expensive,need charging or simply don’t exist for curtain rods. So the only logical step is to go the DIY route!Installing the hardware
Alright, so I’m going to assume that you already have a working IKEA curtains that moves — reasonably — smoothly. First, let’s connect the mount to the brackets.
Next, let’s add the timing belt and the clip around the stepper motors
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.
Now that the stepper motors are in place, it is time to wire everything up and put it in the enclosure to ensure WAF.
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:
- Make sure to use high-quality connectors (I had some issues with one stepper not working due to this. Definitely hard to debug)
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
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 doneSetup wifi
1. Look for and connect to a wifi network called tasmota_XXXX
3. A browser should open automatically. If not, go to http://192.168.4.1
4. Fill in the Wifi SSID and Password.
6. Connect to the same network and look up the IP-address
7. You should be seeing theConfiguring Tasmota
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
6. Save and wait until rebooted
7. Click on Console
8. Enter the following commands in the console, tapping enter after every line (directly taken from the Tasmota documentation):
Testing and doing shutter calibration
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
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
Of course, an IoT curtain is fun, but what we really want is to be able to run some automations so everything goes automagically. Some automations I have at home:
- Open/close the curtain at sunrise/sunset.
- Auto-close the curtain when the sun is shining bright to prevent the floor from discolouring.
- 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 SaveGo to Home Assistant > Integrations > + Add Integration
13. Search for Tasmota and click on it (more details here)
14. 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.
- Tasmota documentation about Shutters and Blinds
- Home Assistant Tasmota integration documentation
- Home Assistant MQTT integration documentation
- GitHub Issue where the support for blinds was discussed. A great resource for in-depth troubleshooting and understanding.