Interfacing a bare PIR sensor with Arduino - can it be done?

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

Taste The Code

Taste The Code

4 роки тому

In this video I'm exploring PIR sensor modules and if we can use the PIR element alone for cost-saving purposes in our Arduino projects. These sensors are often used in the detection of movement for alarm systems and automatic lights but the cost of the PIR element alone is significantly lower than the modules so if we use an Arduino, it makes sense to try and use the bare element instead.
Check out the video to see my findings and understand how you can use PIR sensors in your next project.
Tools and materials needed to make this project:
Arduino Uno - s.click.aliexpress.com/e/_d81...
HC-SR501 PIR Module - s.click.aliexpress.com/e/_dYE...
Mini PIR Module - s.click.aliexpress.com/e/_dZJ...
D203S PIR Element - s.click.aliexpress.com/e/_d73...
Fresnel Lens - s.click.aliexpress.com/e/_dVi...
SYB-170 Mini Breadboard - s.click.aliexpress.com/e/_d7b...
Breadboard wires - s.click.aliexpress.com/e/_dZA...
Outdoor PIR switch - s.click.aliexpress.com/e/_BfA...
For more details check the article on my website:
www.tastethecode.com/interfac...
The code for the analog input plotter is available on GitHub:
github.com/bkolicoski/arduino...
Support my work on Patreon so I can continue producing free content and tutorials!
/ taste_the_code
My recording gear:
Xiaomi Pocophone F1 - s.click.aliexpress.com/e/_sJbuxZ
SJ400 Action camera - s.click.aliexpress.com/e/_ssJRaL
USB Condenser Microphone - s.click.aliexpress.com/e/_sMcKML
Tripod - s.click.aliexpress.com/e/_stDAGL
Phone tripod mount - s.click.aliexpress.com/e/_s9WaiJ
Interfacing a bare PIR sensor with Arduino - can it be done?
#arduino #PIR #motion #sensor #tastethecode
Main Site and blog: www.tastethecode.com
Facebook: / tastethecode
Instagram: / taste_the_code
Twitter: / taste_the_code
Get exclusive Taste The Code t-shirts and merch at
teespring.com/taste-the-code
Click on the link below to get two months of free premium access to Skillshare and start learning today!
skl.sh/37LnRua
Get $50 off your order on hosting for all of your website needs and learning projects on Dreamhost!
www.dreamhost.com/r.cgi?24057...
--------------------------------------------------------------------
Music:
Relaxer by The Grand Affair
/ @grandaffair1446
ukposts.info...

