Smart Staircase LED Lighting With Arduino and IR Sensors

| Comments

For a long time, we’ve been turning on the lights at the beginning the staircase, just to turn them off when we reach another floor.

But instead, we built a simple system to turn them ON automatically when you are going upstairs or downstairs, just by using a couple of IR proximity sensors, a relay and an Arduino Pro Mini, to control the timing.

If you want to build your own, just follow our guide.

Shopping list

You can optionally use a power converter (from 12v to 5v) if you want to take advantage of the 12v input to power your Arduino and sensors.

Schema

schema

Arduino code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#define IR_RECEIVER 8
#define RELAY 10

void setup() {
  // initialize digital pin LED_BUILTIN as an output.
    pinMode(RELAY, OUTPUT);
  digitalWrite(RELAY, LOW);

}

// the loop function runs over and over again forever
void loop() {

  int sensorValue = digitalRead(IR_RECEIVER);
  // print out the value you read:
  delay(10);        // delay in between reads for stability

  if (sensorValue == 0 ) {
    digitalWrite(RELAY, HIGH);   // turn the LED on (HIGH is the voltage level)
    delay(5000);
  }
  else {
    digitalWrite(RELAY, LOW);

  }
}

Images

arduino upstairs downstairs

Comments