How to Build a Motion-Activated Night Light With an Arduino for Under

How to Build a Motion-Activated Night Light With an Arduino for Under 10$

Introduction

Building a motion-activated night light with an Arduino is an easy and affordable DIY electronics project. In this comprehensive guide, I will walk you through every step required to create your own motion-sensing night light for under $10.

A motion-activated night light can be useful in many situations. It allows you to navigate safely in low light conditions without needing to turn on all the lights. The light turns on automatically when motion is detected, and turns off after a set time when motion is no longer detected.

This project is beginner-friendly and can be completed in an afternoon using common electronic components. The end result is a customized night light you can place anywhere that needs hands-free lighting.

What You Will Need

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

All of these components can be purchased for less than $10 total on websites like Amazon or electronic component suppliers like Adafruit and SparkFun. No soldering or advanced tools are required.

Circuit Diagram

The circuit diagram below shows how to connect the components to the Arduino board:

The PIR sensor, LED light, and resistor are connected to the power and ground pins on the Arduino. The digital OUT pin on the PIR connects to a digital input pin on the Arduino.

Setting Up the Arduino

  1. Plug the Arduino into your computer using a USB cable.

  2. Download the Arduino IDE software if you don't already have it. This allows you to program the Arduino board.

  3. Open the IDE, then go to Tools > Board and select "Arduino Uno".

  4. Next, go to Tools > Port and select the serial port associated with your Arduino.

  5. Now you are ready to upload code to the Arduino.

Uploading the Code

I have written an Arduino sketch with code to control the motion sensing night light functions.

To upload it:

  1. Copy the code from this sample sketch and paste it into a new sketch in the Arduino IDE.

  2. Change the pirPin variable to match the input pin you used on your board.

  3. Verify the code, then upload it to your Arduino.

This will program the motion detection and LED lighting behavior.

Assembling the Hardware

Follow these steps to build the circuit:

  1. Insert the PIR sensor, LED, and resistor into the breadboard.

  2. Connect jumper wires according to the circuit diagram.

  3. Plug the Arduino into breadboard power rails using jumper wires.

  4. Connect the 9V battery to the power rails using the battery clip.

  5. Mount the Arduino and breadboard into an enclosure.

  6. Position the PIR sensor so it can detect motion outside the enclosure.

  7. Turn on the power - your motion sensing night light is ready!

The light will turn on when the PIR sensor detects movement within its range. The code is set to keep the light on for 30 seconds after motion is detected before turning it off.

Customizing Your Night Light

Once you have the basic night light working, there are many ways to customize it:

The options are endless - this project is a great starting point for more advanced Arduino experiments!

With just a little time and less than $10 of supplies, you can create your own motion-controlled night light. This handy gadget provides automated lighting wherever you need it.