Smart staircase LED lighting with Arduino and IR sensors
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.
Featured on Instructables !!
Smart staircase LED lighting with #Arduino and IR sensors pic.twitter.com/ns5zh2r8tQ
— Javi Rengel (@rephus) February 11, 2017
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
Arduino code
#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