How to Use a PIR Motion Sensor with Raspberry Pi

Поділитися
Вставка
  • Опубліковано 29 вер 2024

КОМЕНТАРІ • 88

  • @TechWithTim
    @TechWithTim  5 років тому +4

    Pick up a PIR Sensor here: ua-cam.com/users/redirect?v=Tw0mG4YtsZk&event=video_description&redir_token=95KdJupB9A12BXjHC4NTc-fQL7h8MTU2MDQ2ODM3N0AxNTYwMzgxOTc3&q=https%3A%2F%2Fwww.amazon.ca%2FOSEPP-Passive-Infrared-Components-PIR-01%2Fdp%2FB01ISMW0TU%2Fref%3Dsr_1_14%3Fkeywords%3Draspberry%2Bpi%2Bpir%26qid%3D1560298881%26s%3Delectronics%26sr%3D1-14%26_encoding%3DUTF8%26tag%3Dtechwithtim08-20%26linkCode%3Dur2%26linkId%3D0888f8635ee901445b780beb7ca96088%26camp%3D15121%26creative%3D330641

  • @OnleySkyeAlt
    @OnleySkyeAlt 3 роки тому +46

    this helped me with my school project. i made a motion sensor that says bruh out of a speaker when it detects motion

    • @lizardking4944
      @lizardking4944 2 роки тому +1

      did u share this on your github account dude?

    • @alex59292
      @alex59292 Рік тому +1

      @@lizardking4944 bro this is simple to do

    • @lizardking4944
      @lizardking4944 Рік тому

      @@alex59292 this is none of your business bro

    • @alex59292
      @alex59292 Рік тому +1

      @@lizardking4944 the video shows the hardest part of his project all it is is simple code

  • @kyleanderson3633
    @kyleanderson3633 5 років тому +3

    Great video! Very clear and well explained.

  • @sahilhadke
    @sahilhadke 3 роки тому

    I'm here to stop a freaking cat from pooping in our balcony.

  • @budgetpresents802
    @budgetpresents802 4 роки тому

    Can u use other models of rasberry pi and if yes what others?

  • @nguyenmax277
    @nguyenmax277 4 роки тому +7

    how can we add a speaker instead of an LED

  • @julyapetrenchuk7866
    @julyapetrenchuk7866 5 років тому +12

    Awesome that you are using python for it

  • @wuyanchu
    @wuyanchu 9 місяців тому

    very nice tutorial, thx and god bless you and the world.. 來自香港的祝福, regards from hong kong ^_^

  • @crownz936
    @crownz936 4 роки тому +4

    I knw I’m late but my sensor picks it up but doesn’t stop the led light. Pls reply

  • @yourfavouritenuggetman
    @yourfavouritenuggetman 20 днів тому

    i copied the code exactly but my pi takes about 15 seconds to stop detecting motion, maybe it’s just because i have a very old pi and an old sensor but if there’s any solutions to this like better lighting or anything please reply, anyone.

  • @mrlevo27
    @mrlevo27 Рік тому

    Hallo I get a montion startet sensor when I pulled of the sensor cable by accident. What could be the problem

  • @AnkitaMalusare-nd8xv
    @AnkitaMalusare-nd8xv Рік тому

    Nice Video
    But I have a doubt our LEDs Motion Detected but Motion Does Not Stopped

  • @hoangquyla4516
    @hoangquyla4516 4 роки тому +2

    Hi Tim can you make a video on how to use raspberry pi in order to detect the temperature and humidity

  • @wuyanchu
    @wuyanchu 9 місяців тому

    very nice tutorial, thx and god bless you and the world.. 來自香港的祝福, regards from hong kong ^_^

  • @nickaf4204
    @nickaf4204 4 роки тому +2

    Is there a way to connect this to pi without the use of a breadboard?

  • @Duriel1000
    @Duriel1000 4 роки тому +4

    is the function "wait_for_motion()" a built in function from the Sensor import?

    • @Ghillis_Peyton
      @Ghillis_Peyton Рік тому +1

      yeah, its a method of the MotionSensor Class

  • @dimitardimitrov6936
    @dimitardimitrov6936 4 роки тому +2

    Thanks for the nice and understandable video! My question is (and maybe it's a good topic for your next video) how can I get information over internet about the pir status and/or history? i.e. "current status", "last time and date it was triggered", "count of the triggers over a period" , " where the pir status history is to be stored, and auto overwritten every 2 months (for example)", etc... The idea is to know the activity at home, when I'm faaaar far away. Is there a mobile app that you know will work?

  • @matiu7276
    @matiu7276 5 років тому +1

    Can you use regular phone charger that has 5V and 2A to power this raspberry? It's a fast charger too so it has 9V and 1.7A written in upper bar. I'm about to buy Raspberry 3 A+ so I don't want to destroy it too fast :)

  • @bshara83
    @bshara83 Рік тому

    Hello, could you help me write code for bi-deractional people counter using 2 sensors where when objects pass first then the second sensor will count+1, or the second then the first sensor will count -1. And record the In and Out and current occupies the room to SQL DB, please 👏

  • @ProgrammerSheep
    @ProgrammerSheep 5 років тому +3

    Yeah just take out the resistor LOL

  • @brentrusche2056
    @brentrusche2056 9 місяців тому

    @TechWithTim
    Great tutorial. I too want to make a surveillance system using an RPi and multiple PIR sensors. However, I am not quite certain as to the wiring and code for using multiple PIR sensors. I would really appreciate an expanded tutorial on using multiple PIR sensors on a single RPi.
    Thanks in advance!

  • @budgetpresents802
    @budgetpresents802 4 роки тому +1

    Can u use other models of rasberry pi and if yes what others?

  • @jungleviper
    @jungleviper Рік тому

    Can I use this to turn some led lights on and off

  • @loicsigni1613
    @loicsigni1613 3 роки тому +1

    Great video. I wanna use the same PIR sensor for this small door greeting robot I'm building,. My question is:
    If I program the Raspberry Pi and disconnect it from my computer would it still work as long as I am feeding it with electrical power?

    • @seth8811
      @seth8811 3 роки тому

      You need to connect batteries then

  • @bernielovell2197
    @bernielovell2197 3 роки тому

    I bought a power trigger water spray hoping to detect the crapping cat who visits my garden. It worked fine with a cheap air-freshener detector but, to was so weak that I really needed a PIR sensor. This was much more difficult to make work. It either never worked or It worked with no stopping. How about making one on this problem?

  • @MohsinKhan-rv7jj
    @MohsinKhan-rv7jj 3 роки тому +1

    One of the best videos you will find on Internet for PIR sensor

  • @AnkitaMalusare-nd8xv
    @AnkitaMalusare-nd8xv Рік тому

    LEDs Motion Not Detect Exactly

  • @James-sh1lw
    @James-sh1lw 3 роки тому +1

    Hey Tim I know this video is kinda old now but hopefully you're checking comments. Do you think this will be ok opposite my window? I'm building a magic mirror with my raspberry pi and an LED monitor but dont want the monitor constantly running, so I want it to turn on with motion detection. From the angle it wont see anything moving outside but the sun moving around during the day does changed the light levels in the room. What do you reckon? Do you also know how to turn on/off the HDMI port with a motion sensor?

    • @SprocketN
      @SprocketN 3 роки тому +1

      I believe the detector can’t ‘see’ through glass, so it shouldn’t detect anything moving outside.
      They’re not expensive so buy one and try it 😀

    • @James-sh1lw
      @James-sh1lw 3 роки тому

      @@SprocketN thank you!

  • @chrismunson5513
    @chrismunson5513 3 роки тому

    I want to run this exact setup, but have it with a photo slideshow, so it will only play when someone is present? Anyone with exp please help. Brand new to pi OS and lineage. First project with pi zero

  • @raidsagr3263
    @raidsagr3263 4 роки тому +1

    How can i programme this to find out the total duration of the light was turned on the last 6hrs for example?
    Thank you very much

    • @grog8164
      @grog8164 4 роки тому +1

      the light is on during motion detected until motion stop so you could basically have a top variable `light_on_duration_sec` in which you add the time elapse between motion detected until motion stop. Your `light_on_duration_sec` is your only critical data so either you count on your pie to stay alive during the day either your persist the information on the disc. For your "on the last 6hrs" then it's up to you to program it using your pie datetime and `ìf` condition

  • @SuperAn0nymus
    @SuperAn0nymus 3 роки тому +1

    Wow!! amazing explanation!! ..could you tell why did you use resistor instead of a jumper cable?

    • @krypton1142
      @krypton1142 2 роки тому

      the resistor is there to make sure not too much current passes through the LED and explodes it.

  • @patrykperwenis4348
    @patrykperwenis4348 2 роки тому +1

    very good tutorial

  • @darrenstorey4558
    @darrenstorey4558 4 роки тому

    With the pi4 having a 5v output, using this tutorial as an example, is it possible for it to power an LED strip instead of an LED bulb? I am wanting to use the PIR in a magic mirror where whenever someone stands in front of the mirror, the PIR triggers and lights up the LED strips to act as a mood light around the mirror itself. ps I am a total NOOB so any help is much appreciated

  • @cosming940
    @cosming940 5 років тому +1

    The Resistor that you use is 100 Ohm ?

  • @Enigmaafk
    @Enigmaafk 3 роки тому

    i like this method, can you link this to an lcd and let it display motion detected. thanks

  • @jhred3315
    @jhred3315 2 роки тому

    Hey Tim. I really like your tutorials. Can you make more about raspberry pi since yours are most easy to understand especially the plugging part.

  • @Randy2747
    @Randy2747 4 роки тому

    Could you please help me out and make a code that I can use the relay, PIR, and raspberry pi but have the light (or anything else that is plugged in to the relays) set on a timer? I woukd like to put lasers in my game room and when someone walks into the room the lasers will be by the ceiling and come on for a duration of the time I set. Could you please help me out and either make a video of the timer added or post the code here? Please 😉😁

  • @bigbad123321
    @bigbad123321 Рік тому

    I've got a question. Can you run this while simultaneously running a temperature reading with a temp sensor and get the programme to print out both "motion detected/motion stopped" and also have it printing the temperature every X amount of seconds aswell?

    • @Ghillis_Peyton
      @Ghillis_Peyton Рік тому

      yes, but you would need to use asyncio or threading to run both at once

  • @rishivinukonda
    @rishivinukonda 4 роки тому

    Do you think you do it with java?
    Cause I don’t know python

  • @budgetpresents802
    @budgetpresents802 4 роки тому

    Can u use other models of rasberry pi and if yes what others?

  • @budgetpresents802
    @budgetpresents802 4 роки тому

    Can u use other models of rasberry pi and if yes what others?

  • @Beeckey
    @Beeckey 2 роки тому

    This is the best explanation ever! Thank you soo muchhh!!!

  • @agyeirichmondowusu9670
    @agyeirichmondowusu9670 6 місяців тому

    Your tutorial is the best. Please do more of these

  • @itzkeyz2526
    @itzkeyz2526 3 роки тому

    Is there a way to display the time motion is detected

  • @ProgrammerSheep
    @ProgrammerSheep 5 років тому +1

    How are you screen recording?!?!

  • @katefernandez240
    @katefernandez240 4 роки тому

    Hi! Do you know how to connect multiple PIR? Thanks

  • @ayy.mp4
    @ayy.mp4 3 роки тому

    How do I close the script properly?

  • @sainco3036
    @sainco3036 5 років тому

    perhaps at this rate we will reach robotics and the study grew (by the way there is a lot of Python).

  • @funkygetaways
    @funkygetaways 3 роки тому

    Is a breadboard required for this?

  • @brighterryu2465
    @brighterryu2465 2 роки тому

    good example

  • @dharmareddy3636
    @dharmareddy3636 4 роки тому

    Can I have the link of raspberry is that you are using

    • @anghel332
      @anghel332 4 роки тому

      Search for raspberry pi 4 model b

  • @--Jonathan09--
    @--Jonathan09-- 2 роки тому

    awesome👍

  • @ernestoloredo2618
    @ernestoloredo2618 4 роки тому

    Thank you so much!!! God bless

  • @YouKnowMeDuh
    @YouKnowMeDuh 3 роки тому +1

    Great tutorial. You're very clear and to the point. Thanks a ton.

  • @motzs1016
    @motzs1016 5 років тому

    Thanks for this tutorial

  • @mandeepubhi4744
    @mandeepubhi4744 5 років тому

    Awesome

  • @sainco3036
    @sainco3036 5 років тому

    thanks.

  • @PhilinQQ
    @PhilinQQ 5 років тому

    Really interesting and cool tutorial

  • @budgetpresents802
    @budgetpresents802 4 роки тому +1

    Can u use other models of rasberry pi and if yes what others?

    • @SprocketN
      @SprocketN 3 роки тому +1

      Yes, it will work with all Pi models.

  • @Randy2747
    @Randy2747 4 роки тому +1

    this was a FAIL for me..I figured i would try my first script with my new raspberry pi 3 and i got a error cannot import name 'led' from gpiozero...why?
    Edited..I figured it out.......I didnt have capital letter :-)

    • @sm-vr6kn
      @sm-vr6kn 2 роки тому

      What all things are included in the supply kit?

  • @ProgrammerSheep
    @ProgrammerSheep 5 років тому

    Why not Arduino

    • @abhichoudhary4518
      @abhichoudhary4518 3 роки тому +2

      Arduino can be used for this project, and in my opinion, would be faster, but this video can be for someone who doesn't have an Arduino, or if someone wants to incorporate a PIR sensor in their Raspberry pi project but don't know how to

  • @heinzbeckenbauer243
    @heinzbeckenbauer243 5 років тому +2

    Very good video but can you turn off the auto focus. Thank you :)

    • @TechWithTim
      @TechWithTim  5 років тому +3

      Why would I turn it off? Then you wouldn’t be able to see anything

    • @heinzbeckenbauer243
      @heinzbeckenbauer243 5 років тому

      @@TechWithTim I meant you may could do manuell focus so it doesnt swich all the time.

    • @TechWithTim
      @TechWithTim  5 років тому +2

      Ya no that would not be possible 😂 constantly spinning the wheel, no thanks

    • @heinzbeckenbauer243
      @heinzbeckenbauer243 5 років тому

      @@TechWithTim ok I understand. But still great video