How to Use a PIR Sensor with Arduino: Wiring & Code for Motion-activated Projects

  Переглядів 17,769

Rachel De Barros

Rachel De Barros

День тому

Dive into the exciting world of interactive projects with my beginner-friendly tutorial on how to use a PIR sensor with an Arduino! Whether you're looking to breathe life into your props, animatronics, or robot projects, this video is your perfect starting point. I break down the essentials of how to connect a PIR sensor to an Arduino, with clear and concise instructions on how to wire a PIR sensor to an Arduino so you get up and running without any hassle.
But I don't stop at just the basics; this tutorial also dives into practical PIR sensor and Arduino code examples, showing you step-by-step how to program your Arduino to respond to motion. From setting up your PIR sensor to writing your first lines of Arduino code, I've got you covered. By the end of this video, you'll have all the knowledge you need to add motion-activated elements to your projects, making them not only more interactive but also more captivating to your audience.
So, grab your Arduino and PIR sensor, and let's start making your projects move!
🔗 Full Tutorial: racheldebarros.com/pir-sensor...
🔗 Join the Engineering Artists Community: racheldebarros.com/community
🎬 Video Chapters: PIR Sensor with Arduino Wiring and Code Examples
0:00 Welcome
0:21 How Do PIR Sensors Work?
0:56 Parts of a PIR Sensor
1:42 PIR Sensor Pinout
2:04 Time Delay Adjustment Potentiometer
2:32 Sensitivity Adjustment Potentiometer
2:57 Trigger Mode Jumper
4:23 How to Wire a PIR Sensor to an Arduino
4:59 Reading the Current State of the PIR Sensor Arduino Code
8:56 Reading the State Change of the PIR Sensor Arduino Code
13:16 Control an LED with PIR Sensor Arduino Code (using current state)
14:46 Effect of Time Delay Adjustment on LED
15:20 Control LED Blink using PIR Sensor Current State
17:50 Control LED Blink using PIR Sensor on State Change
19:05 LED Animation: Arduino Code Example 1
22:45 LED Animation: Arduino Code Example 2
29:19 Wrap Up
29:55 Read the Full Tutorial
30:03 Join the Community
Build Your Own PIR Sensor and Arduino LED Motion-activated Circuit:
🛒 PIR Sensor: amzn.to/49CagWn
🛒 Arduino Uno: amzn.to/48jRlyr
🛒 Breadboard: amzn.to/42FZZGk
🛒 Jumper Wires: amzn.to/42K4kbv
🛒 LEDs: amzn.to/3SIhLV5
💬 Have any questions or want to share your own experiences, tips and advice about using PIR sensors with Arduino? Drop a comment below - I love hearing from you!
🔔 If you find this video helpful, please hit that like button 👍 and consider subscribing to my channel for more props/animatronics/robot tutorials, tips, and tricks. Your support helps me create more content like this!
Some links included here are to affiliate sites. If you purchase something through them, I may earn a small commission - which costs you nothing! I am very grateful for your support when you use my links to make a purchase.
#arduino #pirsensor #arduinotutorial #arduinocode #props #animatronics

