DIY SmartBlinds v1 – How to

Vertical or Horizontal Blinds Automation Project

Important Disclosure

Although I have successfully printed this design over and over with 100% success rate using the 3DFillies White PLA+ on my Prusa i3 MK3 printer and the stock PEI spring steel print bed, that doesn’t mean that this will work the same on your printer.

I am providing you all the design files, code and know-how in good faith and I will not be liable for any damages that may be caused directly or indirectly while making, or using this device.

By downloading any files and using any of the information posted on this site you agree to the above.

Now for the fun stuff … this project started with a need to close my blinds on a west facing window in the afternoon, while I was away. Especially in summer, the sun in Australia can do devastating things to the objects that it shines onto directly. Plus, it drastically increased the temperature in the room. As with any design project, it goes through various stages of prototyping. Bellow is a snapshot of my design process. The early working prototype had a light sensor built in to control the blinds based on the intensity of sunlight falling on the window. That turned out to be impractical and unnecessary.

I already have a home automation setup that integrates Apple’s HomeKit and Homebridge for DIY and other device integrations. However, for this device I designed an API that can be used by other home automation solutions.

I will start describing the project with what the final device looks like.

The Finished Product

The dimensions are approximately 64mm deep, 47mm wide and 92mm tall. The cog wheel was designed to pull a ball chain with 5mm diameter balls. The device connects to your home WiFi and the web based configuration allows you to customise the start and stop or open and close position of your blinds. The device attaches to the wall by double sided tape.

Vertical Blinds Automation Motor

Short video of the making of …

DYI Automated Vertical Blinds

Components and Skill set

You will require the following components and skills to build this project:

Skills

  • Arduino IDE and basic knowledge uploading code to a compatible board
  • Basic soldering skills
  • 3D Printing and slicing an STL file
  • General assembly skills

Components

  • 1x Node MCU CP2102 ESP8266
  • 1x Stepper motor 28BYJ-48 5v with ULN2003 driver
  • 18x M2.5 x8mm Countersunk screw and 2x nuts
  • 2x M4 Steel Hex Head Cup Point Grub screw
  • 1x 5.5mm x 2.1mm DC power plug
  • 1x 5v Power Supply with a 2.1mm DC plug
  • STL Files for the body, cog wheel, top and bottom covers and the wall mount. These are attached to this post.
  • Arduino Sketch for the Node MDU, also attached to this post.

The respective images for the above components are displayed below.

The screws I used were all 8mm long. The screw holes in the body of the device should go right through so if the screw is a little longer than it should not matter.

I used countersunk heads for all the external mounts and button or any cap screw to mount the NodeMCU and the Motor driver. I also experimented with self threading mini screws – they also work well for all the mounting points that screw into the plastic. The motor mount will however require a nut on the other end to hold it in place.

3D Printing

The Base

I have designed the base such that it can be printed, upright and without supports but that probably requires some level of 3D printing experience. All the internal overhangs have a 45deg support so most 3D printers should be able to handle this without supports. The L shaped part will be bridged by the printer, again post printers should be able to handle bridging this small gap. If you want to get the hanger holes perfect, you could add supports there.

The Top and Bottom Lids

The top and bottom lids should be printed on their flat surfaces and without supports.

The Cog

The cog is the only component that I would print with supports. That is because of the dimples on the inside. Also you should print it on its largest flat surface. 

Assembly

Here is the schematic of the connections. The ULN2003 I listed in the above parts list will only have 4 connection points to the NodeMCU and two for power and ground. Ignore the 3 red connection point in the diagrams lower left. One thing I noticed, the order of the pins of the ULN2003 board to NodeNCU sometimes differs from board to board. Hook it up the way you see it then reverse the connection if it is not working for you i.e D1 -> 1st (top most), D5 -> 2nd etc

Here are a few images of how to solder the wires between the motor controller and the MCU. These may give more clarity than the schematic above. The thickness of the wires used is approx. 24AWG.

Here is an image of the assembly of the the electronics. The stepper motor driver fits on the inside of the vertical mount wall near the DC plug. The nodeMCU fits on the other side. Keep your wires short as there is not much room once you put the body on. Also ignore the bundle of wires sticking out at the top – that’s from a version which included a light sensor – I gave that up as it was impractical. The mounting location of my AutoBlinds device was always in the shade and no access to sunlight.

