How to Build an Arduino-Powered Motion Sensor Night Light for Under $15

Introduction

Building an Arduino-powered motion sensor night light is an easy and fun electronics project that can be completed in an afternoon for under $15. With just a few common components, you can create a useful night light that turns on automatically when it detects motion in a dark room.

In this comprehensive guide, I will walk through each step required to build this DIY motion-sensing night light using an Arduino microcontroller board. I will cover:

The Materials and Tools Needed

The Circuit Design and Connection

The Arduino Sketch and Code

Assembling the Hardware

Applications and Future Enhancements

By the end of this guide, you will have gained both the knowledge and tools to create your own automated Arduino night light that turns on when needed. The skills you learn can also be applied to more advanced Arduino projects in the future.

The Materials and Tools Needed

To build the Arduino motion-sensing night light, you will need the following components:

For tools, you will need:

That covers the key components and tools needed for this budget Arduino night light project. Now let's look at how to put it all together.

The Circuit Design and Connection

The circuit for this motion-sensing night light is simple, with just a few key components connected to the Arduino board:

How to Build an Arduino-Powered Motion Sensor Night Light for Under

Here is an overview of each part's role in the circuit:

To build the circuit:

Take your time making the connections - referring to the circuit diagram to double-check each wire. Once assembled, we can move on to programming the Arduino brain of our night light creation.

The Arduino Sketch and Code

To program the Arduino Uno board, you will need to first download the Arduino IDE software on your computer. This open-source software allows you to write code and upload it to any Arduino board.

Downloading the Arduino IDE

Here are the steps to install the Arduino IDE:

  1. Go to www.arduino.cc
  2. Click to download the Windows, Mac, or Linux software depending on your computer.
  3. Open the downloaded file and follow the steps to install the Arduino IDE.
  4. Once installed, open the Arduino app on your computer.

With the IDE ready, you can now write and upload the sketch for the motion-sensing night light.

The Arduino Code

The code for this project is relatively simple. It includes:

Here is the full Arduino sketch:

```cpp
// Motion Sensor Night Light Code

// PIR Sensor pin
int pirPin = 2;

// LED pin
int ledPin = 13;

// Variables
int pirValue; // PIR status
int ledState = LOW;

void setup() {

// Set LED pin as output
pinMode(ledPin, OUTPUT);

// Set PIR pin as input
pinMode(pirPin, INPUT);
}

void loop(){

// Read PIR state
pirValue = digitalRead(pirPin);

// If motion detected
if (pirValue == HIGH) {

// Turn on LED
digitalWrite(ledPin, HIGH);

// Delay 60 seconds
delay(60000);

// Turn off LED
digitalWrite(ledPin, LOW);

}
}
```

This code continuously checks the PIR sensor. When motion is detected, it triggers the LED to turn on for 60 seconds before turning off again. Pretty simple!

Uploading the Code

To get this sketch running on the Arduino:

  1. Connect the Arduino to your computer via USB cable.
  2. In the Arduino IDE, select the board type (Arduino Uno) and COM port it is connected to.
  3. Copy the code and paste it into a new sketch in the IDE.
  4. Click the "Upload" button to compile and upload to the board.

Once uploaded, the code will run automatically on the Arduino. Now it's time to put it all together!

Assembling the Hardware

With the circuit complete and code uploaded, the final step is assembling the hardware components for the motion-activated night light.

Mounting the Components

It's best to mount the components in an enclosure to protect the electronics. Here are some tips:

If you don't have an enclosure, simply mounting the components securely on a piece of cardboard or wood will also work.

Powering the Arduino

To power the Arduino for this project, connect a 9V battery to the Vin and GND pins using a 9V battery clip adapter.

Make sure the battery clip wires provide a firm connection. You can solder them directly to the Arduino pins for a permanent power source.

For portable use, a 9V battery will provide hours of usage. You can also plug the Arduino into a USB power adapter or USB battery pack for unlimited run time.

Adding a Case (Optional)

For a polished finished product, you can 3D print or hand-make a custom case. Some ideas:

With the electronics secured and wired up inside the case, your DIY motion-sensing night light is complete!

Applications and Future Enhancements

You now have an automated Arduino-based night light that turns on when it detects movement in low light.

How to Use Your New Night Light

There are many handy applications for this responsive LED light:

The possibilities are endless for this useful gadget!

Possible Upgrades and Additions

Here are ideas for enhancing your Arduino motion-sensing night light:

The skills you learned creating this starter project will enable you to expand it and create more advanced Arduino designs. Just let your creativity guide you!

Conclusion

Constructing this nifty automated night light with Arduino teaches useful skills in electronics, programming, and DIY engineering. For under $15 in parts, you can build your own motion-sensing gadget from scratch.

The simple circuit uses just an Arduino, PIR sensor, LED light, breadboard, and a few basic components. With easy-to-learn Arduino code, the light turns on whenever the sensor detects movement in low light.

Mounting it in a custom enclosure produces a polished, finished product. And there are tons of applications for this auto-sensing LED light in any home, office, or workspace.

This project also provides a foundation for learning more advanced Arduino programming and electronics. You can now take the skills to the next level and create more complex interactive devices. The possibilities are wide open when tapping into the power of the Arduino!