КОМЕНТАРІ: 43
@lesliefoster9027
@lesliefoster9027 2 місяці тому
I've just found your channel. It's fantastic. Thank you for leaving the mistakes in.❤❤❤
@RachelDeBarrosLive
@RachelDeBarrosLive 2 місяці тому
I'm glad you found the channel! I learn the most from my mistakes 🤣
@scubaken89
@scubaken89 2 місяці тому
Thanks for explaining things in an easy to understand way. I look forward to the rest of this series.
@RachelDeBarrosLive
@RachelDeBarrosLive 2 місяці тому
Glad you enjoyed it! I'll be covering how to control servos, motors, and mp3 players soon!
@scubaken89
@scubaken89 2 місяці тому
Have you ever used ESP32? With ESPNow?
@LordHolley
@LordHolley 2 місяці тому
I love to tinker, so I bought one of those arduino project kits for my son and I to have fun with. It was such a pita to figure out. As a result, it's been collecting dust. You're really taking the mystery out of all of it, and I'm dusting it off and seeing what I can come up with right now. I'm so glad I stumbled across your channel. Thank you!
@CryptoRulz
@CryptoRulz 2 місяці тому
This is great! Watching now. you and hackmakemod are my favorite channels!
@RachelDeBarrosLive
@RachelDeBarrosLive 2 місяці тому
Thanks for watching! Let me know if you'd like to see a specific topic covered!
@anubin7625
@anubin7625 2 місяці тому
This is awesome, I am actually working on an animatronic that can use this. I'm just starting out on Arduino so this is very helpful!
@RachelDeBarrosLive
@RachelDeBarrosLive 2 місяці тому
Let me know how your animatronic project comes along! I'm doing an entire series on the PIR sensor to control servos, motors and even mp3 players!
@chvytom
@chvytom 2 місяці тому
So smart and talented plus absolutely gorgeous ❤
@joeborovina4769
@joeborovina4769 2 місяці тому
agreed!
@proyectostogo1462
@proyectostogo1462 2 місяці тому
You are the best 🎉🎉
@RachelDeBarrosLive
@RachelDeBarrosLive 2 місяці тому
Thanks! 🤩
@A_F_Innovate
@A_F_Innovate 2 місяці тому
Love your attitude. And the way you presented the material. Keep up the good work.
@BattleForEden
@BattleForEden 22 дні тому
Wow! So cool! The world is coming aliiiiiiivvvveee
@behemoth3562
@behemoth3562 2 місяці тому
Love the info and how you explain. Simple for me to understand. I’d also like to see how to make random blinking eyes on a prop/mask animatronic. I’ve seen it on instagram but no clear explanation on how they did it on a mask. Thank you 🙏
@RachelDeBarrosLive
@RachelDeBarrosLive 2 місяці тому
That's a great idea for a future tutorial! For the mask project, one thing you may want to check out is flickering LEDs. They come in red, green, yellow and a variety of different colors. No coding is needed. You just include a resistor and power them with a battery and they flicker randomly on their own. Of course you can program specific patterns with Arduino and trigger them with a PIR sensor too!
@behemoth3562
@behemoth3562 2 місяці тому
@@RachelDeBarrosLive that’s a cool idea too with blinking LeD’s! But to be more specific; sorry if I wasn’t clear 🙏: blinking eye lids where it looks like the character is shutting and opening eyes. I saw someone build it with a resin printed helmet shell to wear. Which I wonder how they stuck such small components to do that. Thank you so much again!
@bwselectronic
@bwselectronic 2 місяці тому
I've got several Arduinos and haven't taken the time to learn to program them. I think this might get me doing it. I like this video format. No intimidation.
@zk_6312
@zk_6312 Місяць тому
Great video. I have been having trouble with my PIR sensor. Either the LED stays on too long or off too long. I try some of your code to see what went wrong. I tried your code and it works better than anyone elses code. Great job. One thing though in your 3rd example, the one using the led, you forgot to setup the ledPin as OUTPUT. Not a big deal really, easy to fix, but I thought you might want to know.
@kabandajamir9844
@kabandajamir9844 Місяць тому
The world's best Queen teacher thanks
@SummersideDiver
@SummersideDiver Місяць тому
Awesome presentation style. Informative and engaging way to do these tutorials. Thanks
@RachelDeBarrosLive
@RachelDeBarrosLive Місяць тому
Glad you like them!
@louiepauda6275
@louiepauda6275 2 місяці тому
High! Hello, there! Hopefully, all is well! Love you intrest in electronics probably vary technical! Goodluck with all those components!
@michaelgarcia5493
@michaelgarcia5493 Місяць тому
How that's awsome vid it sounds cool if only I new how to code 🤘🏽😃🤘🏽
@JDude-uj3lk
@JDude-uj3lk 8 днів тому
Rachel, have you ever used hall effect sensors to control a dc motor for movement of a prop to a specific location?
@brucemilyko8549
@brucemilyko8549 Місяць тому
Just found your Chanel. It's Great! I'm curious, why aren't you using the latest Arduino IDE(2.3.2)?
@RachelDeBarrosLive
@RachelDeBarrosLive Місяць тому
The computer I live stream from isn't the one I usually use for coding so the IDE is waaay outdated. It's on my to-do list to update it so hopefully you'll see the latest one in future videos 👍
@DBB-KE5DUO
@DBB-KE5DUO 2 місяці тому
This stream is reminding me I have an acrylic protected motion detector porch light to finish! 😂😂🤣😢😢😭😭😭
@RachelDeBarrosLive
@RachelDeBarrosLive 2 місяці тому
Noooo - not more projects!!! 🤣
@DBB-KE5DUO
@DBB-KE5DUO 2 місяці тому
@@RachelDeBarrosLive - Yaaasss! I'll finish one of my many projects someday! 🤣😂🤣😂
@keneflucas937
@keneflucas937 13 днів тому
Hello. I was looking to purchase some of those motion sensors for smart home applications. In the description it says the manufacturer did not install a photodiode. A different one (but looks exactly the same) says photoresistor. Are they the same thing? How will i know if i need to install one? What are the necessary connections for integration?
@brianzimmer1632
@brianzimmer1632 2 місяці тому
Gorgeous and Geeky! LOVE LOVE LOVE !!!!
@pugxxxmugxxxfootfooot880
@pugxxxmugxxxfootfooot880 2 місяці тому
you like to tinker and build things any chance you might build game camera and also maybe have it with wifi ability
@LonnonFoster
@LonnonFoster 2 місяці тому
Great to see that I'm not the only one who does that cringe thing when the sketch is compiling. I'm all "no whammies, no whammies" every single time.
@Xhilong
@Xhilong Місяць тому
Is there a way for the Motion Sensor / Arduino to play a mp3 file when it detects motion.
@RachelDeBarrosLive
@RachelDeBarrosLive Місяць тому
It just so happens that I'm about to release another video on just that in about a week or 2! 🥳
@alzamamulhaque1613
@alzamamulhaque1613 2 місяці тому
Please teach me, or help me I have a lot of projects that need some help from experts like you.
@shaunewing8973
@shaunewing8973 2 місяці тому
your stunning . and great informative videos. 😄😍
@jimedgar6789
@jimedgar6789 2 місяці тому
INTRUDER ALERT! Owld Skew
@GoatZilla
@GoatZilla 2 місяці тому
lol kekeke. perhaps next step would be to switch to an ESP so u can go wireless. to start off, the most basic example would be to have the LED follow the inverse of the PIR GPIO. i.e. (pseudocode incoming) digitalWrite(ledPin, ~digitalRead(PIRPin)). That's because the PIR sensors will hold the line high for, what, a second or something, which is long enough to for an eyeball to see the LED, and you don't run into any of your issues. Less is more sometimes. second, you should just avoid delays. use rollover safe millis() math instead. Basically almost any time you use delay(), you're probably doing something wrong. This is an unfortunate deficiency in the Arduino ecosystem -- no notion of a "scheduler". But basically once you structure the code that way, it's easier to start doing stuff like your fade and other events.
How to Use Arduino Interrupts The Easy Way
33:28
Rachel De Barros
Переглядів 70 тис.
Motion-activated Servo Motors with Arduino and PIR Sensor
25:20
Rachel De Barros
Переглядів 16 тис.
Voloshyn - ЗУСИЛЛЯ (прем'єра треку 2024)
06:17
VOLOSHYN
Переглядів 520 тис.
Try these 16 Brilliant ESP32 projects!!!
11:18
ToP Projects Compilation
Переглядів 512 тис.
How to Wire Multiple LEDs: Series vs. Parallel LED Circuits
21:24
Rachel De Barros
Переглядів 31 тис.
Arduino Ultrasonic Motion Sensor: Motion Sensor and LED project
17:20
How to Control a 12V Motor with Arduino: Easy Wiring & Code Examples
44:13
Rachel De Barros
Переглядів 362 тис.
How to Use a PIR Motion Sensor with Raspberry Pi
12:24
Tech With Tim
Переглядів 109 тис.
Trigger DC Motor with PIR Sensor & Arduino - Complete Guide
35:29
Rachel De Barros
Переглядів 8 тис.
You can learn Arduino in 15 minutes.
16:34
Afrotechmods
Переглядів 9 млн
Wiring a Wiper Motor for Your Motorized Props!
26:54
Rachel De Barros
Переглядів 26 тис.
The Raspberry Pi Pico WAS Overrated! But that changed!
10:18
GreatScott!
Переглядів 582 тис.
Make Posable, Movable, Articulating Joints for your PVC Props
36:33
Rachel De Barros
Переглядів 41 тис.
Result of the portable iPhone electrical machine #hacks
1:01
KevKevKiwi
Переглядів 8 млн
Broken Flex Repair #technology #mobilerepair
0:50
ideal institute aligarh
Переглядів 1,3 млн
M4 iPad Pro Impressions: Well This is Awkward
12:51
Marques Brownlee
Переглядів 3,9 млн
НЕ ПОКУПАЙТЕ НОВЫЙ СМАРТФОН, ПОКА НЕ ВЫШЕЛ ЭТОТ [2024]
13:25
Thebox - о технике и гаджетах
Переглядів 73 тис.