Jump to content
Electronics-Lab.com Community

Search the Community

Showing results for tags 'pir sensor'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Electronics Forums
    • Projects Q/A
    • Datasheet/Parts requests
    • Electronic Projects Design/Ideas
    • Power Electronics
    • Service Manuals
    • Theory articles
    • Electronics chit chat
    • Microelectronics
    • Electronic Resources
  • Related to Electronics
    • Spice Simulation - PCB design
    • Inventive/New Ideas
    • Mechanical constructions/Hardware
    • Sell/Buy electronics - Job offer/requests
    • Components trade
    • High Voltage Stuff
    • Electronic Gadgets
  • General
    • Announcements
    • Feedback/Comments
    • General
  • Salvage Area

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 3 results

  1. Proximity sensing is a very common application in electronics. There are several ways to accomplish this. The most common way is by using a PIR sensor. PIR Sensor senses the change in ambient infrared radiation caused by warm bodies. I have already covered this in my Tutorial No. 5: "PIR Sensor Tutorial - With or Without Arduino". However, since PIR sensors detect movement from living objects, they can generate false alarms. These sensors are also inefficient in hot environments, as they rely on heat signatures. The other common methods of proximity sensing involve, using reflected ultrasonic or light beams. Using these sensors, the intruding object is detected by the reflected beam back to its source. The time delay between transmission and reception is measured to calculate the distance to the object. In this tutorial, we are going to look at another method of proximity sensing using "Microwaves" and "Doppler Effect". In my hand is an inexpensive RCWL-0516 Microwave Radar Motion Sensor. The RCWL-0516 microwave sensor detects "any movement" from "any object" and does not rely on heat, making it more reliable in hot environments. I am going to use this sensor to create a Geo-fence around my house to detect motion and get notifications. What is the Doppler effect? The RCWL-0516 module uses a “Doppler Radar” that makes use of the "Doppler Effect" to detect motion and trigger proximity alerts. So, before understand how the RCWL-0516 sensor works, let’s understand the Doppler Effect. The Doppler effect, is named after the Austrian physicist Christian Doppler, who described this phenomenon in 1842. He described the change in frequency observed by a stationary observer when the source of the frequency is moving. The sound's pitch is higher than the emitted frequency when the sound source approaches the observer as the sound waves are squeezed into shorter distance (bunched together), which can be heard as a higher pitch. The opposite happens when the object moves away from the observer, causing the sound waves to become lower in frequency and lower in pitch (spread out). As a result, the observer can hear a noticeable drop in the pitch as it passes. This holds true for all sorts of waves, such as water, light, radio, and sound. How Does The RCWL-0516 Works? Like the PIR Sensors, these sensors also detects only movements within their detection range. But instead of sniffing the blackbody radiation of a moving object, these sensors uses a “Microwave Doppler Radar” technique to detect a moving object. Doppler microwave detection devices transmit a continuous signal of low-energy microwave radiation at a target area and then analyze the reflected signal. The target’s velocity can be measured by analyzing how the target’s motion altered the frequency of the transmitted signal. Due to Dopplers effect, the frequency of reflected microwave signal is different from the transmitted signal when an object is moving towards or away from the sensor. When a car approaches a speed trap radar, the frequency of the returned signal is greater than the frequency of the transmitted signal, and when the car moves away, the frequency is lower. This is how a speed gun calculates the speed of the car. Technical Specifications The technical specifications of this sensor are listed below: Operating Voltage: 4-28V (typically 5V) Detection Distance: 5-7 Meters Maximum Current Drawn: ~ 2.7 mA Operating Frequency: ~ 3.18 GHz Transmission Power: 20 mW (typical)/30 mW (max) Signal length: ~ 2s Regulated Output: 3.3V, 100mA RCWL-0516 Module Pin outs The RCWL0516 module is a single breakout board with the following connections: 3V3 : it is the "output" from the onboard 3.3V regulator which can be used to power external circuits. Remember, this is not an input pin. This pin can provide up to 100mA of current. GND : is the ground pin. OUT : is the 3.3V TTL logic output. This pin goes HIGH for 2seconds when a motion is detected and goes LOW when no motion is detected. The output of this module is "analog" and can be connected to an analog input of a micro controller and sampled by an ADC. The output voltage is roughly proportional to the distance between the sensor and the object. VIN : provides power to the module. Connect this pin to an input voltage anywhere between 4 to 28V (however, 5V is commonly used). This module consumes less than 3mA of current so, you can easily power this by the 5V output from an Arduino or a Raspberry Pi. CDS : pins are where you attach an optional LDR (light dependent resistor) allowing it to operate only in the dark. You can connect the LDR to the sensor in two ways: * By using the two CDS pads on the top of the module. * Or by connecting one end of the LDR to the CDS pin at the terminal end, and the other end to the ground. We will cover this in the details in the demo section. Remember, this module comes without any connecting pins attached to it. What does CDS stand for? CDS stands for Cadmium Sulphide, which is the photoactive component in LDRs. Because of this, LDRs are sometimes called CDS photoresistors. The RCWL-9196 IC Unlike the PIR sensor, this is an active sensor (Active sensors send out a pulse of energy and detect the changes in the return signal). The module sends out microwaves signals actively at a frequency of about 3.18 GHz and measures the reflected signals. The heart of the module is a doppler radar controller IC "RCWL-9196". This IC is very similar to the BISS0001 IC found in the PIR sensors. The chip also supports "repeat triggers" and has a "360-degree detection area without blind spots". Microwave Antenna and RF Power Amplifier The MMBR941M RF amplifier is a high-speed NPN transistor "Q1" that takes low-power RF signal and boosts it to a higher power level. The antenna is integrated on the PCB. It has a detection range of approximately "7 Meters" while only consuming less than "3mA of current". When triggered, the output (OUT) pin will switches from LOW (0V) to HIGH (3.3V) for 2 to 3 seconds before returning to its idle (LOW) state. The transistor Q1 also acts as a mixer that combines the transmitted and received signal and outputs the difference which is filtered by the low pass filter formed by C9 and R8, and is amplified by the IC. Jumper Settings The module has 3 jumper settings at the back of it. The sensors default settings can be altered, by populating these jumpers with appropriate resistors and capacitors: C-TM : (Pulse length Adjustment) By installing a suitable SMD capacitor you can adjust the repeat trigger time by extending the output pulse length. Default trigger time is 2s. Increasing capacitor's capacity will make repeat trigger time longer. A 0.2µF capacitor extends the output pulse to 50s, while 1µF extends it to 250s. R-GN : (Detection Range Adjustment) By installing a suitable resistor you can reduce the detection range. The default detection range is 7m. If you install a 1M resistor the distance reduces to 5m, while a 270K resistor reduces it to 1.5m. R-CDS : (Light Sensitivity Adjustment) You can use this as an alternative to soldering the LDR. Any resistor between 47K – 100K will suffice. The lower the value, the brighter the light must be in order to disable the trigger. Demo Demo 1: Basic Setup This sensor is capable of working on its own even without a microcontroller. In my first example I am going to show you guys how useful it is on its own. The wiring is very simple, you just need to connect the sensor's VIN and GND to a power supply between 4-28V. Then connect a LED to the OUT pin via a 220Ω current limiting resistor. That’s it, as easy as that. Now, when the module senses motion, the red LED lights up for about two seconds when the OUT pin of the sensor goes “HIGH”. You can replace the LED with a relay module if you want to turn something ON/OFF based on motion. Demo 2: Connecting an LDR The setup is exactly same as the previous one with an addition of an LDR. As discussed earlier, you can either connect the LDR to the two CDS pads on the top of the sensor, or attach one leg of the LDR to the CDS pin at the bottom of the module and the other one to GND. LDRs don't have polarity, so they can be connected in any direction of your choice. When the LDR is exposed to light the resistance of the LDR decreases, and you will notice that the sensor produces no output. However, the sensor resumes normal operation once the room is darkened. This property of the sensor can be used in spotting intruders at night or controlling lights in a room. Demo 3: Connecting an Arduino While this module works well on its own, it also works well as a sensor when hooked up to a microcontroller or a microcomputer. In this example, I am going to light up an LED using an Arduino when the sensor senses a motion. Power the sensor from the 5v pin of the Arduino and connect the OUT pin to pin 2 of the Arduino. Now, connect an LED to pin no 3 of the Arduino via a 220Ω current limiting resistor. Upload the code and swipe your hand over the sensor. The red LED lights up and the serial monitor displays the message "Motion Detected" when the sensor detects a motion. Demo 4: Sending Motion Alerts Over RF or WiFi You can do all sorts of funky stuff using this sensor. You can attach this module to a nodeMCU or a NRF20L01 transceiver module or to a 433MHz RF transmitter/receiver module to send the detected motion information as a notification to a mobile device or save it in a database. Advantage and Disadvantages Advantages Very cheap and compact. The PCB itself is less than 4mm thick They can penetrate through walls and holes allowing them to have a wide detection range Radar signals can penetrate non-conductive materials such as plastic and wood allowing them to be hidden or protected from accidental damage These sensors can work perfectly behind 18mm thick pieces of pine wood, 50mm thick hardback book with no obvious reduction in sensitivity These sensors are safe. They put out very low levels of microwaves at 3.2GHz They are not effected by heat much and have better detection rate than traditional IR sensors They are incredibly sensitive to movement and can detect small movements very easily Disadvantages Since these sensors rely on a Doppler radar system, signal reflections from other nearby objects can interfere with the measurement, making it less reliable and accurate than other sensors These sensor and all its leads needs to be rigidly mounted. If the connecting leads are subject to movement or vibration, they will trigger the sensor These sensors don't work behind normal standard double glazing panels The reflections from metals can also influence the measurements They can be triggered by the wind You can use Aluminum foils to block the microwave signals from the sensor Uses Burglar alarm Intruder detection Smart security devices Human sensing toys Geofencing Halloween props Sensing people/animals through walls even without light Security and motion sensing light switches Thanks Thanks again for checking my post. I hope it helps you. If you want to support me subscribe to my YouTube Channel: https://www.youtube.com/user/tarantula3 Video: Visit Full Blog Post: Visit Code: Download Datasheet: Download Schema: Download Other Links: PIR Sensor Tutorial - With or Without Arduino: YouTube DIY Relay Module: YouTube All About nRF24L01 Modules: YouTube DIY - NodeMCU Development Board: YouTube Contactless Wireless Door Bell Using Arduino: YouTube Doppler Effect: Wikipedia Support My Work BTC: 1Hrr83W2zu2hmDcmYqZMhgPQ71oLj5b7v5 LTC: LPh69qxUqaHKYuFPJVJsNQjpBHWK7hZ9TZ DOGE: DEU2Wz3TK95119HMNZv2kpU7PkWbGNs9K3 ETH: 0xD64fb51C74E0206cB6702aB922C765c68B97dCD4 BAT: 0x9D9E77cA360b53cD89cc01dC37A5314C0113FFc3 LBC: bZ8ANEJFsd2MNFfpoxBhtFNPboh7PmD7M2 COS: bnb136ns6lfw4zs5hg4n85vdthaad7hq5m4gtkgf23 Memo: 572187879 BNB: 0xD64fb51C74E0206cB6702aB922C765c68B97dCD4 MATIC: 0xD64fb51C74E0206cB6702aB922C765c68B97dCD4 Thanks, ca gain in my next tutorial.
  2. Has this ever happened to you? You come back from a romantic dinner date and when you open the shutter door of your garage you realize that you left the garage light ON. You spent few hours outside with your partner to impress her and all the time this light bulb was on. You immediately turn around and look at her face to see a silent anger on her face. Alright, enough of that. So, in this tutorial, I am going to turn on and off the garage light using a PIR sensor. When the sensor detects a moving object, it turns on the light bulb and when the moving object is gone, it turns it off. Lastly, I am going to make sure that light bulb only turn on during the night time (when its dark). Step 1: Logic In this project, I will be using a PIR sensor along with an LDR to turn on or off a light bulb using a Relay. The things I need to consider before designing the circuit are: - The bulb should only turn on when the room is dark and when a motion is detected. - The bulb should turn off after 30 seconds of the object leaving the sensors proximity. - Most important, we need to place the LDR in a place where it doesn't turn off the bulb as soon as it lights up. Step 2: Hardware For this tutorial we need: A General Purpose PCB 2 x HC-SR501 PIR Sensor 2 x 1N4148 Small Signal Fast Switching Diodes 1 x 1N4007 High Voltage, High Current Rated Diode to protect the micro-controller from voltage spikes 1 x LDR 1 x 10K Trimmer Potentiometer 2 x 470 Ohms Resistor 1 x 10K Resistor 1 x 1K Resistor 1 x 2N3906 General Purpose PNP Transistor 1 x 2N2222 General Purpose NPN Transistor 1 x 5V Relay 1 x LED to display the status 5 x Terminal Blocks 1 x 220V to 5V Buck Step Down Module Few Connecting Cables And General Soldering Equipments Step 3: Assembly Lets first connect the LDR and setup the light detection bit. As we all know we need to setup a voltage divider to use the LDR in a circuit, so, I am adding this 10K POT and 470ohms resistor to setup the voltage divider bit. By adjusting the resistance of the POT we can adjust the intensity of sunlight at which this circuit will operate. Now, lets install the PIR sensor. Connect the VCC to +5v and GND to ground. Then connect the 1N4148 diode to the OUT of the sensor. In this circuit, I am installing just one sensor however in the actual project I have used 2 sensors to capture a bit more than 180 degrees. So, to avoid the sensors from back-feeding each other we need to install a diode to the OUT pin of each sensor. If you want to capture motion at 360 degrees you may need 3 to 4 sensor and diode pair to achieve that. Now that we have the PIR sensor and the LDR in place we need to add the 'AND' functionality. To achieve this I am adding a general purpose PNP transistor. When a motion is detected 'and' when the sunlight is at a certain intensity (adjusted by the POT) current flows out of the transistor. Next, we need to amplify the current received from the collector of the PNP transistor and turn on and off the LED indicator and the Relay. A general purpose NPN transistor is used to achieve this. That's it all done. Step 4: What Have I Have Made So, this is what I have made. On my board components are pretty much soldered everywhere, but you may like to have them nicely installed to give it a bit more cleaner look. OK, so lets check out how this works. Step 5: Demo Alright, I have placed the board on this table to do a quick test. I haven't hooked up a light bulb to the circuit yet. However, the LED indicator should serve the purpose of this demonstration. So, now I am going to turn off the light and make the room dark. Let's see if the sensor picks up motion and lights up the LED. Tada, it works. Now, lets turn on the light of the room and see if the LED indicator turns off or not. Yessss, that works. OK, finally just want to make sure that the light bulb turns off after 30 seconds of me moving out of the sensors proximity. Boom, and that concludes the project. I can now install it on the ceiling and make my partner happy. Instead of having 2 to 3 PIR sensors you can use one and install it at the corner of the wall. However, that will require a fair bit of wiring either inside the roof or on the ceiling, which will be way more expensive and tedious than installing 3 sensors an d putting the device in the middle of the room. You can also swap the Arduino with a NodeMCU board and do a remote data logging to log the time when the sensor detected motion or when the light went on to record when people entered your garage and how long they stayed in there. Step 6: Areas of Applications of PIR Sensors This setup can be used to: * Automate All Outdoor Lights * Automate Lights of Basement, Garden or Covered Parking Areas * Automate Lift Lobby or Common Staircases Lights * Automate bedside or night lamp * Create a Smart Home Automation & Security System and more.. Step 7: Thanks Thanks again for watching this video! I hope it helps you. If you want to support me, you can subscribe to my channel and watch my other videos. Thanks, ca again in my next video.
  3. Just before creating my next projects tutorial, which will be using a PIR sensor, I thought I might create a separate tutorial explaining the working of a PIR sensor. By doing that I will be able to keep my other tutorial short and to the point. So, without wasting time let’s discuss what is a PIR sensor and how we can use it in our project. Step 1: Basic What is a PIR sensor? PIR or "Passive Infra-Red" sensor is a "Pyroelectric IR Sensor" which generates energy when exposed to heat. Everything emits some low level of radiation, the hotter the object is, the more radiation is emitted. When a human or an animal (with IR radiation wavelength of 9.4µMeter) approaches the sensors range the sensor detects the heat in the form of infrared radiation. The sensor only detects the energy emitted by other objects and don't produce any, that's why the sensor is called a PIR or "Passive Infra-Red" sensor. These sensors are small, cheap, rugged, low-power and very easy to use. Step 2: Hardware For this tutorial we need: 1 x Breadboard 1 x Arduino Nano/UNO (Whatever is handy) 1 x PIR Sensor 1 x LED and a 220 ohm current limiting resistor to test the connectivity Few connecting cables A USB cable to upload the code to the Arduino & General Soldering Equipments Step 3: Architecture As we can see the sensor has two sides: 1. Top or the Sensor Side 2. Bottom or the Components Side The Top consist of a specially designed 'High-Density Polythene' cover called "Fresnel Lens". This lens focuses the infrared rays to the underlying 'Pyroelectric Sensor'. 9.4 µMeter infrared rays can easily pass through the polyethylene cover. The sensors sensitivity range between 6 to 7 meters (20 feet) and the detection angle is 110 degrees x 70 degrees. The actual sensor is inside a sealed metal can. The can basically protects the sensor from noise, temperature and humidity. There is a tiny window made of IR-transmissive material to allow the IR signals to reach the sensor. Behind this window are 'two' balanced PIR sensors. In idle state, both sensors detect the same amount of IR radiation. When a warm body passes by, it first intercepts one of the two sensors, causing a positive differential change between the two halves. And then, when it leaves the sensing area, the reverse happens, and the sensor generates a negative differential change. When the pulse changes or in other words the PIR sensor detects motion, the output pin changes to "digital high" or 3.3V. The bottom bit consists of a bunch of circuitry. Few of them are of our interest. - Most PIR sensors have 3-pins VCC, GND and OUT. VCC and GND are to power the module (Operating voltage: DC 5V to 20V). The OUTPUT pin is the one which communicates with the micro-controller by sending digital pulse high (3.3v) when a motion is detected and digital low (0v) when no motion is detected. The pin-outs may vary between modules so always triple-check the pin-outs. - The BISS0001 or the "Micro Power PIR Motion Detector IC" gets the output from the sensor and after doing some minor processing it produces the digital output. - The module has two potentiometers one to adjust the sensitivity (which is up to 7m) and the other to adjust the time for which the output signal should stay high when an object is detected (it ranges from 0.3s to 5 mins). - There are 3 more pins on this module with a jumper between them to select the trigger modes. > 1st one is called "non-repeatable trigger" - this one goes low as soon as the delay time is over. > 2nd one is called "repeatable trigger" - it stays high as long as the object is in the proximity and will turn off once the object is gone and the delay is over. I will be using this mode for this project. If you want to do a quick test before going ahead with this tutorial please follow the steps below. A testing is also a good idea to test the range and duration of sensing. Step 4: Connecting Without Arduino - Connect the VCC to the +5v rail of the breadboard - Connect the GND to the -ve rail - Connect the LED along with a 220 ohm resistor to the OUT pin of the sensor Now, when the sensor detects a motion, the output pin will go "high" and the LED will light up. Move back and forward to find out the sensing the range. Then to test the duration walk in front of the sensor and then walk away and use a stopwatch to find out how long the LED stayed on. You can adjust the time or sensitivity by adjusting the POTs on the board. Step 5: Connecting With Arduino Now, to do the same with Arduino connect the VCC of the PIR sensor to the 5v pin of Arduino. Then connect the OUTput pin to D13 and GND to the Ground pin of the Arduino. Now, connect the LED along with a 220 ohm resistor to the D2 pin of the Arduino. Thats it, now you just need to upload the code and test if everything works the way it should. You can replace the LED with a Buzzer (to raise an alarm when an object is detected) or a Relay to drive a high voltage circuit. To learn more about relays please have a look at my tutorial Number 4 - "Driving a Relay with an Arduino". https://www.instructables.com/id/Driving-a-Relay-W... Step 6: Code The code is very simple * Start by defining the pin number 2 and 13 as LED pin and PIR pin respectively * Then we need to define the pin modes. LED pin to be the OUTPUT pin and PIR pin to be the INPUT pin * Next we need to read the value of the PIR pin and see if it is HIGH * If the value is HIGH, then turn ON the LED otherwise turn it OFF Step 7: Areas of Application of PIR Sensors PIR sensors can be used to: * Automate Opening and Closing of Doors * Automate All Outdoor Lights * Automate Lights of Basement, Garden or Covered Parking Areas * Automate Lift Lobby or Common Staircases Lights * Detect Presence of Human and Raise an Alarm * Create a Smart Home Automation & Security System, and many more.... Step 8: Demo So, this is my setup for the testing of the PIR sensor. The sensor is hooked up to the breadboard and is sitting on the table. As I am in front of the sensor the LED is on. Now, lets do a quick test. Currently, the sensor is in its idle state. I am going to walk in front of the it to activate the sensor. Tada, the LED just turned on after detecting my presence. The light stays on as long as I am in the sensors proximity. OK, lets walk away and start my stop watch to see if it turns off after 5 seconds. Success, everything worked the way I wanted. Thanks again for watching this video! I hope it helps you. If you want to support me, you can subscribe to my channel and watch my other videos. Thanks, ca again in my next video.
  • Create New...