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

  Рет қаралды 19,601

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

Пікірлер: 44
@lesliefoster9027
@lesliefoster9027 3 ай бұрын
I've just found your channel. It's fantastic. Thank you for leaving the mistakes in.❤❤❤
@RachelDeBarrosLive
@RachelDeBarrosLive 3 ай бұрын
I'm glad you found the channel! I learn the most from my mistakes 🤣
@LordHolley
@LordHolley 3 ай бұрын
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!
@anubin7625
@anubin7625 3 ай бұрын
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 3 ай бұрын
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!
@CryptoRulz
@CryptoRulz 3 ай бұрын
This is great! Watching now. you and hackmakemod are my favorite channels!
@RachelDeBarrosLive
@RachelDeBarrosLive 3 ай бұрын
Thanks for watching! Let me know if you'd like to see a specific topic covered!
@scubaken89
@scubaken89 3 ай бұрын
Thanks for explaining things in an easy to understand way. I look forward to the rest of this series.
@RachelDeBarrosLive
@RachelDeBarrosLive 3 ай бұрын
Glad you enjoyed it! I'll be covering how to control servos, motors, and mp3 players soon!
@scubaken89
@scubaken89 3 ай бұрын
Have you ever used ESP32? With ESPNow?
@chvytom
@chvytom 3 ай бұрын
So smart and talented plus absolutely gorgeous ❤
@joeborovina4769
@joeborovina4769 3 ай бұрын
agreed!
@proyectostogo1462
@proyectostogo1462 3 ай бұрын
You are the best 🎉🎉
@RachelDeBarrosLive
@RachelDeBarrosLive 3 ай бұрын
Thanks! 🤩
@A_F_Innovate
@A_F_Innovate 3 ай бұрын
Love your attitude. And the way you presented the material. Keep up the good work.
@bwselectronic
@bwselectronic 3 ай бұрын
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.
@behemoth3562
@behemoth3562 3 ай бұрын
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 3 ай бұрын
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 3 ай бұрын
@@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!
@zk_6312
@zk_6312 2 ай бұрын
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.
@BattleForEden
@BattleForEden Ай бұрын
Wow! So cool! The world is coming aliiiiiiivvvveee
@kabandajamir9844
@kabandajamir9844 2 ай бұрын
The world's best Queen teacher thanks
@louiepauda6275
@louiepauda6275 3 ай бұрын
High! Hello, there! Hopefully, all is well! Love you intrest in electronics probably vary technical! Goodluck with all those components!
@JDude-uj3lk
@JDude-uj3lk Ай бұрын
Rachel, have you ever used hall effect sensors to control a dc motor for movement of a prop to a specific location?
@michaelgarcia5493
@michaelgarcia5493 2 ай бұрын
How that's awsome vid it sounds cool if only I new how to code 🤘🏽😃🤘🏽
@brucemilyko8549
@brucemilyko8549 2 ай бұрын
Just found your Chanel. It's Great! I'm curious, why aren't you using the latest Arduino IDE(2.3.2)?
@RachelDeBarrosLive
@RachelDeBarrosLive 2 ай бұрын
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 👍
@keneflucas937
@keneflucas937 Ай бұрын
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?
@SummersideDiver
@SummersideDiver 2 ай бұрын
Awesome presentation style. Informative and engaging way to do these tutorials. Thanks
@RachelDeBarrosLive
@RachelDeBarrosLive 2 ай бұрын
Glad you like them!
@pugxxxmugxxxfootfooot880
@pugxxxmugxxxfootfooot880 3 ай бұрын
you like to tinker and build things any chance you might build game camera and also maybe have it with wifi ability
@DBB-KE5DUO
@DBB-KE5DUO 3 ай бұрын
This stream is reminding me I have an acrylic protected motion detector porch light to finish! 😂😂🤣😢😢😭😭😭
@RachelDeBarrosLive
@RachelDeBarrosLive 3 ай бұрын
Noooo - not more projects!!! 🤣
@DBB-KE5DUO
@DBB-KE5DUO 3 ай бұрын
@@RachelDeBarrosLive - Yaaasss! I'll finish one of my many projects someday! 🤣😂🤣😂
@brianzimmer1632
@brianzimmer1632 3 ай бұрын
Gorgeous and Geeky! LOVE LOVE LOVE !!!!
@NewAcc02-ok5df
@NewAcc02-ok5df 27 күн бұрын
Can Arduino simulate keyboard presses? Say I want it to press Crtl+Alt+Delete when the PIR detects motion, is there a command for that?
@LonnonFoster
@LonnonFoster 3 ай бұрын
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 2 ай бұрын
Is there a way for the Motion Sensor / Arduino to play a mp3 file when it detects motion.
@RachelDeBarrosLive
@RachelDeBarrosLive 2 ай бұрын
It just so happens that I'm about to release another video on just that in about a week or 2! 🥳
@alzamamulhaque1613
@alzamamulhaque1613 3 ай бұрын
Please teach me, or help me I have a lot of projects that need some help from experts like you.
@shaunewing8973
@shaunewing8973 3 ай бұрын
your stunning . and great informative videos. 😄😍
@jimedgar6789
@jimedgar6789 3 ай бұрын
INTRUDER ALERT! Owld Skew
@GoatZilla
@GoatZilla 3 ай бұрын
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
Рет қаралды 74 М.
Motion-activated Sound Effects with Arduino, PIR Sensor & MP3 Player
25:26
Would you like a delicious big mooncake? #shorts#Mooncake #China #Chinesefood
00:30
Sprinting with More and More Money
00:29
MrBeast
Рет қаралды 146 МЛН
How to Wire Multiple LEDs: Series vs. Parallel LED Circuits
21:24
Rachel De Barros
Рет қаралды 38 М.
I tried the Cheapest Arduino Alternative (that Nobody heard of)
13:31
Cheap and easy motor for props
6:02
Brian Benson
Рет қаралды 11 М.
Make Posable, Movable, Articulating Joints for your PVC Props
36:33
Rachel De Barros
Рет қаралды 43 М.
Motion-activated Servo Motors with Arduino and PIR Sensor
25:20
Rachel De Barros
Рет қаралды 19 М.
Trigger DC Motor with PIR Sensor & Arduino - Complete Guide
35:29
Rachel De Barros
Рет қаралды 10 М.
Effective Ways To Detect People With Common Sensors
7:43
Core Electronics
Рет қаралды 54 М.
How to Control a 12V Motor with Arduino: Easy Wiring & Code Examples
44:13
ЭТОТ ЗАБЫТЫЙ ФЛАГМАН СИЛЬНО ПОДЕШЕВЕЛ! Стоит купить...
12:54
Thebox - о технике и гаджетах
Рет қаралды 148 М.
Mi primera placa con dios
0:12
Eyal mewing
Рет қаралды 550 М.