How to Build a Simple Motion-Activated Night Light Circuit With an Arduino

How to Build a Simple Motion-Activated Night Light Circuit With an Arduino

Introduction

Building a motion-activated night light with an Arduino is a fun and relatively straightforward electronics project. The end result is a useful circuit that will turn on a light automatically when motion is detected in a dark room.

In this guide, I will walk through all the steps required to build the motion-activated night light circuit from start to finish.

Components Needed

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

Circuit Diagram

Here is a circuit diagram showing how all the components are connected:

The PIR motion sensor, relay module, and LED light all connect to the Arduino's GPIO pins to be controlled by the program code.

Setting up the Hardware

Follow these steps to construct the circuit on the breadboard:

Step 1: Connect the PIR motion sensor

Step 2: Connect the relay module

Step 3: Connect the LED light

Step 4: Power the Arduino

Once all the connections are made, the hardware portion of the circuit is complete!

Loading the Code

With the hardware set up, now the Arduino needs to be programmed:

  1. Download the Arduino IDE software on your computer
  2. Copy and paste the code from this source into a new sketch
  3. Upload the code to the Arduino

The code instructs the Arduino to turn the relay on and light on when motion is detected by the PIR sensor.

Key portions:

Testing and Using the Night Light

Once programmed, the motion-activated night light circuit should function!

To test it out:

Try experimenting with different delay times and light sources to customize the night light to your needs.

The finished circuit can provide hands-free lighting in dark hallways, closets, or rooms easily and automatically!

Troubleshooting Issues

If the motion light does not work properly:

With some tweaks, you should be able to get the motion-activated night light working reliably.

Conclusion

Building a motion-activated night light with an Arduino is an easy and fun electronics project. With just a few components, some basic code, and following this guide, you can create a useful automated lighting solution. Customize the circuit to suit your needs for the perfect hands-free night light! Let me know in the comments if you have any other questions.