Gesture Activated LED Using PIR Sensor

by manomynus in Circuits > Arduino

115 Views, 0 Favorites, 0 Comments

Gesture Activated LED Using PIR Sensor

614548.jpg

Today we are creating a simple Arduino project that we can easily do which is a gesture activated LED using PIR sensor. This circuit is one of real world implementation which is start to be widely use in streetlight that has purpose to conserve energy because the light will only turn on when there is motion or in this case people walking by.

Supplies

1. Arduino Uno

2. PIR Sensor

3. LED

4. 220 Ω Resistor

5. Jumper Wires

6. Breadboard

7. USB 2.0 Cable Type A/B

Assembling the Circuit

messageImage_1700617634923.jpg
Uno.jpg

We can create the project by assembling it in website/software such as Tinkercad or physically.

Firs step is to assemble the circuit by placing the PIR sensor, LED, and resistor onto the Breadboard. Then we need to connect the pins from the Breadboard to Arduino Uno board, for the PIR sensor connect the signal to pin 2, VCC/power to pin 3.3v/5v, and connect the ground to GND pin. Alternatively if you are building the circuit physically, you should directly connect the pins to the Arduino uno using female to male jumper. Next is configuring the LED by placing it in different row between the anode(+) and cathode(-) on the Breadboard and connect the resistor leg on either row and on that same row connect a jumper wire to pin 13 and the other LED leg to GND pin.

It is important to adjust the potentiometer of the PIR sensor to modify the timing and sensitivity of the sensor when you are building the circuit physically.

Code

Screenshot 2023-12-05 184248.png

Next is writing the code so each component can interact and communicate. First step is assigning the state, val, and pins for the LED and the PIR sensor to the corresponding pin to the Arduino uno board.

State variable is use as a indicator whether the PIR sensor detect a motion or not (Low is when there is no motion and High is when there is motion). Val variable is use to change the on/off state of the LED which corresponds from the state variable.

In void setup, we need to configure what those pins function as either as an input or and output, in this case the input will be the PIR sensor and the output is an LED.

The void loop section is the main section where it will constantly read and react to change of state base on the sensor output. If the sensor transmit a signal of value High then the LED will turn on but otherwise the LED will be off.

All Done!

After we assemble all of the hardware and program side, the gesture activated led should be able to operate. We can adjust the duration of how long the LED will turn on continuously and then turn off by modifying the 'delay()' time.