Introduction

Having a motion activated night light can be incredibly convenient and helpful. Instead of fumbling for a light switch in the dark or having a bright light on all night, a motion activated night light turns on automatically when it detects movement. This allows you to easily navigate in the dark when needed, without keeping lights on unnecessarily.

In this guide, I will show you how I built a motion activated night light using an Arduino microcontroller and basic electronic components for less than $20. With just a bit of tinkering, you can create your own useful night light gadget on a budget.

Parts and Tools Needed

To build the motion activated night light, you will need the following parts and tools:

Parts

Tools

Total cost: Less than $20

The Arduino microcontroller acts as the brains of the operation, while the PIR sensor detects motion and triggers the LED light strip to turn on. The battery provides portable power.

Circuit Design

The circuit for the motion activated night light is very simple. Here is how to connect the components:

This completes the basic circuit. The PIR sensor will detect motion and send a HIGH signal to the Arduino on the digital input pin. The Arduino code (covered next) will turn the digital output pin HIGH, lighting up the LED strip.

Arduino Code

The Arduino code for this project is very simple as well. Here is an overview of the code:

```cpp
// Declare PIR pin and LED pin
const int PIR_PIN = 2;
const int LED_PIN = 13;

// Variables
int pirState = LOW;

void setup() {
pinMode(PIR_PIN, INPUT);
pinMode(LED_PIN, OUTPUT);
}

void loop() {

// Read PIR state
pirState = digitalRead(PIR_PIN);

// If motion detected (HIGH) turn LED on
if (pirState == HIGH) {
digitalWrite(LED_PIN, HIGH);
}
else {
digitalWrite(LED_PIN, LOW);
}

}
```

The code declares pins for the PIR sensor and LED strip, reads the PIR state each loop, and turns the LED on when motion is detected. This basic code is all you need to create the motion sensing functionality.

Construction

With the circuit complete and code uploaded to the Arduino, the motion sensing night light is nearly finished!

Follow these remaining steps:

Once constructed, you now have a fully functioning motion activated night light for under $20!

The light will automatically turn on when the PIR sensor detects movement within its range. The sensitivity and direction can be adjusted by repositioning the PIR sensor.

Conclusion

Building your own motion activated night light with an Arduino is an easy electronics project that anyone can tackle on a budget. In just a few steps, you can construct a handy gadget to light up dark rooms and hallways automatically.

Customize the project by using different enclosures, sensors, and lighting. Consider adding features like light color or brightness control. The possibilities are endless!

Let me know if you have any other questions about constructing your own motion sensing night light with an Arduino!