how to make arduino motion sensor light

The motion sensor is a good way to save energy In this article we will learn making of arduino motion sensor light. We wanted to conserve energy and create the advantage, by supplement motion sensors to our lighting path. Perhaps you want some alerts of an intruder both can do with a PIR Motion Sensor.

When I enter in the dark room the light switch ON automatically, And when I walked out the light will OFF automatically after a certain delay that can arrange within code.

Starting work on arduino motion sensor light Tutorial:

The motion sensor PIR ( Passive Infrared sensor) detects the warm body in its field of view, or you can say in the range of the sensor. However, we need an Arduino board with some jumper wires and a single relay module to control light.

That might seem like a simple project, and in a way, it is 🙂 no need of any complicated work like libraries, schematics

Here all the thing mention which you will required.

  • Arduino board (any)
  • PIR sensor.
  • 1 Channel Relay Module( Or DIY yourself)
  • Breadboard for experimental use with jumper wires.

After getting all the things now, you need to wiring altogether in the correct way here is the diagram to show all the connection to make right.

Diagram Image:

arduino motion sensor light


We connect the Motion sensor “OUT” to Pin 4 and the Relay “IN1″ to Pin 8 of the Arduino board.

The light has one of the 220V wire spliced to connect the end attached to the power plug to the COM(GND) Pin of the Relay module and the one going to the Light/Lamp connected to the NC(Normally Closed) Pin.

We use a breadboard to connect the VCC and Ground to both modules from our UNO, but we plug in a 1N4007 Rectifier Diode to allow the current to go only one direction.

One important point that sometimes ignored is to use a Rectifier Diode when shifting High Voltage.

Some of the Relays Module have this protection built in, but this Diode is remarkably low cost, why not add an extra layer of protection to our circuit. Placing the Diode within the Relay and Arduino will guard us against power surges when the Relay switches since the Diode only allows current to pass one way.


Here is the code for arduino motion sensor light project. Download code from here unzips the code file, open and upload it with Arduino IDE no need any special settings or Libraries just simply upload the code, and you have done.



Note: You can set the delay of light to turn off when you walk away from PIR sensor range in the code.

Warning: you should take the necessary precautions when playing with high voltage. If you are worried or not sure, you should not continue any further.

Users also like:

Biometric security system Arduino.

FireAlram system with Arduino.

If you have any question or stuck on any step let me know your problem, I will help to slip on final step 😀

Leave a Reply

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.