Assignment 2: Smart Entrance Lighting

Issue

Returning home after a long day is a great feeling, but for those with less-sensitive vision, it may be difficult to locate a light switch in a dimly-lit or dark environment. 

General solution

Ideally, the house should be able to sense when someone has returned, whether through the motion of the person, the opening of the door, or the location of one’s smartphone. Combining this input with a reading of the ambient light level (i.e. if it’s still bright enough outside that light coming in through windows make the house sufficiently navigable without artificial lighting), the system should determine whether it is necessary to turn on the lights. Then, once an individual has found their way past the foyer, the system could automatically turn off the lights that it had turned on earlier based on motion in other areas of the house, the turning on of other lights, or the location of a person’s smart device (using Bluetooth beacons, for example).

This solution would aid those with vision impairments and older people, whose eyes adjust slower to different lighting conditions. However, such an implementation could conceivably improve the life of a perfectly-sighted person by eliminating the need of hunting for a light switch in the dark, especially if both hands are full.

Proof of concept

An Arduino connected to an IR proximity sensor detects when a person has entered a zone and turns on an LED. A second IR proximity sensor detects movement in another zone, and another LED is connected to a switch. If motion is detect in the second zone or if the second LED is turned on via the switch, the first LED is turned off by the controller.

Initially, I wanted to use the RCWL-0516 Doppler radar motion sensor available in the physical computing inventory, but the documentation seems thin (a GitHub project page depicts oscilloscope scans), so I decided to use a simple IR proximity sensor instead.

Fritzing sketch
Proof of concept schematic for a smart entrance lighting system.
Arduino sketch (untested)
const int SWITCHPIN = 9; // controls interior light
const int DOORLIGHT = 3; // LED near entrance
const int INTERIORLIGHT = 6; // LED inside house
const int DOORMOTION = A0; // IR proximity sensor near entrance
const int INTERIORMOTION = A1; // IR proximity sensor inside house
const int motionThreshold = 30; // set motion threshold here

void setup() {
  pinMode(DOORMOTION, INPUT);
  pinMode(INTERIORMOTION, INPUT);
  pinMode(SWITCHPIN, INPUT);
  pinMode(DOORLIGHT, OUTPUT);
  pinMode(INTERIORLIGHT, OUTPUT);
  
  Serial.begin(9600);
}

void loop() {
  int switchVal;
  switchVal = digitalRead(SWITCHPIN);

  int doorRead;
  doorRead = analogRead(DOORMOTION);

  int intRead;
  intRead = analogRead(INTERIORMOTION);

  if(doorRead > motionThreshold) {
    digitalWrite(DOORLIGHT, HIGH);
  }
  
  if(intRead > motionThreshold || switchVal == HIGH) {
    digitalWrite(DOORLIGHT, LOW);
    digitalWrite(INTERIORLIGHT, HIGH);
  }
}
Visual sketch
A simple floorpan showing locations for IR proximity sensors and lights.

Leave a Reply

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