Assembly of the boards

Software and API

Once the device is connected to your WiFi network, you can access the web interface through http://your-device-ip/ to get to the home page that displays the current status of your device.

http://your-device-ip/api/help – will display the help information and the api options.

You can use the icons on the bottom of the home page to navigate the web interface. From the web interface you can setup that END position of your blinds.

To configure your device, close your blinds manually, wrap the chain around the cog and mount the device on the wall with light tension o the chain. Then from the web interface, select the GEAR icon and open the blinds electronically until you reach the desired state. Then click SAVE. Thats it. now you can open, close or partially open or close your blinds buy seating the following api command:

http://your-device-id/api/blinds?open=20 {to open the blinds 20%}

Bellow are some example screen shots from the wed GUI 

WP 3D Thingviewer Lite need Javascript to work.
Please activate and reload the page.

Files Download

The Code

Here is the list of all currently available code for the project. The main part is the Arduino Sketch. You will need this to program the NodeMCU.

If you would like to try to integrate the DIY Smart Blinds withe either Apple Homekit (Homebridge required) or Amazon Alexa through the Samsung Smart Things, I am providing my experimental code. Use at your own risk.

DescriptionLink
Arduino SketchGitHub link
Homebridge plugin / Homekit GitHub link
Samsung Smart Things – device handlerGitHub link

Some additional info also posted on Thingiverse

NOTE: This post is a work in progress and additional content details and material is still being added.

You may also like...