КОМЕНТАРІ: 60
@antob3296
@antob3296 3 роки тому
i love your honest.....
@TasteTheCode
@TasteTheCode 3 роки тому
Thanks!
@bobcat6751
@bobcat6751 3 роки тому
What is you measure out of the bare PIR sensor? You mention between 720 and 820 at rest is the 700 mA. Lost like the output is actually less when trigger? Is that right. I am trying to figure out the out put of the bare PIR sensor in voltages.
@TasteTheCode
@TasteTheCode 3 роки тому
That is nether V nor A but the mapped digital value on the Arduino analog pin (0-1023). There is a very nice datasheet in a previous comment by "luca panjer" where you can see the actual voltage "wave" by the sensor once it is triggered. The actual voltage first goes up and then down by the same amount.
@techietony_test4150
@techietony_test4150 2 роки тому
I'd be curious what the light source is above you desk. Flourescent lights produce light at a high frequency that your eyes don't necessarily perceive, but that circuit might sense and the arduino could show you in your "scope", or maybe the ballast of the light source might produce nose at that frequency???
@TasteTheCode
@TasteTheCode 2 роки тому
It's an LED light bulb. Actually, two of them.
@hecanet
@hecanet Рік тому
The PIR sensor sensing Infrared signal, of which the human body heat is one good source. So, you don't really have to be in front of it... once there is body heat change, the sensor will detect it.
@TasteTheCode
@TasteTheCode Рік тому
Yes I realized that and it's all controled based on the lens in front.
@juraviking6379
@juraviking6379 2 роки тому
Output signal from PIR (peak to peak over DC) is in range 0.1mV to 1mV ; resolution of ADC of Arduino 3.3/1024 = 3 mV ; without amplifier arduino is not sensitive enough to detect a change; probably what you see is a 50Hz mains AC with wires acting like antenna
@TasteTheCode
@TasteTheCode 2 роки тому
Could be. Thanks for your input!
@vistalite1
@vistalite1 2 роки тому
Could the sensor be picking up the infrared heat coming off your hand, or the static electricity that's moving in the air as a result of your hand moving through the air?
@TasteTheCode
@TasteTheCode 2 роки тому
I think that it is the static that is being picked up.
@aiviskri
@aiviskri 3 роки тому
Interesting, I've got a similar sensor from a motion detecting light. When I connect it to an arduino, I see that it's outputing a very nice sine wave (my device's amplitude is from 350 to 720 on an arduino, or around 1.12V and 2.3V), with the period being about three to four seconds. When I wave my hand, the amplitude of one cycle seems to change, and then the sine wave goes back to normal. I have no idea why it's behaving like that.
@TasteTheCode
@TasteTheCode 3 роки тому
Yep that sounds very close to what mine does. Try putting a 47K resistor between source and ground and that should remove the sine wave so you get a more linear output. I did that in my hand-washing timer video. ukposts.info/have/v-deo/qnaEjKVufHybwIU.html
@LittlePetieWheat
@LittlePetieWheat 3 роки тому
See: www.makerguides.com/wp-content/uploads/2019/07/RE200B-Datasheet.pdf
@LittlePetieWheat
@LittlePetieWheat 3 роки тому
This works for me: const int n=10; int d[n]={0,0,0,0,0,0,0,0,0,0}; float avg=0.0; float lowest=0.0; float highest=0.0; int cnt=0; int i=0; float average() { int sum=0; for(i=0;i
@hafidamrouche8492
@hafidamrouche8492 Рік тому
hello bill i want to ask you .. are you sure about the links you put .. because i just bought 2 sensor and i am the only person who ordered in both sensors .. and two what is the distance of detection for the HC-SR501 PIR Module the seller didn't provide the information
@TasteTheCode
@TasteTheCode Рік тому
Hi, there. Yes, the sensors are the same no matter who the seller is. When selecting links I'm basically looking for sellers that can ship worldwide as some are limited to just a few countries. In terms of distance, it really depends on the size of the object (human, dog, cat, etc.) and the temperature difference of it in regards to the entire field of view. In general, it should be able to detect people within 7~8 meters.
@noanyobiseniss7462
@noanyobiseniss7462 Рік тому
Hi, I'd like to find a sensor to detect the bed on a 3d printer and wonder if this is a good candidate?
@TasteTheCode
@TasteTheCode Рік тому
Hmmm probably not. I don't own a 3D printer so I would not know to say for sure and it also depends on what you actually want to know about the printer bed?
@noanyobiseniss7462
@noanyobiseniss7462 Рік тому
@@TasteTheCode thx.
@robotronix-co-il
@robotronix-co-il 3 роки тому
you should have parallel resistor 4K7 vout to gnd and , vout to test point - series capacitor " like in AC mic " then connect the vout to scope , then retest and try again....you should also have an amp
@TasteTheCode
@TasteTheCode 3 роки тому
Yes, I found out that after making the video. however, my goal was to see if the sensor can be used without an op-amp.
@LittlePetieWheat
@LittlePetieWheat 3 роки тому
@@TasteTheCode A lot of the commercial 100 LED Solar PIR lights use a bare PIR sensor, along with an 8 pin micrro controller, that has an adc.
@LittlePetieWheat
@LittlePetieWheat 3 роки тому
Perhaps they apply a filter to the signal to remove "noise" e.g. playground.arduino.cc/Code/Filters/
@TasteTheCode
@TasteTheCode 3 роки тому
@@LittlePetieWheat The most common way I've seen is by using an opamp to boost the signal and then a microcontroller of some sort to catch the swing in voltage.
@1NATURELOVERJ
@1NATURELOVERJ 3 роки тому
Hello Bill. I am interested in having 5 PIR motion sensors made to trigger dslr cameras for camera trap systems. I would like them as small as possible to fit into a small waterproof case, and be powered by either 18650's or AA rechargeable batteries. Once they are triggered, I want it to continue to trigger the camera until there is no more motion present. Are you interested in building them for me? I am not able to create something like that with my hands. Jay
@TasteTheCode
@TasteTheCode 3 роки тому
Hey Jay, write me on Messenger on my Facebook page at facebook.com/tastethecode and we can talk about the details.
@fredcook2662
@fredcook2662 2 роки тому
All pyroelectric materials are also piezoelectric, therefore mechanical vibrations (you pushing the desk) will also produce a signal.
@TasteTheCode
@TasteTheCode 2 роки тому
Thanks for clarifying that. I wasn't aware of this so far.
@MMaheshThakur
@MMaheshThakur 3 роки тому
i want to controll my fan so that i turn off automatically when no body is in room. which sensor i should use,
@TasteTheCode
@TasteTheCode 3 роки тому
The bigger PIR module that I showed or a microwave motion sensor.
@MMaheshThakur
@MMaheshThakur 3 роки тому
@@TasteTheCode thanks I already bought one.
@TasteTheCode
@TasteTheCode 3 роки тому
For some reason my previous comments got deleted so I commented again so others can know what to look for.
@MMaheshThakur
@MMaheshThakur 3 роки тому
@@TasteTheCode oh.. this youtube helping whole world.
@Harry001by7
@Harry001by7 2 роки тому
Help me “HM 612 human sensor of 6 pin configuration” with pin notation and usability
@TasteTheCode
@TasteTheCode 2 роки тому
I don't own that one but there are plenty of tutorials out there for it.
@DimitriPappas
@DimitriPappas 2 роки тому
Can a bare PIR sensor be used with a Raspberry PI? Seems the analog signal is not supported, anyone know of any ways to work around this?
@TasteTheCode
@TasteTheCode 2 роки тому
You are better off by using a module. The bare signal is just too weak to be usefull.
@DimitriPappas
@DimitriPappas 2 роки тому
@@TasteTheCode Hmm Okay. Well in that case I'm just going to go with an outdoor/AC mains PIR sensor from a security floodlight, as I have a spare of those lying around too. My plan is to just link the switched AC output into a mobile-phone charger so I get DC 5V on the output which can be used as a logic on/off signal state for the raspberry pi. A bit of a hacky workaround but it should solve the problem ! :D
@jaimintopiwala5824
@jaimintopiwala5824 3 роки тому
can we measure distance using PIR sensor??
@TasteTheCode
@TasteTheCode 3 роки тому
Unfortunately no. To measure distance you either need infrared proximity sensor or ultrasonic range finder.
@vaishakb7374
@vaishakb7374 2 роки тому
How do I transfer the Data to the excel sheet ?
@TasteTheCode
@TasteTheCode 2 роки тому
I have a video where I communicate with Google Sheets, you can check that out. ukposts.info/have/v-deo/mXuYqLBqZJ2o040.html&lc=UgwcpixN-YPupeKOvHd4AaABAg
@34562500
@34562500 2 роки тому
my pir sensor not only sense me but it also sense any object why it is happening
@TasteTheCode
@TasteTheCode 2 роки тому
It depends on the distance and the thermal signature of the object. If it got a different temperature than ambient it will see it as change and if it is you that moves the object, then it is still detecting you and not the object.
@bhollywood01
@bhollywood01 2 роки тому
infrared heat maybe
@TasteTheCode
@TasteTheCode 2 роки тому
I don't think so. That is what the sensor was build to detect in the first place but with a visible path to the object emitting heat. When I covered it, it should no longer detect that heat.
@_Osman_Dag_
@_Osman_Dag_ 2 роки тому
Hello, I have a question, can you help ?
@TasteTheCode
@TasteTheCode 2 роки тому
I don't know... What's the question?
@_Osman_Dag_
@_Osman_Dag_ 2 роки тому
@@TasteTheCode About pir sensor with Arduino. As long as the obstacle is fixed in the PIR sensor, will the output led of the arduino be active ? Thank you .
@TasteTheCode
@TasteTheCode 2 роки тому
Nope, if an object is fixed, the PIR won't detect a change.
@radindolarpasco9522
@radindolarpasco9522 Рік тому
It can detect infrared radiation like body heat
@TasteTheCode
@TasteTheCode 8 місяців тому
Yes!
Sensors - which one to use
17:06
Electronoobs
Переглядів 1,3 млн
ТІНА КАРОЛЬ & SHUMEI - СТЕРВА ( ПРЕМ'ЄРА 2024)
03:20
Не покупай эти гиперзаряды 👎
00:36
Lesson 17 HC-SR501 PIR Sensor
22:10
Ricardo Moreno
Переглядів 14 тис.
The Cheapest Microcontroller? Getting started with the 10 cent Puya PY32.
21:36
Building a PIR Motion Sensor Circuit on a Breadboard
7:48
Quick Start Workbook
Переглядів 3,8 тис.
12 Useful & Interesting ESP32 Projects for Beginners!
9:41
ToP Projects Compilation
Переглядів 562 тис.
PIR Motion Sensor without IC & without Arduino | TRIK ID
4:29
TRIK ID Elektronika
Переглядів 229 тис.
PIR Motion Sensor with Arduino- Passive Infrared
8:44
BINARYUPDATES
Переглядів 85 тис.
Testing motion pir sensor is working or not
2:43
Yellow Purple
Переглядів 19 тис.
Solo se hace si lo crees posible💰🤯
0:20
Cash Vault💰
Переглядів 10 млн
Опасная пещера 😳
0:21
РАССКАЗЫ
Переглядів 3,5 млн
#ленивые голубцы
1:00
Всё по-домашнему 🍳🥞
Переглядів 1,7 млн