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

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 เม.ย. 2020
  • 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
    th-cam.com/users/audiolibrary...
  • แนวปฏิบัติและการใช้ชีวิต

ความคิดเห็น • 60

  • @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 ปีที่แล้ว +1

      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.

  • @antob3296
    @antob3296 3 ปีที่แล้ว +1

    i love your honest.....

  • @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.

  • @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 ปีที่แล้ว +3

    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.

  • @aiviskri
    @aiviskri 4 ปีที่แล้ว +1

    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. th-cam.com/video/rFSXo7EFj_Q/w-d-xo.html

    • @LittlePetieWheat
      @LittlePetieWheat 3 ปีที่แล้ว +1

      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

  • @1NATURELOVERJ
    @1NATURELOVERJ 3 ปีที่แล้ว +1

    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.

  • @noanyobiseniss7462
    @noanyobiseniss7462 ปีที่แล้ว +1

    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  ปีที่แล้ว +1

      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 ปีที่แล้ว +1

      @@TasteTheCode thx.

  • @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.

  • @juraviking6379
    @juraviking6379 2 ปีที่แล้ว +3

    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 ปีที่แล้ว +1

      Could be. Thanks for your input!

  • @robotronix-co-il
    @robotronix-co-il 3 ปีที่แล้ว +2

    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.

  • @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.

  • @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 ปีที่แล้ว +1

      @@TasteTheCode thanks I already bought one.

    • @TasteTheCode
      @TasteTheCode  3 ปีที่แล้ว +1

      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.

  • @DimitriPappas
    @DimitriPappas 2 ปีที่แล้ว +1

    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 ปีที่แล้ว +1

      @@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. th-cam.com/video/aKgtz3-gwrY/w-d-xo.html&lc=UgwcpixN-YPupeKOvHd4AaABAg

  • @fredcook2662
    @fredcook2662 2 ปีที่แล้ว

    All pyroelectric materials are also piezoelectric, therefore mechanical vibrations (you pushing the desk) will also produce a signal.

    • @TasteTheCode
      @TasteTheCode  2 ปีที่แล้ว +2

      Thanks for clarifying that. I wasn't aware of this so far.

  • @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.

  • @_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