How to Build a Motion Sensor Light Circuit with an Arduino
In this project, we will go over how to build a motion sensor light circuit with an arduino. A motion sensor light circuit is a circuit in which a light turns on when motion is detected.
With a PIR motion sensor integrated with an arduino, we can detect movement and program the arduino to turn a light on for a certain period of time once this motion is detected.
For example, once motion is detected, we will turn on the light attached to the output of the PIR sensor for 1 minute. This is how most commercial motion sensor lights work. When motion is detected, the light will turn on for about 1 or 2 minutes. If the light turned on and stayed on for only the second that motion is detected, this wouldn’t be very useful. When motion is detected by a motion sensor light, it will stay on for at least a period of time, on average 2 minutes, so that it can provide illumination for this time if the person that triggered the sensor stays in the area. Then, after this period of time has elapsed, it will shut off. If the person continues moving in the vicinity of the motion sensor, it will then be triggered again and stay on for 2 minutes again. This cycle will continue as long as needed. Again, this is how most commercial motion sensor lights work.
You can decide how long you want the light to stay on once detected for your circuit. You will see how to do this in the code you will write and upload to the arduino board.
- Arduino Board
- PIR motion sensor
- USB with type A and B connectors
The main electronic component we will use that allows us to pick up this detection is the PIR motion sensor. The PIR motion sensor is a sensor which detects movement through picking up infrared radiation. Being that a person emits infrared radiation, the detector is able to detect this and react, according to the how the circuit is designed to react. The sensor can also pick up the movement of inanimate objects as well, such a rolling ball, because as those objects move, friction acts on them, generating heat. This heat emits infrared radiation, which the PIR sensors may be able to detect if great enough.
This motion sensor can be bought at various online retailers. Probably the most reasonable price to get it is from amazon.com at the following link:Amazon- PIR Motion Sensor.
The PIR motion sensor is a 3-pin device. Below is the pinout of this device:
Pin 1 is the pin which receives the positive DC voltage. The PIR motion sensor needs between 5V-9VDC of power for operation. In our case, we will use about 6V of power. This can be obtained from switching a DC power supply to 6V or using 4 ‘AA’ batteries connected in series. We will then feed this voltage into pin 1 of the PIR module.
Pin 2 is the negative DC voltage or ground pin of the device. We connect the negative terminal of the power source to this pin, for a return path.
Pin 3 is the Output pin of the PIR module. This is where the output of the PIR will leave from. When motion is detected by the PIR, its output will go high to 3V. When no motion is detected, its output low and it gives off practically no voltage. When high you can see then how it can power the LED will we attach to this pin.
This sensor has a sensitivity range up to 20 feet (6 meters) and a 110° x 70° detection range, making it a wide lens detection sensor. This means it can measure 110° vertically (from top to bottom) and 70° horizontally (from left to right). The best way to check its sensitivity is when the circuit is built, try moving around through all of its angles. See at which angles it can detect your movement and at which angles it is not able to detect your movement, meaning your out of its angle scope. A lot of it is trial and error and experimenting. Once you know where it can and cannot detect, you can place it in an optimal place where it can detect in areas where you want it to.
Besides this sensor, we need an LED, which we will light when motion is detected.
You can use any arduino board. You will need a USB with a type A connector at one end and a type B connector at the other. The type A side connects to the computer you will be using and the type B plugs into the arduino USB slot. This way, we can program and upload software for the arduino board to follow.
Arduino Motion Sensor Light Circuit
The arduino motion sensor light circuit we will build is shown below:
For more detail: How to Build a Motion Sensor Light Circuit with an Arduino
JLCPCB – Prototype 10 PCBs for $2 + 2 days Lead Time
China’s Largest PCB Prototype Enterprise, 300,000+ Customers & 10,000+ Online Orders Per Day
Inside a huge PCB factory: https://www.youtube.com/watch?v=_XCznQFV-Mw