A Solar Tracking Automatic Motorized Window Blind Retrofit Using Arduino




Introduction: A Solar Tracking Automatic Motorized Window Blind Retrofit Using Arduino

Buildings account for 20-40% of total energy use in developed countries. Window shades (or blinds) can help to reduce building energy use and improve visual comfort (i.e., reducing glare and increasing daylighting). A recent study showed that occupants are fairly inactive when operating manual roller shades (O’Brien et al. 2013) which could lead to increased visual discomfort and increased heating and cooling energy use. With aspirations to address issues associated with human inactivity I created an automatic motorized roller shade.

The motor moves the shade position depending on the of the location of the sun and the illuminance (i.e., amount of light) hitting a workplane (e.g., your office desk or kitchen table).

One of the best parts of this instructable is that you do not need to purchase a brand new roller shade to make this work. I will demonstrate how to retrofit an existing manual roller shade into an automatic motorized one using Arduino. The project used Arduino with the Adafruit motor shield to control the interaction between a stepper motor and a digital luminosity sensor.

This Instructable is structured:

  1. Introduction: What is 'good' shade position?
  2. Required supplies
  3. Assembly
  4. Code explanation
  5. Summary

Step 1: What Is 'good' Shade Position?

As the sun moves across the sky during the day, where should the shade be positioned? What if it is a very sunny day and there is too much light entering a space causing glare? What if it is an overcast day? This step tries to answer these questions by asking: What is 'good' shade position?

In general, we want the shade position to let in as much light as possible without cause any visual discomfort (i.e., maximize daylighting and minimize glare).

The picture above was taken sitting down at my office desk. It was an example of 'good' shade position because the shade was positioned so it was blocking direct sunlight yet was still allowing maximum diffuse sunlight to enter into my workspace.

Sunlight can be broken into essentially two components: direct and diffuse. The direct component comes straight from the sun whereas the diffuse component is created when a portion of direct sunlight scatters due to molecules in the atmosphere.

This project aims to control shade position to always block direct sunlight when present and maximize the diffuse component entering the workspace.

Step 2: List of Supplies

