Project tutorial
RobotGeek PIR Motion Sensor Night Light

RobotGeek PIR Motion Sensor Night Light © CC0

This project demonstrates how to make a nightlight by using an Arduino, a PIR motion sensor, and PowerSwitch Tail to turn on a 120V light.

  • 2,492 views
  • 1 comment
  • 6 respects

Components and supplies

Necessary tools and machines

M3 Bolt Driver

Apps and online services

About this project

This project demonstrates how to make a nightlight by using an Arduino, a PIR motion sensor, and PowerSwitch Tail to turn on a 120V light.

Step 1: Setup Your Arduino / Geekduino

Our instructable will be using the RobotGeek Geekduino board and the RobotGeek Sensor Shield. If you've never used an Arduino or the RobotGeek Sensor Shield, these guides will get you up to speed.

RobotGeek Hardware Primer

RobotGeek Sensor Shield Wiring Primer

Geekduino Getting Started Guide

We'll also have some wiring diagrams for a standard Arduino Uno if you're not using a RobotGeek kit.

Step 2: Wiring

Wire as shown in the diagram above that matches the parts you've chosen to use.

Step 3: Coding

You can download the code sketch here:

Load it on to your board, and you're ready to light up the night! There are a few things worth mention in the code. To put it simply, this code says that when the PIR sensor detects movement to set the signal pin connected to the Powerswitch Tail to HIGH, and to keep it that way for a predetermined amount of time. if you want to change that amount of time, take a look at the code. Notice where it says

#define LIGHT_ON_TIME 10000

This sets the delay for an amount of time (in this case, 10 seconds/10000 milliseconds) in milliseconds. Play with that a bit to activate the light for what you deem an appropriate amount of time.Also worth mentioning is the fact that you can hook up just about any 120v device to the power switch tail, and it will activate in the same way as the light has. We've used it for spooky halloween decorations, but the sky is the limit, really.

Step 4: Project ideas

Since you've got a device that functions whenever something moves in front of it at this point, why not try adding some things to it? You could easily add a buzzer to make a jaunty tune every time the sensor catches you, or make a proximity alarm for when interlopers invade your desk space. Maybe you want a little light in your drawer when it opens? You could have the sensor turn on some LEDs. Experiment with it! Arduino programming is simple enough, and if you're using the RobotGeek Sensor Shield, adding new modules is quick and easy. Most of all, have fun with it and make something you love!

Code

Github
https://github.com/robotgeek/nightLightDemo/archive/master.zip

Schematics

Motion Sensor Night Light Wiring with RobotGeek Sensor Shield
Motion Sensor Night Light Wiring with RobotGeek Sensor Shield
Night light bb
Motion Sensor Night Light Wiring no Shield
Motion Sensor Night Light Wiring no Shield
Nightlight noshield bb

Comments

Similar projects you might like

Motion Activated Night Light

Project tutorial by Haziq Afandi

  • 6,055 views
  • 0 comments
  • 6 respects

PIR Motion Controlled Relay Using Arduino Nano!

Project tutorial by HeathenHacks

  • 4,845 views
  • 0 comments
  • 10 respects

Motion and Light Dependent LEDs

Project in progress by Joaquim Silveira

  • 2,575 views
  • 2 comments
  • 10 respects

LED Matrix + Motion Sensor Door Display [Arduino Holiday]

Project tutorial by HeathenHacks

  • 6,347 views
  • 5 comments
  • 22 respects

Night Light Assistant

Project showcase by Gabriele Fugazzi

  • 5,522 views
  • 9 comments
  • 23 respects
Add projectSign up / Login