Motorized WiFi IKEA Roller Blind




About: IT-professional by day, DIY hobbyist (among other things) on my free time. I always have one or more projects going on. Usually something to do with home improvement or a tech project or a combination of the...

Intro: Motorized WiFi IKEA Roller Blind

I confess. I have been sucked in to a home automation addiction. The next thing on my radar was to automate roller blinds. There are commercial products available but the ones I found are surprisingly expensive (about 80 - 90 USD). Since I need a bunch, it was hard to motivate the purchase (and less fun). I decided to design my own.

If you like this Instructable, please vote for it in the Microcontroller contest (press Vote above)!

These were my requirements:

  • WiFi capable
  • MQTT control (0% - 100%)
  • Manual push button operation
  • Use low cost standard electronic components and 3D-printable parts
  • Persist state on power off

This instructable is a followup to

Step 1: Bill of Materials

The motor parts add up to about 15-20 USD per unit. The shade itself is 19 USD.

Step 2: Wiring

  • Wire the motor to the shield as seen in the pictures. Take note of the colors.
  • Solder cables to the micro switch as seen in the picture. If you can, use red, black and white as in the picture.
  • Attach the button wires to (GPIO) 5 as seen in the picture

Step 3: Set Up a MQTT Broker

MQTT is a lightweight publish/subscribe protocol suitable for small IoT devices. The devices interact with a message broker which manages the distribution of messages. You can either use a local mqtt broker, e. g. Mosquitto inside your own network or connect to a cloud MQTT broker. Which option is best? It depends on your needs. If you want to be able to connect to the broker from anywhere you may prefer the cloud option. If you prefer to keep your IoT within you network you should use a local broker.

Setting up a cloud broker:

  1. Register at CludMQTT:
  2. Creat a new broker instance
  3. Click the instance info and keep the info handy
  4. For testing purposes, download MQTT.fx:
  5. Add a profile to MQTT.fx with the credentials from your newly created cloud broker.
  6. Connect. If it works you have successfully tested the connection to your fresh cloud broker.

Step 4: The Software

The ESP8266 on which the NodeMCU development board is a single chip computer with I/O capabilities and WiFi. The chip can be programmed in various ways. The two most popular options are the Arduino IDE and the Lua interpreter. For this project I chose Lua out of convenience. Some of the features in the software are easier in Lua because of the built in file system.

Flash the Lua Firmware

Even if your NodeMCU is pre-flashed with a Lua firmware I recommend that you re-flash it with a new firmware. That way you get a fresh version and can slim the binary to only contain the needed modules.

  1. Cook a LUA firmware here: Select the following modules: file, GPIO, MQTT, net, node, PWM, timer, WiFi and optionally enable SSL
  2. Wait for the email with the firmware download link, then download. It should only take a few minutes. You may want to check your spam filter for it. That's where mine was.
  3. Download Flash tool:
  4. Flash the firmware using the flash tool
    1. Run the tool
    2. Connect the NodeMCU holding the flash button
    3. Select the serial port
    4. Select the firmware file
    5. Press Flash

