top of page

Mini-Project - Motorized Window Curtains




This project was partially an excuse for me to learn how to control stepper motors with Arduino, and partially so that my room wouldn't be as dark in the morning when it's time to get up.  

Parts list

Parts List
Amazon link for the main parts
  • ESP8266 NodeMCU

  • Nema 17 stepper motor

  • TB6600 stepper motor driver (way overkill)

  • GT2 Timing belt and pulleys

  • Limit switches

  • DHT11 Temperature+Humidity sensor

  • 3D Printed stepper motor mounting bracket

  • Soldering iron

  • Hot glue gun

  • Wire cutters/strippers

  • Dremel

  • Screwdriver and drill



I mounted everything on wood blocks so I could easily drill holes anywhere for mounting to the wall.  I eventually decided on screwing a piece of wood into a stud in the wall with a bolt in it facing away from the wall, and then putting a nut onto the bolt from the front side.  This allows me to take the whole thing off the wall without unscrewing the screw from the stud.

The ESP8266 is mounted on a breadboard which also has the DHT11 temperature sensor.  There are 3 outputs from the ESP to the motor driver for Pulse+ (PUL+), Enable (ENA+), and Direction (DIR+) and the negative pins of each on the driver are grounded.  The motor driver and ESP are both powered by a 12V power supply.  

The limit switches have have a pull-down resistor on the breadboard.  I initially ran the wiring for the far limit switch on the underside of the curtain rod but my carriage was getting caught on it so I ran it along the wall instead.  




This project was more difficult than I expected at every turn.  Here are a few of my struggles and how I fixed them

Pulley rod never arrived

I ordered a rod that would fit perfectly inside the pulley, but the package from china arrived with a hole in it and no rods in it.  I think they got sucked out by a magnet or something (I had a magnet in the package as well).  I found that the pulley fit on the end of one of the screws I had, so I just moved on with the screw as my pulley rod instead.  

Conflicting wiring diagrams for 4-wire stepper motor and driver

There are a variety of wiring diagrams online for using a stepper motor with a driver with Arduino.  I thought it was weird to wire the negative pins (PUL-, DIR-, ENA-) all to ground and only use the positive pins.  Eventually I just tried it and it worked and I moved on - I guess it doesn't matter much.  

Need custom and unknown tension belt length

You can buy tension belts in certain sizes and lengths, but I wasn't sure what I would need so I just bought 10 feet of unconnected belt.  In order to make this into a continuous belt I sewed it together with overlap and used superglue for added strength.  

Project appears to be tethered to the computer

For a solid 2 days I found that the controller would connect to my wifi immediately if it was connected to my computer (like right after upload) but wouldn't boot at all if I didn't have the micro USB cable plugged in.  Eventually I discovered that on the NodeMCU ESP8266 there are actually a lot of restrictions on the GPIO pins, and one of the pins I was using was used during boot to trigger flash mode and would stop your program from running if it was pulled low on boot.  The fix was to not use the D3 pin.  Read more here:  Link

Alexa app refused to add this device to a routine

For some reason the Amazon Alexa app wouldn't add my device "Window Curtains" to a routine.   I did some googling and found it's a common problem with ESP8266+Wemo emulator library with no consistent fix.  I eventually found a workaround though - Groups.  First I added two devices (my window curtains and a light )to a group.  You need two devices in a group for the Routine menu to recognize it as a group.  Then I made the routine so that "Alexa, open the curtains" would turn on my group "Window Curtains".  Finally, I removed the second item (light) from the window curtain group.  This solution was definitely easier than using IFTTT and a webhook to achieve the same thing.

Blynk App Interface for ESP8266 project
bottom of page