Intelligent Windows

Made by James Katungyi

Automate a window to open when indoor conditions require and outdoor environmental conditions are right; then alert the occupant.

Created: February 7th, 2017



Write about the big ideas behind your project? What are the goals? Why did you make it? What are your motivations?

Often times, building designed to save energy fail to do because of occupant behaviour is unpredictable. If the building elements were intelligent enough to operate on their own while alerting the occupants of their actions, the energy savings target may be achieved.

Taking one building element - the window; equipping it with the intelligence and mechanisms to open when indoor conditions require it and while outdoor conditions allow it, can make ventilation of indoor spaces less energy intensive.

The intelligent window is just a drop in the ocean of what IOT can do with architecture.



Describe what informed your ideas and your outcome? How does your outcome relate to other work in the field? What are the precedent projects?

My ideas were informed by previous research in building architecture that harnesses outdoor environmental conditions for occupant comfort indoors. In this case, even in predominantly cold or hot climates, it is possible to naturally ventilate buildings for a time during the year, i.e. when the outdoor temperature, humidity, wind speeds, noise and air quality are acceptable. Natural ventilation saves energy. However, it can be difficult to determine when the time is right to naturally ventilate. If the window is equipped with the intelligence and mechanisms, it can automatically open and close.

Natural ventilation is more common in Europe. The new PNC building in downtown Pittsburgh, is naturally ventilated on some days. It probably uses a similar technique - intelligent windows.



Outline your approach to the project? What ideas did you generate and how did you refine or reject them? What did you research and explore? what were the design choices? What challenges were encountered and how did you resolve them?

The project takes only one outdoor parameter into account - temperature. There was not sufficient time to integrate the other parameters - humidity, wind speed and direction, noise, air quality - that make the window really intelligent.

First step was to use a temperature sensor to read and communicate the outdoor temperatures.

The second step was to condition the window opening mechanism to open when the outdoor temperatures lie between 72F and 75F. The window opening mechanism is a motor, which is conditioned to run in one direction (opening) when the temperature is greater than 72 but less than 75 and if a button shows the window to be closed. The motor also runs in the other direction (closing) when if the temperature is outside that range and the button shows the window to be open.

The third step was to send an email to the occupant’s account whenever the window opens. 

This being my first project in this field, I research and explored everything from the code structure to importing libraries for the temperature sensor. For the motor to run in one direction then the other when prompted, I used an H-bridge. Each step into the project raised more questions. For example, I realised that I needed a signal within the set-up that would stop the motor when the window was completely open or completely closed. For this, I used a switch which is meant to be pressed down when the window is completely open. I planned to use a second switch for when the window is completely closed, but I never got round to it.



Detail what you created. What methods or techniques did you use? What tools and technologies were involved? Include images, code or video.

The temperature sensor worked well. However the motor could not run by the time of submission. Nor did the switch. The prototype is basic since it does not include a window, nor does it include the closing function. Besides, the motor speed requires calibration to safely operate a window. Safety features to prevent accidents would have to be integrated. 

When the window is open, it sends an email to the occupant using the IFTTT set up (image below). I would wish to incorporate an override function where the room occupant could instruct the window to close in case of a security risk. Alternatively, the window may be designed to open in such a way that it is always secure.



Reflect on the process of making this project. What did you learn? What would you do differently?

The project is interesting because it gives me the skills to turn ideas into reality. It was however challenging on two fronts: learning the IOT device set-up (coding and circuitry) and designing the device. 

I learnt the basics of IOT device set up.  

Click to Expand
// This #include statement was automatically added by the Spark IDE.
#include "OneWire.h"

// This #include statement was automatically added by the Spark IDE.
#include "spark-dallas-temperature.h"

// -----------------
// Read temperature
// -----------------

// Data wire is plugged into port 0 on the Arduino
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(D0 );

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature dallas(&oneWire);

// Create a variable that will store the temperature value
double temperature = 0.0;
double temperatureF = 0.0;

long frameCount = 0;

// We will be using D1 to control our LED
//int ledPin = D1;

// Our button wired to D0
int buttonPin = D6;


/*int motorPin = D6;*/
const int motor1Pin = D1;
const int motor2Pin = D2;
const int enablePin = D3;
const int switchPin = D4;

bool windowClosed = true;

void setup()
//===========BUTTON ==========================
  // For input, we define the
  // pushbutton as an input-pullup
  // this uses an internal pullup resistor
  // to manage consistent reads from the device

  pinMode( buttonPin , INPUT_PULLUP); // sets pin as input

  // We also want to use the LED

  //pinMode( ledPin , OUTPUT ); // sets pin as output

//============TEMPERATURE SENSOR=========================
  // Register a Particle variable here
  Particle.variable("temperature", &temperature, DOUBLE);
  Particle.variable("temperatureF", &temperatureF, DOUBLE);

  // setup the library

  pinMode(switchPin, INPUT);
  pinMode(motor1Pin, OUTPUT);
  pinMode(motor2Pin, OUTPUT);
  pinMode(enablePin, OUTPUT);

  digitalWrite(enablePin, HIGH);

void loop()
  //digitalWrite(motorPin, HIGH);
//================BUTTON PIN===========
  // find out if the button is pushed
  // or not by reading from it.
  int buttonState = digitalRead( buttonPin );
  int digitalSwitchState = digitalRead( switchPin );

//=====Temperature sensor===========
  // Request temperature conversion
if(frameCount%100 == 0) {

  // get the temperature in Celcius
  float tempC = dallas.getTempCByIndex(0);
  // convert to double
  temperature = (double)tempC;

  // convert to Fahrenheit
  float tempF = DallasTemperature::toFahrenheit( tempC );
  // convert to double
  temperatureF = (double)tempF;

//Window is open when the button is pressed. It is closed when button is high
  if(buttonState == LOW) {
    windowClosed = false;
//run motor if temperature is between 65 and 75 and if the button is
  if ((temperatureF > 65) && (temperatureF < 75) && (windowClosed = true))
    digitalSwitchState == HIGH;//turn on the digital switch
  else {
    digitalSwitchState == LOW;//turn off the digital switch
  if (digitalSwitchState == HIGH){//when digital switch is on, run motor
    digitalWrite(motor1Pin, HIGH);
    digitalWrite(motor2Pin, LOW);

The API request will look something like this:
GET /v1/devices/{DEVICE_ID}/temperature

# Device ID is 0123456789abcdef
# Your access token is 123412341234
curl -G \
  -d access_token=123412341234
Click to Expand
Share this Project

Focused on

Automate a window to open when indoor conditions require and outdoor environmental conditions are right; then alert the occupant.