Introduction

Installing a motion-activated light in your stairwell is a great way to illuminate the stairs safely without having to turn on switches every time you use them. With an Arduino microcontroller, a few electronic components, and basic programming skills, you can build your own motion-sensing light easily.

In this guide, I will walk you through a simple DIY project to create a motion-activated light for your stairwell using an Arduino Uno board. We will go over:

So if you want to upgrade your stairwell lighting in a fun electronics project, read on!

Components Needed

To build the motion-activated stairwell light, you will need the following components:

This simple list of components is all you need to sense motion and activate LED lights automatically using the Arduino!

Assembling the Circuit

We will first prototype the motion-activated light circuit on a breadboard before installing it permanently.

1. Connect the PIR motion sensor

2. Connect the relay module

3. Connect LED light strips

And that completes our motion-activated light circuit! The PIR will sense movement and signal the Arduino, which will trigger the relay to switch on the LED strips.

Programming the Arduino

Now let's program the Arduino to activate the stairwell light when motion is detected.

1. Initialize the motion sensor pin

We'll call the PIR sensor pin motionSensor:

cpp
int motionSensor = 2;

2. Initialize the relay control pin

The relay control pin is relay:

cpp
int relay = 3;

3. Set LED light status variable

We need a boolean variable to store whether the light is ON or OFF:

cpp
bool lightOn = false;

4. Check for motion in loop()

Use an if statement to check the PIR sensor pin and switch the light:

```cpp
if (digitalRead(motionSensor) == HIGH) {

if (lightOn == false) {
digitalWrite(relay, HIGH);
lightOn = true;
}

} else {

if (lightOn == true) {
digitalWrite(relay, LOW);
lightOn = false;
}

}
```

This code turns the light ON when motion is detected and OFF again after some time. Upload it to your Arduino!

Installing the Motion-Sensing Light

Once the circuit is tested and programmed, you can install the motion-activated light in the stairwell permanently:

And that's it! Your DIY motion-activated stairwell light using Arduino is ready. Walk up the stairs and watch the LEDs turn on automatically.

Some ideas to enhance the project:

With Arduino, electronics components, and basic coding, you can build creative motion-sensing lights for your home stairwells, hallways, or rooms!