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

  Рет қаралды 21,276

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

Пікірлер: 46
@chvytom
@chvytom 4 ай бұрын
So smart and talented plus absolutely gorgeous ❤
@joeborovina4769
@joeborovina4769 4 ай бұрын
agreed!
@lesliefoster9027
@lesliefoster9027 4 ай бұрын
I've just found your channel. It's fantastic. Thank you for leaving the mistakes in.❤❤❤
@RachelDeBarrosLive
@RachelDeBarrosLive 4 ай бұрын
I'm glad you found the channel! I learn the most from my mistakes 🤣
@anubin7625
@anubin7625 4 ай бұрын
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 4 ай бұрын
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 4 ай бұрын
This is great! Watching now. you and hackmakemod are my favorite channels!
@RachelDeBarrosLive
@RachelDeBarrosLive 4 ай бұрын
Thanks for watching! Let me know if you'd like to see a specific topic covered!
@proyectostogo1462
@proyectostogo1462 4 ай бұрын
You are the best 🎉🎉
@RachelDeBarrosLive
@RachelDeBarrosLive 4 ай бұрын
Thanks! 🤩
@LordHolley
@LordHolley 4 ай бұрын
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!
@scubaken89
@scubaken89 4 ай бұрын
Thanks for explaining things in an easy to understand way. I look forward to the rest of this series.
@RachelDeBarrosLive
@RachelDeBarrosLive 4 ай бұрын
Glad you enjoyed it! I'll be covering how to control servos, motors, and mp3 players soon!
@scubaken89
@scubaken89 4 ай бұрын
Have you ever used ESP32? With ESPNow?
@A_F_Innovate
@A_F_Innovate 4 ай бұрын
Love your attitude. And the way you presented the material. Keep up the good work.
@jeremydobb4524
@jeremydobb4524 23 күн бұрын
Such an informative and easy to watch channel! Love it! Thanks for sharing!
@behemoth3562
@behemoth3562 4 ай бұрын
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 4 ай бұрын
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 4 ай бұрын
@@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 4 ай бұрын
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.
@kabandajamir9844
@kabandajamir9844 3 ай бұрын
The world's best Queen teacher thanks
@BattleForEden
@BattleForEden 2 ай бұрын
Wow! So cool! The world is coming aliiiiiiivvvveee
@louiepauda6275
@louiepauda6275 4 ай бұрын
High! Hello, there! Hopefully, all is well! Love you intrest in electronics probably vary technical! Goodluck with all those components!
@michaelgarcia5493
@michaelgarcia5493 3 ай бұрын
How that's awsome vid it sounds cool if only I new how to code 🤘🏽😃🤘🏽
@zk_6312
@zk_6312 3 ай бұрын
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.
@JDude-uj3lk
@JDude-uj3lk 2 ай бұрын
Rachel, have you ever used hall effect sensors to control a dc motor for movement of a prop to a specific location?
@donnadimitrova8268
@donnadimitrova8268 27 күн бұрын
Thank you for the great video! I have one question: What if I want the 3 second sound to repeat, if motion is still present? Meaning, if a person stays for longer than a few seconds the same sound bite loops. Right now, I see the option sensor is detecting that motion is still present, but the MP3 player automatically turns off after the 3 seconds of the sound bite as played.
@LonnonFoster
@LonnonFoster 4 ай бұрын
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.
@brianzimmer1632
@brianzimmer1632 4 ай бұрын
Gorgeous and Geeky! LOVE LOVE LOVE !!!!
@DBB-KE5DUO
@DBB-KE5DUO 4 ай бұрын
This stream is reminding me I have an acrylic protected motion detector porch light to finish! 😂😂🤣😢😢😭😭😭
@RachelDeBarrosLive
@RachelDeBarrosLive 4 ай бұрын
Noooo - not more projects!!! 🤣
@DBB-KE5DUO
@DBB-KE5DUO 4 ай бұрын
@@RachelDeBarrosLive - Yaaasss! I'll finish one of my many projects someday! 🤣😂🤣😂
@keneflucas937
@keneflucas937 2 ай бұрын
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 3 ай бұрын
Awesome presentation style. Informative and engaging way to do these tutorials. Thanks
@RachelDeBarrosLive
@RachelDeBarrosLive 3 ай бұрын
Glad you like them!
@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 👍
@NewAcc02-ok5df
@NewAcc02-ok5df Ай бұрын
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?
@pugxxxmugxxxfootfooot880
@pugxxxmugxxxfootfooot880 4 ай бұрын
you like to tinker and build things any chance you might build game camera and also maybe have it with wifi ability
@Xhilong
@Xhilong 3 ай бұрын
Is there a way for the Motion Sensor / Arduino to play a mp3 file when it detects motion.
@RachelDeBarrosLive
@RachelDeBarrosLive 3 ай бұрын
It just so happens that I'm about to release another video on just that in about a week or 2! 🥳
@alzamamulhaque1613
@alzamamulhaque1613 4 ай бұрын
Please teach me, or help me I have a lot of projects that need some help from experts like you.
@shaunewing8973
@shaunewing8973 4 ай бұрын
your stunning . and great informative videos. 😄😍
@jimedgar6789
@jimedgar6789 4 ай бұрын
INTRUDER ALERT! Owld Skew
@GoatZilla
@GoatZilla 4 ай бұрын
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
Рет қаралды 77 М.
Trigger DC Motor with PIR Sensor & Arduino - Complete Guide
35:29
Rachel De Barros
Рет қаралды 11 М.
Khóa ly biệt
01:00
Đào Nguyễn Ánh - Hữu Hưng
Рет қаралды 22 МЛН
Osman Kalyoncu Sonu Üzücü Saddest Videos Dream Engine 170 #shorts
00:27
Make Posable, Movable, Articulating Joints for your PVC Props
36:33
Rachel De Barros
Рет қаралды 46 М.
439 24GHz Radar Presence Detector that Works (LD2410)
13:19
Andreas Spiess
Рет қаралды 304 М.
Developing a Pick-and-Place Robotic Arm
6:35
Kai Nakamura
Рет қаралды 8 М.
Forget WiFi! This Wireless Method is WAY Better?
12:14
GreatScott!
Рет қаралды 482 М.
How to Control a 12V Motor with Arduino: Easy Wiring & Code Examples
44:13
Motion-activated Sound Effects with Arduino, PIR Sensor & MP3 Player
25:26
I tried the Cheapest Arduino Alternative (that Nobody heard of)
13:31
How to Use Millis to Master Arduino Multi-tasking
50:17
Rachel De Barros
Рет қаралды 48 М.
How PIR modules work and using them to control LED strings.
15:24
bigclivedotcom
Рет қаралды 323 М.
Мой инст: denkiselef. Как забрать телефон через экран.
0:54
Best mobile of all time💥🗿 [Troll Face]
0:24
Special SHNTY 2.0
Рет қаралды 2,2 МЛН
Как слушать музыку с помощью чека?
0:36
Игровой Комп с Авито за 4500р
1:00
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 1,8 МЛН
Blue Mobile 📲 Best For Long Audio Call 📞 💙
0:41
Tech Official
Рет қаралды 1 МЛН
В России ускорили интернет в 1000 раз
0:18
Короче, новости
Рет қаралды 1,3 МЛН