Install the rollerblind code

  1. Download the roller blind code here:
  2. Download ESPlorer IDE:
  3. Open Esplorer
    1. Select the serial port
    2. Connect
    3. Open all the lua files
    4. Edit settings.lua and enter WiFi and MQTT settings
    5. Upload all lua files (Save to ESP)
    6. Reset device

    Step 5: Dry Run

    Now would be a good time to check the software and wiring.

    • Open up esplorer and connect
    • Run the following command line (see picture). The motor should rotate 1000 steps (about a quarter of a turn.

    Step 6: 3D Printed Parts

    I designed the parts in Fusion 360.

    Download the parts from and start printing!

    Step 7: Assembly

    This is what you need to do for assembly (watch video):

    1. Heat the soldering iron to about 200 degrees C (400 F).
    2. Embed the nut inserts into the plastics by placing the insert over the tip (so it heats up) and gently push it into the plastic sockets (see picture).
    3. Remove the lever from the micro switch
    4. Loosen the plastic hinge on the lid button (gently push it out and back in)
    5. Push the micro switch in place
    6. Push the motor shield into place
    7. Insert the motor
    8. Screw the plastic parts

    Important note on power: I have found that if you have a narrow window or short travel distance you are fine with just USB power (5v) but for wider and longer blinds you need external power (max 9v DC). You attach external power to the motor shield. Make sure you disconnect USB before you do or you are likely to fry something.

    Step 8: Mount Rollerblind

    Replace the springloaded end mount and insert of the Ikea rollerblind with the printed motor mount and printed insert.

    Step 9: Calibration

    Windows are of different heights; hence the gadget has to be calibrated. This is how:

    1. Long press the button (> 2s)
    2. The shade starts going down
    3. When the shade reaches desired bottom position, short press
    4. When the shade reaches derired top position, short press again
    5. Done!

    Step 10: MQTT Control

    • Download MQTT.fx from here:
    • Start MQTT.fx
    • Create a profile to match the broker you already set up
    • Connect
    • Subscribe to the topic from config.lua e. g. "/house/masterbedroom/#" wihtout the quotes. If you don't have anything else on your broker bus you can subscribe to everything (e. g. "#")
    • You should see heartbeat messages sent out from the device every two minutes
    • To control the device, publish to the topic matching config.lua "/house/masterbedroom/rollerblind/0/set"

    Of course, this setup is obviously not terribly useful for daily operation but it will help you weed out any potential problems. If you just want to control mqtt devices you can download a MQTT cotrol dashboard on you phone. If you want to use other general home automation software I think you should find that most support MQTT integration.

    Step 11: Integration With Openhab (optional)

    I will give you an example of integration with the home automation solution I am using. If you have a pre-installed openhab home automation solution or would like to set one up (there are guides on their home page), this is what you should do to integrate the roller blind.

    1. Install and configure the openhab according to their instructions
    2. Install MQTT binding
    3. Configure MQTT binding for your previously configured broker (local or cloud)
    4. Add the roller blind to your items and sitemap file. See example below.


    Dimmer masterbedr_blind1 "Rullgardin 1" <rollershutter> { mqtt=">[ohab:/house/masterbedroom/rollerblind/0/set:command:*:${command}],<[ohab:/house/masterbedroom/rollerblind/0/status:state:default]" } 


    Slider item=masterbedr_blind1
    Microcontroller Contest 2017

    Runner Up in the
    Microcontroller Contest 2017

    6 People Made This Project!


    • Furniture Contest 2018

      Furniture Contest 2018
    • Tiny Home Contest

      Tiny Home Contest
    • Fix It! Contest

      Fix It! Contest

    97 Discussions


    8 months ago

    I have an issue, when the blind goes down, the lights on my stepper driver stay lit. I do not think the power to the coils is being turned off.

    When the blind goes up, the lights turn off at the end and the power to the coils stop.

    Why would the power to the coils stay on when the blind goes down? I have looked at the code and cannot see any reason why.

    In the morning when the motor should open the blind it fails due to being really hot.

    1 reply

    Reply 8 months ago

    In the original code I left one pin active when the blind is down. The reason was that I was having problems with gravity pulling the blind down further than I wanted if there was no power. In retrospect, keeping it powered was not the best solution. I belive I changed the code in the repo a while back so that it turns all pins off but I'm not sure. There are (at least) two much better ways to fix the gravity problem. 1) cut the blind (at the top) so that when it is down it is all the way out. 2) modify and use the original spring to counteract gravity. This was suggested by another reader. Remove the spring lock and put the spring on the opposite side from the motor.


    Question 2 days ago on Introduction

    The requirements list mentions manual push button operation, but as far as I can tell, the micro switch is the only button operation in this system and it's only for calibrating top and bottom positions of the blind.

    Could this be modified with a mom toggle switch for manual control of the blind position and then have the code feedback its state over mqtt, so that my HASS setup always knows the position of the blind?


    Question 7 months ago on Step 5

    Hi! first of all thanks for share this great work, has been very usefull to me :)

    I have test your code and I'm wondering how could I change the rotation speed of the stepper. I have changed the value on stepper.lua, line 27, to several other values (from 5 to 20) but I haven't noticed any change, just that the stepper doesn't move at all when i move to very high or very low values ( I think thats this is because of at high speeds the torque is so low that can't even move the axis).

    Is there any way to increase the rotation speed? is the problem is the stepper, do you know if with a bigger one (NEMA17, for example) could I get a faster rotation speed?

    Thanks in advance!

    3 more answers

    Answer 6 months ago

    Hi, thanks for your reply! Finally I have made it work with the nema 17, I'm waiting for the shield and a voltaje regulator to assemble it :)


    Reply 10 days ago

    Hello, is the Nema 17 working fine? Could you share how you got the Nema 17 to work with the build? Thanks


    Answer 6 months ago

    I don't think you can get this tiny stepper to go any faster. I have tried but if you crank it up it will start to stutter. The reason it is at all able to operate the blinds is that is is geared. As for other motors, yes, a nema 17 motor would be capable of operating your blinds at very high speeds. It is a bit bulky though!


    1 year ago

    The magic smoke escaped during the night, And charred my wall :(

    Clearly it is not safe to run the nodemcu clone at 9V over time, a small capacitor failed short and my 9V 4A power supply melted the tracks right off the board!

    I have ordered some buck converters so I can run the motor with 12V and the nodemcu at 5V, and will redesign the 3d printed enclosure to add some safety, I don't want these things to start a fire.

    2 replies

    Reply 5 weeks ago

    Thanks for the post. What type of buck converter did you get? Cheers in advance


    Question 7 weeks ago on Introduction

    I am confused.. I tried to get it to work using this guide.. But I had several errors..

    It seems like ssven has made something to fix this. But is there a complete guide to follow? I just keep finding bits and pieces :(


    Question 8 weeks ago on Step 7

    Do you have any instructions for hooking up an external power supply on the motor shield? My blinds are quite long and so the motor seems to have not enough power to get the blind back up.



    Question 5 months ago

    New to Lua...immediately upon Saving the init.lua file to ESP8266 (using ESPlorer on Win 7) I get an error and red light. lua: init.lua:13: attempt to call field 'exists' (a nil value). I looked at line 13 in the code and it refers to a file called; "cfg_tot_steps.lua". I cannot find that file anywhere in the Git. What am I missing?

    1 more answer

    Answer 2 months ago

    Same here. Did you manage to find the problem?


    Question 2 months ago on Step 11

    Hey Guys, i really need help to connect this setup to my FHEM-MQTT...
    Sadly, im not that into coding... Somebody got an idea?
    would be really helpful!

    Thank you!


    2 months ago

    just got all the parts from the BOM, but the get errors like these when i upload the config

    NodeMCU custom build by


    commit: f03a8e45261fb5ab260e316173baacae9a248a62

    SSL: true

    modules: file,gpio,mqtt,net,node,pwm,tmr,wifi,tls

    build created on 2018-06-30 00:09

    powered by Lua 5.1.4 on SDK

    Configuring Wifi ...

    lua: wifi_setup.lua:31: bad argument #1 to 'config' (ssid required)

    stack traceback:

    [C]: in function 'config'

    wifi_setup.lua:31: in function 'start'

    init.lua:28: in main chunk

    [C]: ?

    reading through some comments here, is the project dead and does no longer works with just the parts listed here?

    found ssvens bitbucket repo and uploaded his files.

    everything now works (wifi and mqtt connection) except the motors wont spin at all :/

    edit2: got it working


    5 months ago

    I did have a lot of modifications but the biggest problem is the connection to shield. Do you know that there is a sot-26 I.C. next to the L293DD at least on my motor shield which I believe is the same than yours. The inverter I.C. changes the behavior of the L293. So D1 is connected to ENABLE1, D2 is connected to ENABLE2, D3 is connected to IN1 and inverted to IN2 and finally D4 is connected to D3 and inverted to IN4. I did figure it out When I connect my scope on the signal. Now I change your stepper.lua and I did have to swap two coils wire. Now I do have more torque and it is working way better. All the documentation I found point to the same thing

    3 replies

    Reply 5 months ago

    Ok I clone your code and made the modification to fix for my esp-12-e motor shield. I also fix some bugs like the missing module.step_ms in config.lua . the state==2 or 0 which force the system not to operate if your not fully close or open. Lua has a big problem with the speed of the stepper. I don't want my blind to take 15 mins to go down so I made a 'C' version. N.B. The wiring is different and check the .ino file to find the correct stepper wire color. B.T.W. the original source code has no licenses so I put M.I.T. on mine


    Reply 4 months ago

    Ok so this seems to be the latest iteration of versions... should have read all the comments before ordering the parts I guess...

    Using your code @DanielP do I still need to remove the resistors and solder the wires as I saw somewhere else here?`Wish someone would write a updated guide (wink wink... :D )


    Reply 4 months ago

    No! I modified the code for the motor shield using PWM and DIRECTION.

    The shield is used directly but you need to change the wiring since A+/A- is one coil pair and the B+/B- is the other pair.

    The color is in the code.

    Also I included an ESP8266 and an UNO version with C. This version could be modified to include a percent holding if your blind moves when power is off.