Connect a Relay and PIR Motion Sensor to an Arduino - Tutorial

Brainy-Bits

187 mil vistas61

    How to properly connect a Relay Module to turn on a light or other device when we detect motion. This is simple but good to know when playing with High Voltage devices (120V).
    Check out our tutorials page at : brainy-bits.com/tutorials/

    Publicado el Hace 4 años

    Comentarios

    1. Tezza 709

      What happens if your using an active low output trigger instead of an active high!!.

    2. Souvik Shaw

      where is the program code

    3. Joel Vale

      You don't need to use AC for the relay , I use DC motor or a light. Relays are just switches.

    4. Rvr ravuri

      I need circuit diagram and connections each part

      1. Andre Cutair

        This looks like it might be helpful >> www.instructables.com/id/Control-Light-Room-With-Arduino-and-PIR-Motion-Sen/

    5. Axel

      The circuit that you have is different from the one in the link, mine does not work?

    6. John Cote

      Why do you need the arduino? Can't you just connect the pir line directly to the relay?

    7. Chirag Bari

      How to connect 2 pir senser in 1 aurdiano

    8. Jonathan Fox

      This code doesn't work for me ! Did anyone else have problems?

      1. Edoardo Rossi

        yes code doesnt work crap engineer

    9. manasa unicept

      why negative terminal of the diode connected to VCC of Relay? can anyone please explain

    10. Chinmay Athavale

      Hello, Can we use LED and battery insted of Bulb/220V ? I am new bie to IOT and don'w want to mess up anythig :-)

      1. Laurens

        For sure!

    11. Mark Somerson Aguirre

      Thanks man

    12. Frode Molland

      Hi, got this easy connected thanks to this video and webpage, but I just wonder if its possible to have the light on al the time if there is movement, and not on and off? Got a light over my workbench, and I want the light to be on all the time when I'm working there, and off when I'm not there

    13. rutu bhuva

      hi my project is like ur project nd connection are same bt my project is not working can u plz give me a circuit diagram

    14. MondragonJones

      Thanks for the tutorial! Question, Does this PIR sensors apply to cars too? And can i make it wireless using some transmitter or something? Thanks in advance!

    15. Shreya Dr

      could you post a circuit diagram with symbols?

    16. Rob McCall

      Great tutorial that explains everything very well. One question (I am new to coding and Arduino) - how can I make the relay & light stay on for say. 15 minutes, without constantly having to move to trigger the sensor? I am using mine to turn on my desk lamp when I walk in the den, and I find myself every minute or so having to wave at the sensor to keep the light on - very annoying! Is there a simple line or two of code I could add to make the light stay on longer? Thanks in advance.

    17. Pintu Kumar

      my pir sensors always show relay is on

      1. Axel

        SAME SOMEONE PLZ HELPPPP

    18. Fun Bangla

      Where is program for this pir sensor

    19. Harshi Editz

      do you have IR Sensor switch with Arduino Tutorial?

    20. Harshi Editz

      sir i can use IR sensor with this code it will work?

    21. Julien Décarie

      I can’t see well the connection

      1. Dangelo Ramos

        Is the breadboard mandatory for this project or nah? Sorry im a beginner😅

      2. Julien Décarie

        Thx alot

      3. Brainy-Bits

        I make webpages with a wiring diagram and more information for most of my tutorial on my website brainy-bits.com you can find this specific one here: www.brainy-bits.com/how-to-connect-and-use-a-relay-module/ Hope that helps and thank you for watching!

    22. staglite

      I've used an LED strip instead of a light bulb, powered by a 12v 3a power supply. I've tried to change to delay so that the lights would stay on for 10 minutes but have had no luck with changing the delay time. Anyone know what I'm doing wrong? EDIT: Got this working. I'm using the Seeed/Grove Relay Shield and Seeed/Grove Relay. However I wouldn't call this a completed project just yet as I notice that my voltage regulator on the Arduino is getting super hot... up to 70c. I'm assuming this is above the safe limit for an Arduino. More work to be done.

    23. Jimmy Westra

      Do I need an arduino to run the relay to a small spool motor with a motion sensor? I need the cat door to open for the max time then close using a motor and open again from the othe side using a small spool motor to close. The code is of no use to me or the cat so I prefer it xcomputer no usb and power is ac 120v and whatever the small motor needs to run. The motor is a computer fan 5v?

    24. CLICK THAT MOMENT

      excuse me sir after watching your tutorial i have ordered all parts it is too expensive for me but when i upload your code it says some error plzz help error name is Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Uno" Sketch uses 2146 bytes (6%) of program storage space. Maximum is 32256 bytes. Global variables use 212 bytes (10%) of dynamic memory, leaving 1836 bytes for local variables. Maximum is 2048 bytes. avrdude: ser_open(): can't open device "\\.\COM1": The system cannot find the file specified. Problem uploading to board. See www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions. This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

      1. CLICK THAT MOMENT

        thanx it work but light doesnt turn of it turn off when it detect motion

      2. Brainy-Bits

        Hi, I believe you didn't select the right COM port. Go in the top menu under: Tools-->Port--> and select a serial port other than COM1. Hope that helps, thanks for watching btw.

    25. Robert Raduly

      Hello, nobody has talked/mentioned about the resistor, which is used on 5V pin goes to relay. Nobody noticed ?! How big is that? Thanks.

    26. wall of death

      can u show the circuit in proteus ? because in proteus relay only have 5 pins

    27. CTZN

      6:50 WHATS THAT SMOKE?

      1. ABB Anda Boleh Buat

        Not from circuit..maybe he's smoking during video shooting

      2. MΣΛПIПG

        MagicSmoke™

    28. CTZN

      Seeing that lamp wire exposed makes me sweating while watching this vid

    29. Subish Kanna

      Hello sir....I have a doubt..... I've done the same arrangement as u did....but except Arduino.... I've given the digital pin from pir sensor to the relay digital pin....and the switching is not happening....... I've tried an led in bread board.....in this case it is switching on and off the led....but when comes to relay it is not switching......what do I do sir? Thanx for the reply

    30. lav Senoj

      Did I see smoke at 6:54?

      1. pqpq

        i think it's just light from background

    31. imadieselassninja

      i need help!! i need to make a pir sensor open a closed valve and close an open valve at the same time when an objects detected and vise versa when the object has moved. any help would be so much appreciated

    32. Popa Ionut

      Hi friends i need a help i have something similar i want to use it with out arduino. basically i need it for a projector when apply 5 volt to it from motherboard this relay should start up the the 100watt power supply for the led

    33. francis samm

      man I needed that info

    34. one_shot_ kill

      plz, a relay with tv remote

    35. Laurant Ibrahimi

      How is it possible to light up when we offer our hand to light ??

    36. khaled yousef

      If you want to replace the sensor with the power switch. What changes in the code please?

    37. Mau1019 RD

      What if i want it incorporate this switch set up to a small motor that will activate it and it moves up and when then activate it to move down is it possible? Im sorry if im not explaining correctly what i mean but itd be a great help

    38. Jensen Ex

      how does your code even works ? no offense but when I type in the same thing you did I keep getting errors.

    39. Jan Geirnaert

      good stuff thanks

    40. Anup Mukherjee

      Its a simple Project, I done it. But I face a Problem. When Motion is detected it is ON but not continuation when someone is present in front of PIR .

    41. Shorash Ibrahim

      very very important to me !!!!

    42. Bobby Francisco

      hello! I am a newbie, is it possible to make a sunrise alarm with vibration using arduino and the alarm can be turned off using PIR sensor when the person is already awake? TIA

    43. ahamed abrar

      hi the video​ was amazing can u show me the circuit diagram if possible'​

    44. Joan Dimitrov

      Why was this diode used when connecting the +5V power supply to the +5V pin of relay?

      1. phoenix

        collapsing magnetic filed ==>induced current

    45. santanu mallick

      sir I have a question... if someone reading books in the room,there is no motion..so,in this situation will the light be offed after sometime??

    46. Dip

      can I use a "sound sensor" in place of PIR sensor with the same code?? pls reply!!

    47. GOTFOOK

      Hello, Could i buy the IR sensor with already built codes ? Im trying to avoid using programs to do this. can it be plug and play and adjusting sensitivity on the IR sensor instead ?

    48. Yudha Situmorang

      Sir, I have a question, can I connect wire V+ from resource to N.O. and comm to the lamp ? and pelase give reasons

    49. Rizwan Sagheer

      can i get the code of it here

    50. victor solomon

      how would you do a variation on this tutorial with a three-pronged plug?

    51. Francesco P.

      essels.info/video/video/faOmt4OctqO81ps.htmlm50s Something is burning!! x°D Thanks a lot for project :)

    52. Tyler Bloom

      He is creating a bomb, considering it is 120V live.

    53. David Saavedra

      how can I made, like when I pass from the sensor turned on and when I do that again turned off

    54. Omarsayan

      I believe your relay is active low, is it?

    55. kumala devi

      i need this coding..where can find this ?

    56. siddu cool

      sir, can u help me to use 12v DC motor instead of light bulb with relay by arduino.

      1. Brainy-Bits

        I guess it would be pretty much the same, but you would connect a 12V power supply leads instead of the 120V. Since it would be DC current, you would need to check the 12V wire connections to make the motor turn clockwise or anti-clockwise. Hope that helps, thanks for your comment and for watching!

    57. vineeth edukulla

      how to connect a 3 wired motor to a relay please reply asap

    58. A.D. A.M

      Can i use arduino 101 Insted of Uno

    59. John Elbert Mamonong

      How do i stay in on until i leave the pir motion coverage?

    60. Jsma Prep

      Could you provide a schematic if you were to install multiple PIR sensors?

      1. Jsma Prep

        Thank you!!