Arduino Hardware:

  1. Arduino Uno (http://www.arduino.cc/)
  2. Adafruit motor shield (http://www.adafruit.com/products/1438) $19.95
    1. Headers (http://www.adafruit.com/products/85) $1.95
  3. Digital Luminosity Sensor (http://www.adafruit.com/products/439) $5.95

Stepper Motor:

  1. Stepper motor with planetary gear box $33.95 (http://www.omc-stepperonline.com/nema-17-stepper-m...)
  2. Power supply - 12V (May be required if motor cannot produce enough torque through a USB port)

Some notes on the stepper motor. You do not need to use this stepper motor and it may be possible to find a cheaper one. But you must consider torque and speed. This stepper motor easily produced enough torque to raise and lower the shade. It moved at a slow, yet smooth (stepping angle of 0.067°), speed because it had a gearbox. You can control the speed of the stepper motor via the code provided but up to a certain point; however, this could create discontinuous motion which could potentially cause the ball chain to skip some gears. High torque and low speed motors work well for this project.

3D printed gear:

  1. 3D printed gear via Shapeways.com ~$15-30 (Discussed in step 2)
  2. Elastic Band (The thick ones found when buying broccoli work great)

Lets discuss the design of the ball chain gear. I searched online to see if I could just the gear that comes with a generic roller shade but I could not find one anywhere. It seems to get one you must buy an entire roller shade.

Luckily John Abella created a parametric CAD file of a ball chain gear. The file should be opened with OpenSCAD software.

Parametric 3D ball chain gear CAD file by John Abella: http://www.thingiverse.com/thing:12403/#files

OpenSCAD software: http://www.thingiverse.com/thing:12403/#files

The parametric file requires the following inputs that you should measure with digital callipers in mm:

  • Motor shaft diameter
  • Ball diameter
  • Ball count (This is one of the inputs to determine gear radius)
  • Ball spacing
  • Link diameter

John Abella has also added code so that different shaft options can be used. The code outputs total height and diameter. Shapeways has limits to the size of the printed piece. I used shaft type #3 to match the stepper motor shaft. I designed the flat spot diameter so that force fit was required to fit the gear onto the shaft. It was difficult to fit the ball chain to the gear correctly even with precise measurements using a calliper. I suggest making the gear diameter large so that you maximize the number of grooves in contact with the ball chain.

Attaching a rubber band around the gear increased friction between the ball chain and gear. This should help reduce slippage. Once you are happy with the design 'compile and render' the file to type .stl and upload it to shapeways.com or use your own 3D printer for manufacturing. I used the default white nylon material - Strong & Flexible.

Tools for assembly:

  1. Soldering iron (To assemble Adafruit motor shield)
  2. Clamps (I used quick release clamps)
  3. Spare wood/platform
  4. Wires for prototyping
  5. Electronic breadboard
  6. Ruler
  7. Digital Calipers

Step 3: Assembly


First assemble the Arduino Motor Shield following the steps in this tutorial: http://learn.adafruit.com/adafruit-motor-shield-v2... Don't forget to download the Adafruit motor shield code

The wiring schematic and wire colour placement in the above two figures should serve as a reference point to connect your motor.

Digital Luminosity Sensor

The wiring diagrams and code can be found here:


Download both Adafruit libraries: Adafruit_TSL2561 V2 and Adafruit_Sensor

Other software: Arduino Time Library

Download here: http://playground.arduino.cc/Code/time

Bringing it all together

The pictures show the fully connected motor and luminosity sensor.

Step 4: Code Explanation

The control strategy used a very similar strategy to Tzempelikos et al. (2013; SC-III) where the shade height was controlled based on the calculated position of the sun and the measured workplane illuminance. Their algorithm was based on open loop procedures which moved shade height to the position where it just blocks direct sunlight from falling on the workplane. The code in this project adopted their open loop aspects and added closed loop control during certain conditions.

The position of the sun is known in terms of its solar altitude (α) and solar surface azimuth (γ). The solar altitude is the angle between the horizon and the sun. The solar surface azimuth is the angle between the outward normal of a surface (e.g., vertical window) and the sun.

My code calculated α and γ based on your location:

  • Latitude
  • Longitude
  • Altitude
  • Angle from south to your outward normal of your vertical surface (surface azimuth)

The code operates during three periods of conditions depending on these angles:

  1. The sun is incident on the window surface: α > 0° & |γ| < 90°

If the sun is incident on the window surface the first mode of operation is to follow open-loop control to position the shade height calculated using α and γ. If the day has high sky illuminance the workplane illuminance may be greater greater than 2000 lx (lumens/area) when following open loop control. If the workplane illuminance exceeds 2000 lx the roller shade position will enter into closed loop control and overshoot mode will be initiated. This will first cause the shade to lower 2 cm until the workplane illuminance is less than 2000 lx. If the day is overcast, during this scenario, and the workplane illuminance is less than 250 lx and the time is after 9 am the shades will enter into overshoot mode. First the shade will move up 2 cm until the shade height overshoots 2000 lx, then will lower 2 cm so the workplane illuminance is below 200 lx. This is a primitive way to estimate if the day is overcast. Model predictive control could create a smarter control strategy in the future. Once overshoot is triggered the shade will be in closed loop mode for the rest of the day.

2. The sun is not incident on the window surface: α > 0° & γ > 90°

In this mode the sun is not incident on the window surface so all the light entering the space is diffuse horizontal and ground reflected. The occupants are no longer concerned with blocking direct sunlight and the daylight entering the space should be maximized without causing visual discomfort. The control algorithm adjusts the shade height up or down so that the light level entering the space is always less than 2000 lx.

3. The sun is below the horizontal α < 0°

In this scenario the sun has gone below the horizontal. The blind will fully close for two main reasons: (1) to slightly increase the thermal resistance of the windows and (2) to increase the workplane illuminance when the lights are on because the blinds have a higher reflectivity than the window.

To translate the number of motor step to shade movement you must input properties of your gear:

  • Gear ratio
  • Motor step angle (degrees)
  • Gear radius

The control strategy program iterated every 10 minutes. This was intended to reduce distractions caused by constantly having the blinds move. The same strategy was adopted by Tzempelikos (2012).

Download the code below:

Step 5: Conclusion

Developing prototypes using Arduino specific to building technology has large potential to substantially reduce energy use in buildings. This project focused on reducing energy in buildings for the lighting and heating/cooling aspect using automatic motorized shades. A manual roller shade was retrofitted into an automatic motorized one that adjusted the shade height based on the position of the sun and/or on the workplane illuminance using open and closed loop control.

Future Work

The project could be easily integrated with a lighting system. In the future the system could also be integrated with an HVAC system in order to minimize cooling and heating loads.

If you enjoyed this instructable please share it with your friends and improve upon it if you wish.

If you have any constructive comments, questions, or suggestions feel free to comment.

Nick Zibin


Abella, J. 2010. Ball-Chain Pulley for Polargraph. MakerBot Thingverse. Retrieved from

Fried, L. 2012. TSL2561 Luminosity Sensor. Adafruit. Retrieved from


Fried, L. 2013. Adafruit Motor Shield V2 for Arduino. Adafruit. Retrieved from


O’Brien, W., K. Kapsis, & A. K. Athienitis. 2013. Manually-operated window shade patterns in office buildings: a critical review. Building and Environment 60:319-38.

Tzempelikos, A & A. K. Athienitis, 2007. The impact of shading design and control on building cooling and lighting demand. Solar Energy, 81:369-82.

Tzempelikos, A. 2012. Development and Implementation of Lighting and Shading Control Algorithms in an Airport Building. Journal of Architectural Engineering 18(3):242-50

Tzempelikos, A., & H. Shen. 2013. Comparative control strategies for roller shades with respect to daylighting and energy performance. Building and Environment, 60:179-92.

Arduino Contest

Participated in the
Arduino Contest

Be the First to Share


    • Reuse Challenge

      Reuse Challenge
    • Rice & Grains Challenge

      Rice & Grains Challenge
    • CNC and 3D Printing Contest

      CNC and 3D Printing Contest



    7 years ago on Introduction

    Very cool idea to have blinds that follow the sun across the sky during the day. That would be something that I would love to have in my office. For the last part of the day no matter what I do the sun is all ways directly in my face. These blinds would definitely help with my sun problem. http://www.sunblindsandcurtains.com.au/internal-blinds


    I think this is the most science oriented automatic blind implementation.

    But what if its winter and you need sunlight to enter the building to heat it up?

    During summer night you might want the blinds to be fully up so the building loses some of the heat absorbed during daytime, and close them right before the sunrise.

    A thermal sensor might gave a complete solution to this, (with the necessary additions to the code)

    Also a manual override would be handy.

    Would these additions be possible in the code?


    8 years ago

    Hey Nick!

    Nice project - I'm doing something similar with my own (venetian) blinds. Instead of using a Luminosirty Sensor I'm using a cheap LDR sensor. Infact, "cheap" is one of my main concerns as I want to do all my windows. Right now my setup cost me roughly eight dollars per window (not including the motor - scavenged from an old printer) - it checks outdoor light levels, indoor temp and adjusts blinds according to predefined thresholds. It has a handy IR remote to override the blinds too! :) I'm currently testing the setup running on solar, but it has increased the costs significantly - roughly $20 for battery and panel. Anyway, would it be possible to take a peak at your code and see if I can borrow a few ideas from it? Looks like it works wonderfully!


    Reply 8 years ago on Introduction

    Scroll down to bottom of Step 4 and you can download the code there. I hope it helps and good luck with your project.


    8 years ago

    This article reads just like some robotics papers I've read, except it's even more clear. Good job!


    8 years ago

    Nicely done! Do you know: if you want the heat of the sun out by using blinds, the blinds should be reflective and outside of the building. with these black ones inside the room what will happen is this: the solar irradiation is absorbed by the black material and is then sent out from the blind in the form of infrared radiation, causing the room to heat up.


    Reply 8 years ago on Introduction

    You are right, the thermal aspects of blinds are also important but this was outside of this projects scope. An ideal placement for a window blind is actually outside the window (as opposed to inside the window in this project). This reduces the solar heat gain entering the room but there are design aspects that cause issues with placing blinds outside of windows (e.g., weather effects such as wind etc.).

    I have always wanted to get a system like this up and running! I have tried on one occasion before but I could not find a motor that had enough torque that could lift my blinds. My blinds are about 7 foot long and using a baggage scales requires about 2-3kg of force to pull up from completely drawn. Any advice on the size/torque required? How did you figure out the torque needed?


    Reply 8 years ago on Introduction

    I would suggest having a motor torque of 1.5 Nm based on really rough calculations. The motor I used had a torque of 3 Nm and could easily lift the roller shade. This spread sheet provided by Somfy could help in your calculations: (https://www.somfypro.com/documents/531668/3408119/Roller+Shade) Note: this link will download an excel spreadsheet.


    8 years ago on Step 5

    This is a very impressive solution to natural lighting control . You have made a great project that I am sure will be utilized in smart buildings in the very near future.

    Thanks for sharing!



    8 years ago on Introduction

    Hi! nice job:) for venetians check out http://www.indiegogo.com/projects/jalousier-adds-your-blinds-to-the-iot/x/4462109

    nice , the 3D printed gear idea is amazing

    i wanted to make a project like yours but i was wondering of a method to control the shade, now i got one! thank you.

    but i dont have a 3D printer so im going to do with wood


    Reply 8 years ago on Introduction

    Probably something like this? : wood cylinder, drill shallow holes for balls, file between holes?


    8 years ago on Introduction

    great project!!

    i really liked the part with the broccoli. ^^