You Are Here: Home » AVR ATmega Projects » Home Automation Projects » Self-Adjusting Window Shade Using Atmega644

Self-Adjusting Window Shade Using Atmega644


The self adjusting window shade will automatically raise, lower, open, and close your blinds by itself. A computer terminal acts as a remote to broadcast instructions to the window shade via RF. These manual adjustments are stored into the microcontrollers system along with the rooms current ambient light and temperature settings. When these lighting and temperature conditions are found in the room, the window shade will automatically readjust itself to that previous level.

Self-Adjusting Window Shade Using Atmega644

High Level Design


We got based our design off Lutrons Sivoia shading solutions (youtube video found here). The Lutron system features that we were especially interested in were the remote functionality, and the automatic capabilities of the shade. We noticed that it might also be favorable to create a memory system within the window shade that would allow it to remember the users previous settings and automatically adjust based off the current conditions in the environment. In addition we created a radio frequency unit that connected the window shade to a computer system that would be able to not only manually adjust the window shade settings, but potentially control entire systems within the home.

Background Math

Memory Table Organization

The nodes in the memory table are set by using Chebyshev nodes. Chebyshev nodes take an even distance along the unit circle, making points at the ends closer to each other while points in the middle further away. We used this design because we felt that there is more tolerance in shade conditions in the middle ranges than at the extreme ranges.

Chebyshev nodes are defined by the following formula: x_i = (a+b)/2 + (b-a)/2*cos((2*i+1)/(2*n+2)*pi) for n+1 nodes where (a,b) is the range, and 0 = i = n. To determine the light nodes we set n = 7 (8 nodes) to get 9 regions between 0 and 255. To get the temperature nodes we set n = 3 (4 nodes) to get 5 regions between 100 and 180. We chose these boundary points because we do not expect the shade settings to change when the temperature of the house falls below 50F or rises above 90F. Even those this might also be the case for the light settings, we decided to leave them because the light setting referenced is based off the difference in light.

The nodes from the Chebyshev formula for light are as follows:
[2.4499 21.876 56.6648 102.6260 152.3740 198.3352 233.5124 252.5501]

The nodes from the Chebyshev formula for temperature are as follows:
[51.7127 63.8896 81.1104 93.2873]

These nodes were rounded to integer values to conserve memory usage and make it easier to compare.

Logical Structure

Our design contains two ATMEL Mega644 Microcontrollers: one to control the computer interface and the other to operate the window shade. The first ATmega644 connects to the computer terminal. Hyperterm allows the user to input commands to the MCU to send and/or receive data. They are then transmitted through the RCT433 to the receiver on the other MCU.

The second MCU contains two modes of operation: automatic and manual. During manual mode the MCU receives the data transmitted from the first MCU and processes instructions, moving the shade to the desired position. When it is not receiving instructions, the MCU switches to automatic mode, where it adjusts the blinds to the users previous settings depending on the lighting and temperature conditions in the room. The MCU then sends a signal out to the motors to rotate them the correct amount to adjust the shade.

The detailed schematics of these designs can be found in the Appendix.

Hardware/software Tradeoffs

The motor can be driven with half-step or full-step configurations. Half-step was preferred because it provided more driving power. Unfortunately, this increased power consumption. Since power consumption isn’t a metric for this project, this was an acceptable solution for increasing the strength of the weak stepper motors.

The resolution of the position of the blinds and flaps must be balanced with memory size. The position is stored for a certain configuration in a table. The position is sized to be a byte, allowing 256 possible positions. If the position had been sized as an int, allowing 65536 positions, the memory needed to map configurations to possible positions would grow by about 256 times the length of the table. The length of the table that stores possible configuration options is determined by the degree of tuning required for setting automatic points. For finer responses to conditions, more entries would be required. While the current configuration does not fully utilize data space, it provides adequate response to conditions as well.

