Have you ever wanted a night light that turns on automatically when you walk into a dark room? With an Arduino microcontroller, some basic electronic components, and a bit of coding, you can build your own motion-activated night light in just 10 minutes.

What You'll Need

To build this simple motion-activated night light, you'll need the following parts:

That's it for supplies! Make sure you have all the components listed above before starting.

Step-by-Step Instructions

Follow these step-by-step instructions to assemble your motion-activated night light in 10 minutes or less:

1. Connect the PIR Motion Sensor

The PIR (passive infrared) motion sensor needs 4 connections - 5V power, ground, and 2 data lines to pins 2 and 3 on the Arduino.

Use jumper wires to connect the sensor:

This allows the Arduino to receive motion detection data from the sensor.

2. Connect the LED Light

Next, connect the LED light to the breadboard.

Insert the 220 ohm resistor in series to limit current. Then connect:

Later, we'll activate the LED light by turning pin 13 HIGH in code.

3. Connect the 9V Battery

The 9V battery will power the circuit. Use the 9V battery clip to connect positive and ground to the power rails on the breadboard.

This will feed power to the Arduino when switched on.

4. Upload the Arduino Code

With the hardware assembled, it's time to upload the code that controls the night light:

```arduino
// Motion-activated night light

int ledPin = 13; // LED on pin 13
int pirPin = 2; // PIR on pin 2
int pirValue; // PIR status

void setup() {
pinMode(ledPin, OUTPUT); // Set LED as output
pinMode(pirPin, INPUT); // Set PIR as input
}

void loop() {
pirValue = digitalRead(pirPin); // Read PIR

if (pirValue == HIGH) { // If motion detected
digitalWrite(ledPin, HIGH); // Turn on LED
}
else {
digitalWrite(ledPin, LOW); // Else turn off
}
}
```

This simple code reads the PIR motion value, and turns the LED on pin 13 HIGH when motion is detected.

Upload it to your Arduino board through the Arduino IDE.

5. Test It Out

Once coded and assembled, switch on the 9V battery power.

When you walk in front of the PIR sensor, the LED light should turn on automatically!

The light will turn off after a few seconds when you stop moving. Pretty cool for just 10 minutes of work!

Customizing Your Night Light

While a bright LED works well, you can customize your night light even more:

With Arduino, the possibilities are endless. Use this project as a base for your own creative motion-activated lighting ideas.

I hope you've enjoyed learning how to build a motion-activated night light in just 10 minutes! Let me know if you have any other Arduino project ideas you'd like to see. Happy making!