How to Use a PIR Motion Sensor with Raspberry Pi
ฝัง
- เผยแพร่เมื่อ 10 มิ.ย. 2019
- This raspberry pi tutorial shows how to use a PIR sensor on the raspberry pi model B+. It explains how to wire the sensor into a breadboard using the raspberry pi's GPIO pins. It then shows how to use python code to toggle a green LED on and off based on detected motion.
Playlist: • Raspberry Pi Tutorial ...
Parts Used:
PIR Sensor: www.amazon.ca/OSEPP-Passive-I...
Supply Kit (Everything you Need): www.amazon.ca/UNIROI-Breadboa...
Jumper Wires: amzn.to/2WxlSsx
Bread Board:amzn.to/2WuWzYd
LED: amzn.to/2MQ1u1J
Resistor: amzn.to/2XyUneF
Raspberry Pi B+: amzn.to/2Wt0QeR
◾◾◾◾◾
💻 Enroll in The Fundamentals of Programming w/ Python
tech-with-tim.teachable.com/p...
📸 Instagram: / tech_with_tim
🌎 Website techwithtim.net
📱 Twitter: / techwithtimm
⭐ Discord: / discord
📝 LinkedIn: / tim-rusci. .
📂 GitHub: github.com/techwithtim
🔊 Podcast: anchor.fm/tech-with-tim
💵 One-Time Donations: www.paypal.com/donate/?token=...
💰 Patreon: / techwithtim
◾◾◾◾◾◾
⚡ Please leave a LIKE and SUBSCRIBE for more content! ⚡
Tags:
- Tech With Tim
- Raspberry Pi Tutorial
- Raspberry pi motion sensor
- Pir sensor raspberry pi
#raspberrypi #rasberrypipython
Pick up a PIR Sensor here: th-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
this helped me with my school project. i made a motion sensor that says bruh out of a speaker when it detects motion
did u share this on your github account dude?
@@lizardking4944 bro this is simple to do
@@alex59292 this is none of your business bro
@@lizardking4944 the video shows the hardest part of his project all it is is simple code
One of the best videos you will find on Internet for PIR sensor
Awesome that you are using python for it
Great video! Very clear and well explained.
Thanks!
Really interesting and cool tutorial
This is the best explanation ever! Thank you soo muchhh!!!
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?
Thanks for this tutorial
Your tutorial is the best. Please do more of these
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.
very good tutorial
Thank you so much!!! God bless
Great tutorial. You're very clear and to the point. Thanks a ton.
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 :)
i like this method, can you link this to an lcd and let it display motion detected. thanks
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?
You need to connect batteries then
@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!
how can we add a speaker instead of an LED
Wow!! amazing explanation!! ..could you tell why did you use resistor instead of a jumper cable?
the resistor is there to make sure not too much current passes through the LED and explodes it.
The Resistor that you use is 100 Ohm ?
is the function "wait_for_motion()" a built in function from the Sensor import?
yeah, its a method of the MotionSensor Class
Hi! Do you know how to connect multiple PIR? Thanks
very nice tutorial, thx and god bless you and the world.. 來自香港的祝福, regards from hong kong ^_^
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
Can u use other models of rasberry pi and if yes what others?
Hi Tim can you make a video on how to use raspberry pi in order to detect the temperature and humidity
just use a SenseHAT ;)
thanks.
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?
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 😀
@@SprocketN thank you!
awesome👍
Is there a way to connect this to pi without the use of a breadboard?
Awesome
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?
good example
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?
yes, but you would need to use asyncio or threading to run both at once
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
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
Is there a way to display the time motion is detected
Do you think you do it with java?
Cause I don’t know python
Is a breadboard required for this?
Can I use this to turn some led lights on and off
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 😉😁
I knw I’m late but my sensor picks it up but doesn’t stop the led light. Pls reply
me too
same
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 👏
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
How are you screen recording?!?!
secret... ;)
@@TechWithTim reeeeeeee
Nice Video
But I have a doubt our LEDs Motion Detected but Motion Does Not Stopped
Hallo I get a montion startet sensor when I pulled of the sensor cable by accident. What could be the problem
How do I close the script properly?
Can I have the link of raspberry is that you are using
Search for raspberry pi 4 model b
I'm here to stop a freaking cat from pooping in our balcony.
Yeah just take out the resistor LOL
perhaps at this rate we will reach robotics and the study grew (by the way there is a lot of Python).
Why not Arduino
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
LEDs Motion Not Detect Exactly
Very good video but can you turn off the auto focus. Thank you :)
Why would I turn it off? Then you wouldn’t be able to see anything
@@TechWithTim I meant you may could do manuell focus so it doesnt swich all the time.
Ya no that would not be possible 😂 constantly spinning the wheel, no thanks
@@TechWithTim ok I understand. But still great video
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 :-)
What all things are included in the supply kit?
very nice tutorial, thx and god bless you and the world.. 來自香港的祝福, regards from hong kong ^_^
Can u use other models of rasberry pi and if yes what others?
Can u use other models of rasberry pi and if yes what others?
Can u use other models of rasberry pi and if yes what others?
Can u use other models of rasberry pi and if yes what others?
Yes, it will work with all Pi models.