When discussing methods to implement a second UART, the solution of a secondary hardware UART on the ATMega644P was overlooked. While a hardware solution is more favorable, due to simplicity of implementation, a software UART allowed finer control over the transmission rate. In order to mitigate risks of malfunction of the RF transmitter/receiver pair due to running the baud rate close to its specification, a lower baud rate may be selected. Due to the nature of the timers, this baud rate does not need to be quantized by the resolution of the hardware USART control registers (i.e. not limited to the micro controllers limited selection of baud rates). Half-duplex communication was also desired due to the shared bus property of the RF channel and the lack of any frequency multiplexing.

Due to the interactions between various interrupts, especially the critical areas of sending/receiving data over the RF link, the timing of the motor update interrupt and the software UART interrupts must be long enough to avoid loss of data. For example, the software UART sampling rate must be long enough for the delay of a motor interrupt to complete processing, hence sampling bits consistently at the correct time. This assertion would limit the baud rate, but since the baud rate is already limited by the RF modules, this factor can be safely ignored.

The controllability of the window shade presented a usability trade off. While the user should be given the freedom to enter any arbitrary adjustment value, overestimating adjustment values would cause the shade to make drastic adjustments and the user to panic. From an interaction perspective, limiting the adjustment range to a constant allowed the user to see enough feedback without taxing the ability to immediately respond to drastic changes.

Existent Patents

The concept of motorized window shades is nothing new with the current energy conservation strategies. Patent 7389806 discusses a motorized window shade and communication system to raise and lower the shade. The idea of the motorized window shade has already been implemented by several companies such as Lutron and Draper. However, none of these companies has implemented a memory system that would allow the window shade to operate independent of human control

Back to top


RF Communications Network

From the beginning, one of the goals of the project was to provide a method for interfacing with multiple remote devices. One of the simplest network topologies for this purpose is a star topology.

Self-Adjusting Window Shade Using Atmega644 Schemetic

Such a topology is reasonable due to the lack of interaction between remote devices. The base station controls all the remote devices so it is the most authoritative node on the network and is located in the middle of the star. To lighten the load on the base station, and consequently the gateway device (e.g. computer) controlling the base station, the assertions that only one remote device is transmitting while the base station is receiving and all remote devices are receiving while the base station is transmitting must hold true. The RF communications link is essentially a shared bus. Consequently, frequency multiplexing, which would allow multiple remote devices to communicate with the base station, is too complex for this project.

Blind Movement

The blinds are moved up and down using 2 PF35T-48L stepper motors. The motors are optoisolated using 4N35 isolaters and powered by a ULN2003A Darlington Array. The stepper motors are used because of their accuracy since the blinds are expected to stop at specific positions depending on the user’s previous preferences. They both drive a single gear that increases the torque in the system, allowing shades to be reaised smoothly. Spools are used to roll up the string that holds the window shade. Pulleys are used to redirect the force of the pulling so that the single gear and rod are able to raise and lower the shade. The string goes through the holes of the original window shade frame, so that its outside appearance looks exactly like a normal window shade.

Parts List:

MotorsPF35T-48L Stepper Motors31.003.00
MotorsULN2003 Darlington Array20.641.28
Motors4N35 Optoisolators80.252.00
Motors/RF/Sensorssmall PC board51.005.00
MotorsRubber Bands4Previously Owned
MCUDIP sockets30.501.50
MCUMCU solder boards21.002.00
RFRCR-433 RF receiver24.008.00
RFRCT-433 RF transmitter24.008.00
MCU/MotorsPower Supply35.0015.00
SensorsOPT101 Photodiode25.5011.00
SensorsLM34 Temperature Sensor12.512.51
ShadeWindow Shade12.662.66
ShadeCardboarda lotscrapped


For more detail: Self-Adjusting Window Shade Using Atmega644

Leave a Comment

You must be logged in to post a comment.

Read previous post:
Weather Canvas Using Atmega644

Introduction The Weather Canvas is a robust outdoor weather monitoring system coupled with an indoor LED display. The outdoor system...

Scroll to top