63 Comments

  1. Very good design, the shape is very cute.
    I have a question, does the 28BYJ-48 motor have enough torque to pull the curtains?
    In addition, can you write a more detailed description of the code.? I’m also trying to make an automatic blinds and buy several stepper motors. However, due to just contact stepper motor, so the operation of stepper motor do not understand.

    1. Hi, the motor has enough torque to tilt the blinds. I don’t think it would be able to slide them to one side. I found that the slower the motor moves, the more torque it has, to a point. Please take look at my code, I have added comments for each section.

  2. Any chance you could post a pic of the wiring? Cheers!

    1. Done. I updated the post with a schematic. Apologies for the crudity. If anything is unclear let me know.

  3. Hi, Great project! I am trying to control this from my home automation server running. Not sure how to send the commands from Domoticz tho, any ideas? Is it possible to connect via mqtt?

    1. Hi and thank you. I think for Domoticz you would need to write a plugin or utilise an existing one that can interact with this device via api. Please take a look at my plugin i made for Homebridge. Perhaps this will inspire a solution? https://github.com/crashtestoz/homebridge-http-window-blinds

    2. I did a similar project for domoticz based on mqtt
      https://github.com/Warsenius/Domoticz-Mqtt-roller-vertical-blind
      my code is terrible though and my steppers seem to drift because they are not geared like the one used in this project. maybe take a look at the hook up code:
      https://www.youtube.com/watch?v=1O_1gUFumQM

  4. The code is excellent for Arduino Uno, but I want to use Attiny 85, I’m a beginner arduino. Maybe someone will help me will be very grateful. Thanks in advance.

  5. Hi, Nice project. I’m a beginner arduino. When i upload the Javascript i got the message PIN1 was not declared in this script, can u help me? Thanks in advance.

    1. Could you tell me which Javascript you are referring to?

  6. Coen Witteveen says:

    Hello, thanks for this fun project. I made it entirely for my horizontal blinds. However, I have to increase the number of revolutions (Open LIMIT is set to 🙂 to around 9000. When I go above 6900, the motor does not continue. Can you tell me what I need to change in the script to get this right?
    Thanks in advance!

    1. That’s an interesting question as I didn’t program any limits on what your MAX OPEN value is. Below is the structure that holds the MAX Open state, its called “MAXstate”

      struct EEPROMStruct {
      int MAXstate;
      int NOWstate;
      int OPENstate;
      int LUXstate;
      } eepromVar;

      I will troubleshoot with my blinds and post back. All my limits for my vertical blinds are set to around 4500.

    2. Coen Witteveen says:

      thank you for your answer, i have solved it. I have asked you another question under the name Coen Witteveen.

    3. Could you share your solution?

  7. In one video you used it with AppleHomeKit, how exactly do I have to set it up to use it with apple smarthome?

    1. Hi Simon,

      To get this device to work with Apple HomeKit, you will need to setup homebridge. Here is the link from which you will find all the info on how to set it up https://github.com/nfarina/homebridge. Homebridge is a device/application that allows you to connect many third-party devices to HomeKit, that don’t have certification. Once you have homebridge setup and working then install my HTTP-Window-Blinds plugin for homebridge (https://github.com/crashtestoz/homebridge-http-window-blinds) and configure. That’s it. Your device will be visible in HomeKit.

    2. Coen Witteveen says:

      My answer for another site was mistakenly posted here:
      “Coen Witteveen
      May 25, 2019 at 7:35 am
      thanks for your answer, i solved it. I have asked you another question under the name Coen Witteveen “.
      Unfortunately I have not solved the problem yet. Sorry for the confusion.

  8. Where do I see my Device IP ?

    1. You will need to login to your Router and see all attached WiFi devices. The one for the nodeMCU should start with esp…..

  9. Coen Witteveen says:

    Hello Peter, I think something went wrong in my answers: the question from mister cw has been resolved, but the question from Coen Witteveen has not yet been about the number of revolutions. Thanks, sorry for the confusion. For me, could you look at the script why the engine suddenly stops at 7000 revolutions? Thanks!

    1. Hi Coen, I spent some time testing the rotation limits and could not find a fault. I set by test device to 9000 and ran it back and forth without problems. When setting it to 9000 however, I increased the set amount by values less than 4000. I think when setting up the limits, if you try to sett it to 7000 or more the web site might timeout as it waits for the nodeMCU to finish.

      Other than that, are you using the same 5v motor as in the description? Is the motor hot when running? Have you got the motor phases hooked up correctly such that its not skipping a phase? Sorry just brain storming here.

  10. anyone hook this up to google home / assistant?

    1. If you find someone that has a compatible service “Service” for the device, let me know and I will link it here.

  11. how are you mounting the mounting plate to the wall?

    1. Hi, I used double sided 3M tape to mount the wall plate. It holds very well. For a more secure or permanent solution I would suggest two screws in the wall and not to use the wall plate.

      The wall plate is there for temporary mounting and easy troubleshooting.

  12. Very good idea.
    Few my ideas.
    1. Add support for steeper motor or second project for nema 17 motor.
    2. Add mqtt support
    3. Add additional 3d printed planetary gearbox, because this motor is weak 🙁

    1. I would need help with mqtt. As to the power of these little steppers, when you run them at low speed they have quite a bit of torque. The are capable to force close my vertical binds even if one blind is stuck.

  13. i have a weird problem where no matter if use a positive or negative number, the motor only spins in 1 direction.

    1. Sounds like a wiring issue. Check the connection especially the order in which you wired the MCU to the motor controller. I have found differences between two seemingly identical controllers.

  14. Hello, I’m having a problem getting the file on the NodeMCU via arduino with usb. I did not manage to pack the file on it. I can see it in my WLAN and I can also connect to the WLAN, but after the connection he does not find my IP in a browser. Definitely because I do not have the file on the MCU, he does not find my IP in the browser. Can you please tell me step by step, which file I should download exactly and how I get the file on arduino on my MCU? And my second question is: what is the hole on the lower side? For electricity? Power gets my MCU but over the USB. What do I need the hole for? Unfortunately, I can not upload any pictures here in the comments.

    1. Hi, Please take look at this step by step crash course on the nodeMCU and Arduino IDE https://www.instructables.com/id/Quick-Start-to-Nodemcu-ESP8266-on-Arduino-IDE/

      If you upload the script successfully, then after powering on the nodeMCU it should go into server mode and allow you to connect to its WiFi network to configure. If the configuration is successful then the nodeMCU automatically connects to your WiFi network. You should be able to locate its IP from your routers DHCP connections. If its not there, then its not connecting. Please refer to the documentation of the WiFi library used, here: https://github.com/tzapu/WiFiManager

      Keep in mind in orderer to compile and load the script onto the nodeMCU, you first need to configure your Arduino IDE and download the relevant libraries that the script uses. The Libraries are listed as includes at the top of the script.

      The hole on the bottom is for the DC power. I do not recommend powering the whole device through the 5v on the nodeMCU because the current tolerances on the input are very low and the motor can pull much higher current. In short, you can blow the nodeMCU. Hence the seperate power input. For debugging I have left the USB hole as well – that way you do not have to pull the device apart if you need to re-upload the script.

      Hope this helps.

  15. Thanks for the answer, unfortunately I can not continue. It annoys me a lot. Since I printed the 3D model so well and have already connected all the electronics together. I would like to post a photo of it, but unfortunately this is not possible. For programming: in advance: I have Arduino installed and also have the file “eBlinds_WiFi_v3.1.ino” on my Mac. So, in their first link is a crash course. In this I have come to the point “Navigate to esp8266 community and install the software for Arduino.” done. But from here I can not continue. I open the file “eBlinds_WiFi_v3.1.ino” and click on “Upload”. But I get an error message: Exit Status 1, stray “/” in program. If you have an email address, I could also send you a picture of my wiring. Of course, if you have time for me 🙂
    For Info: If I have NodeMCU via USB s.Mac and I click on Arduino on “Get Board Information”, I get the message: “native serial port, can not retrieve information”.

    1. What I found is that some versions of the libraries I used in this sketch work better than others. Here are the versions I used for my project:
      ArduinoJson 5.13.2
      WiFiManager 0.14.0
      Stepper 1.1.2
      ESP_EEPROM 2.0.0
      WiFi 1.2.7

  16. […] on the popularity of the DIY SmartBlinds v1 device found here, I attempted to update the design and make it a bit slimmer, easier to print and easier to […]

  17. Hi,

    to be honest I not yet read all this page but saw on instructables this is what I was looking to open my ikea blinds.
    But I am also looking two thinks :
    1) how to power it only with a solar power bank used behind the window : I know it depends on each user location but I suppose you could tell us how mAh must be the solar power bank to be able to use it twice a day (morning and evening to open and close the blinds).
    2) it must be activated (by percents : in open or close mode) with MQTT

    Sincerely thank you to update the instructables page by mentionning those two needs.

    Have a nice day.

    1. Hi, thank you for your questions. 1) with DIY solutions you are using off the shelf components that are not always purpose built and as a result not very power efficient as in this project. You could probably attempt to tweet the code to make the circuit more power efficient but it would still probably not be viable to power with solar. From memory the circuit in standby uses about 200mA and when powered/Turing blinds it goes to 600mA. This will very much deep my on your environment. 2) the current code assumes that the blinds are closed or opened by a % amount so that should work with your application. Regards.

  18. Hi there!
    Great project, especially with the homebridge plugin!
    Sadly I’m having difficulties with the stepper motor basically buzzing, possibly turning ever so sightly, I also have one LED on the uln2003 permanently illuminated – whichever is connected to D5 o the NodeMCU.

    Ive tried all number o ways connecting the jumper leads, with no improvement, do you have any suggestions?

    1. Hi Nathan, in my experience with the cheap ULN2003 boards the most common issue is the inconsistency in the way they are wired. Although I outline how to connect the Motor driver to the NodeMCU, it may take some experimenting.
      I would suggest start simple. Download a simple stepper motor sketch for arduino and just try to connect one phase at a time. Have your sketch running a loop setting only on pin high so that you can match it in order on the ULN2003 driver.
      This should let you thromboembolism shoot the connection if the driver is not faulty. Regards.

  19. Jose Luis Malaquias says:

    Hi, I think this question has been asked on the instructables site, but I still can’t discover the cog stl in the provided archives.

    1. The new COG is now included the DIY SmartBlands V1.1.

  20. tanase Catalin says:

    Hi is there any chance that we can use Nema17 and A4988 Driver or this project?
    i use homebridge and raspberry PI

  21. Has anyone else had problems with the open and closed positions going out of calibration? It seems to be roughly 1/8th of a turn one way each time the blinds are opened and closed.

    1. Not on this end. My vertical blinds have been flawlessly tilting for over a year. I would suggest to take a look at your wires and their order on the motor driver. Those cheap ULN2003 boards sometimes have their order messed up.

  22. Hi Peter

    Amazing project! but I agree with all the other requests about Nema17 and A4988 Driver. can you please add support?

    1. I will take a look at the Nema17 stepper, perhaps the one that is slimmer 42x42x20. I can see that the A4988 driver module can be powered by 5v and it outputs upto 15vdc. So the DIY SmartBlinds can still be powered by usb?

  23. Hi Peter, Look at the Wemos D1 as it can handle 12v. The nema 17 stepper work on 12v-24v. You will be a Hero when nema17 works!

    https://docs.zerynth.com/latest/official/board.zerynth.wemos_d1_mini/docs/index.html

    1. Hi Jakes, Wemos D1 is a nice board, its power is not the issue. The issue is in the motor controller and the stepper itself. I found a controller that can control the Nema 17 at min 2.5v its based on the DRV8835 chip but its pricey. Put that together with a 5v Nema17 motor 43x43x20 and NodeMCU or the Wemos D1 and that should work. Not sure how much more powerful it would be than just using a 12v 28ByJ-48 Stepper and UN2003 controller as in the DIY SmartBlinds v1.1?

  24. Have a look at this or something similar. https://www.pololu.com/product/1182

    1. Yes that is probably the cheapest option but will require a 12v power supply for the Neam17 stepper and to power the electronics. This is not a deal breaker just means that the power connector will most likely be 5.5×2.1mm DC Plug which is bulky.

  25. […] project aims to upgrade the popular DIY Smart Blinds v1.1 with a Nema stepper motor in order to increase the torque for moving roller blinds. My biggest […]

    1. Great work! cannot wait.

  26. Hi, very nice project, so I have a problem. When I do upload to the board, I have the error (PIN1 was not declared in this script) in Arduino IDE. What I’m doing wrong? Thanks!

  27. Hi, nice project. so I hame a problem when I upload to the board via Arduino IDE. PIN1 was not declared in this script. what I’m doing wrong? Thanks!

    1. Hi Max, its hard to say. Which script did you use? Are you using the NodeMCU board?

  28. Hi, I used code for Alexa, I installed all library with the version, and I using a NodeMcu.

  29. hi, I got upload the code, the board was wrong. so now how its work with alea?

    1. Hi Max, to integrate DIY SmartBlinds with Alexa, you need to to use the code on the BLOG page and create a Smart Things device handler. Once you create the DH then you create your Device and configure for your IP. You will need a SmartThings Developer account https://smartthings.developer.samsung.com/. There are many forums on SmartThings Device Handlers that should get you started.

  30. Hi Peter, I love this project, its exactly what I was looking for! I am having an issue though where the motor only turns one way. I saw someone else commented this about and I have tried every wiring configuration and none of them seem to solve the problem. Any ideas? Thanks again for the awesome project!

    1. Hi Cole, the order of wiring on the ULN2003 motor driver would have been my first choice to check. Have you tried downloading the simplest sketch and just try to spin the motor CW and CCW? This could help to troubleshoot the issue. I would suggest however to upgrade to the v3 of this project. It uses much stronger motor DIY SmartBlinds v3

  31. Completely a newbie here and just a silly question, I am in the middle of coding the board, have got all the library ready and managed to connect board to my phone or connect my phone with the board wifi.But cant get into the http://your-device-ip/.

    Wondering what I have done wrong here, I connect my phone to the board wifi and configure the ssid and password so it can auto connect to my wifi, then use my phone to create a hostspot and connect my board into that wifi, but still cant get into the web interface. ( It shows that the board has connected to my phone wifi)

    Btw, look forward to your V3 nemo 17 design 🙂

    1. Hi Jayden,
      Unless I misunderstood your question, http://your-device-ip/ means you need to replace the text “your-device-ip” with the actual IP of your device once it connects to your WiFi network. Once you connect your board to your Wifi, you will be able to browse to the web server hosted on the board via the IP address – assuming you are using the code form the post.

  32. Hi Peter, thanks for you blog. I have a problem with your code. I have horizontal blinds, wemos d1 mini, ULN2003 driver and Stepper motor 28BYJ-48 12v. I figured it needs 64100 open limit or 100% blinds, but then your website is unresponsive what can i change in the code to correct it? can I change some multiplier or something else? need to change something for horizontal blinds?

    1. Hi Jack, 64100 is a very high number. I think the problem in your case is, that this is the upper limit of an int variable in the code. Perhaps changing the int to a long. The upper limit of a long variable is 2,147,483,647. Let me know how you go and I will update the master code.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.