No video

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

  Рет қаралды 18,871

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.aliexp...
HC-SR501 PIR Module - s.click.aliexp...
Mini PIR Module - s.click.aliexp...
D203S PIR Element - s.click.aliexp...
Fresnel Lens - s.click.aliexp...
SYB-170 Mini Breadboard - s.click.aliexp...
Breadboard wires - s.click.aliexp...
Outdoor PIR switch - s.click.aliexp...
For more details check the article on my website:
www.tastetheco...
The code for the analog input plotter is available on GitHub:
github.com/bko...
Support my work on Patreon so I can continue producing free content and tutorials!
/ taste_the_code
My recording gear:
GT10 Pro 5G Android Phone - s.click.aliexp...
Dragon Touch 4K Action Camera - s.click.aliexp...
USB Condenser Microphone - s.click.aliexp...
Tripod - s.click.aliexp...
Phone tripod mount - s.click.aliexp...
Interfacing a bare PIR sensor with Arduino - can it be done?
#arduino #PIR #motion #sensor #tastethecode
Main Site and blog: www.tastetheco...
Facebook: / tastethecode
Instagram: / taste_the_code
Twitter: / taste_the_code
Get exclusive Taste The Code t-shirts and merch at
teespring.com/...
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....
--------------------------------------------------------------------
Music:
Relaxer by The Grand Affair
/ @grandaffair1446
www.youtube.co...

Пікірлер: 66
@luhanxmonat
@luhanxmonat 3 ай бұрын
Those are analog devices. For the same price, you can buy BS312 with digital output. Or the BS412 also has adjustable timing. You have to buy the lenses separately.
@TasteTheCode
@TasteTheCode 3 ай бұрын
Thanks, I'll look into them.
@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!
@hecanet
@hecanet 2 жыл бұрын
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 2 жыл бұрын
Yes I realized that and it's all controled based on the lens in front.
@antob3296
@antob3296 3 жыл бұрын
i love your honest.....
@TasteTheCode
@TasteTheCode 3 жыл бұрын
Thanks!
@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.
@aiviskri
@aiviskri 4 жыл бұрын
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 4 жыл бұрын
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. kzfaq.info/get/bejne/qKyDi9JoqqzOj4U.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
@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.
@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.
@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
@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.
@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.
@robotronix-co-il
@robotronix-co-il 4 жыл бұрын
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 4 жыл бұрын
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.
@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.
@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.
@fredcook2662
@fredcook2662 3 жыл бұрын
All pyroelectric materials are also piezoelectric, therefore mechanical vibrations (you pushing the desk) will also produce a signal.
@TasteTheCode
@TasteTheCode 3 жыл бұрын
Thanks for clarifying that. I wasn't aware of this so far.
@vaishakb7374
@vaishakb7374 3 жыл бұрын
How do I transfer the Data to the excel sheet ?
@TasteTheCode
@TasteTheCode 3 жыл бұрын
I have a video where I communicate with Google Sheets, you can check that out. kzfaq.info/get/bejne/l7GXp91kks3boo0.html&lc=UgwcpixN-YPupeKOvHd4AaABAg
@34562500
@34562500 3 жыл бұрын
my pir sensor not only sense me but it also sense any object why it is happening
@TasteTheCode
@TasteTheCode 3 жыл бұрын
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.
@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.
@jaimintopiwala5824
@jaimintopiwala5824 4 жыл бұрын
can we measure distance using PIR sensor??
@TasteTheCode
@TasteTheCode 4 жыл бұрын
Unfortunately no. To measure distance you either need infrared proximity sensor or ultrasonic range finder.
@_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.
@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.
@radindolarpasco9522
@radindolarpasco9522 Жыл бұрын
It can detect infrared radiation like body heat
@TasteTheCode
@TasteTheCode Жыл бұрын
Yes!
@TheArachnoBot
@TheArachnoBot 3 ай бұрын
use an amplifier my man
@TasteTheCode
@TasteTheCode 3 ай бұрын
Well we already know that using an amplifier works. Where's the fun in that?
@TheArachnoBot
@TheArachnoBot 3 ай бұрын
@@TasteTheCode It might work but how well? I would have loved to see the arduino plotter display the graph with an amplifier to see the sensitivity/range/field of view of the sensor. The modules are not really useful at all for that since the output is on/off.
@TasteTheCode
@TasteTheCode 3 ай бұрын
Yes, when these are in operation they just change state, you can't really plot the output as it will just flip on movement.
PIR Sensors And How To Use Them
21:01
Simple Electronics
Рет қаралды 26 М.
ОБЯЗАТЕЛЬНО СОВЕРШАЙТЕ ДОБРО!❤❤❤
00:45
Can This Bubble Save My Life? 😱
00:55
Topper Guild
Рет қаралды 37 МЛН
How PIR modules work and using them to control LED strings.
15:24
bigclivedotcom
Рет қаралды 324 М.
Lesson 17 HC-SR501 PIR Sensor
22:10
Ricardo Moreno
Рет қаралды 14 М.
#135 Radar Sensors / Switches: Comparison and Tests
16:11
Andreas Spiess
Рет қаралды 582 М.
PIR motion detector - HOW IT WORKS (easy to understand)
11:54
mrmattandmrchay
Рет қаралды 31 М.
Building a PIR Motion Sensor Circuit on a Breadboard
7:48
Quick Start Workbook
Рет қаралды 4,5 М.
RCWL-0516 Microwave Proximity Sensor - With & Without Arduino
35:33
DroneBot Workshop
Рет қаралды 290 М.
Motion Detector without PIR module! Analog circuit Explained
26:08
Electronic Wizard
Рет қаралды 7 М.