blog

Four main types of motion sensors: ①PIR Sensor②ultrasonic sensor③microwave sensor④Capacitive Sensor

3311

Definition of Motion Sensor

A human body sensing module is a device that can automatically detect human presence, movement or proximity, convert these physical signals into electrical signals (such as high/low level signals, switch signals, etc.), and trigger subsequent control actions (such as turning on lights, activating alarms or starting devices).

Types of motion sensors

Human body sensing modules can be divided into several major types:
① Infrared sensing modules
② Microwave radar sensing modules
③ Ultrasonic sensing modules
④ Capacitive sensing modules

① Infrared motion sensors are classified into several categories: PIR sensors, active infrared sensors, and infrared thermal imaging motion sensors.

② Microwave radar sensing modules are primarily classified by frequency, which affects the module’s penetration capability, detection range, and anti-interference performance. Common frequency classifications include: 2.4G, 5.8G, 10G/24G, and 77G/79GHz.

③ Ultrasonic sensing modules are mainly categorized by operation mode: single-probe reflective type, dual-probe through-beam type, and multi-probe array type.

④ Capacitive sensing modules are classified by:

1.Detection method: contact capacitive sensing, non-contact near-field sensing

2.Sensitivity: static capacitance detection, dynamic capacitance detection

What is a PIR sensor?

PIR sensor definition: It determines whether an object is moving by detecting the infrared rays emitted by the object. The human body maintains a constant temperature and therefore continuously emits infrared radiation at specific wavelengths. When a person moves, the intensity of infrared radiation received by the sensor changes, thereby enabling the detection of object movement.

What is a microwave radar sensor?

microwave sensor workingprinciple: It detects objects by emitting microwave signals and receiving reflected waves. When an object moves, the frequency of the reflected wave produces a Doppler shift. By analyzing the frequency shift changes, it determines the object’s motion state, distance and speed, with strong penetration capability and no influence from temperature.

What is a ultrasonic sensor?

Principle of Ultrasonic Sensor: It detects objects by emitting ultrasonic waves and receiving echoes. When an object moves, the time difference or frequency of the echo changes, enabling determination of the object’s distance and motion state. Suitable for short-range detection but vulnerable to environmental noise interference.

What is a Capacitive Sensor?

Principle of capacitive sensor: It operates by detecting changes in the electric field caused by the proximity of a human body or object. When a target approaches, the capacitance value of the sensor’s electrode changes, thereby triggering a signal. It can detect stationary objects but is sensitive to environmental humidity.

Comparison of Various Types of Sensor

Human Detection Module Comparison Table
Feature Infrared (PIR) Microwave Radar Ultrasonic Capacitive
Detection Range Medium (5-10m) Long (10m+) Medium-Short Very Short
Static Detection Not Supported Supported Supported Supported
Penetration Ability Weak Strong Medium None
Environmental Adaptability Sensitive to Temperature Strong Sensitive to Noise Sensitive to Humidity
Cost Low High Medium Low
Power Consumption Low Medium-High Medium Very Low

Schematics of Various Sensors

PIR sensor: The classic ones include the HC-SR series.
HC-SR501 Schematics:

HC-SR501_Schematics

HC-SR505 Schematics:

HC-SR505_Schematics

Microwave radar sensor: Schematic diagram of RCWL-0515

RCWL-0515_Schematics

Ultrasonic sensor: HC-SR04

Schematic diagram of RCWL_0515

Schematic diagram of capacitive sensor:

Schematic diagram of capacitive sensor

motion sensors pinout

pir sensor pinout

HC-SR501 pinout:

HC SR501 PINTOUT

HC-SR505 pinout:

HC-SR505 pinout

ultrasonic sensor pinout

RCWL-0515 pinout:

HC-SR04 PINOUT

microwave sensor pinout

HC-SR04 pinout:

HC-SR04 pinout

Capacitive Sensor pinout:

a46c164b617627732e7136fae835029d

The uses of motion sensors

Motion sensors are mainly used in daily life and industry. For example, elevator doors use active infrared sensors to detect and determine if there is a person. Secondly, they can be used in combination with systems such as smart homes through selection. They can also be applied to motion sensor alarms, or linked with cameras to start recording after detection and recognition, forming a complete security system.

Electrical parameters of motion sensors

Electrical parameters of PIR sensor​

HC-SR501 and HC-SR505 are PIR sensors that operate by receiving infrared rays emitted by objects and are affected by temperature. They are low in price and high in cost performance, and can only output analog signals. They have a good detection range and are widely used in the field of human body induction.

Electrical parameters of HC-SR501:

Parameter NameParameter Value
Operating VoltageDC 4.5-20V
Quiescent Current<50uA
Output LevelHigh 3.3V / Low 0V
Trigger ModeNon-repeatable trigger / Repeat trigger (default)
Lockout Time2.5s (default), adjustable range from fractions of a second to tens of seconds
Operating Temperature-15~70°C

Electrical parameters of HC-SR505:

Sensor Specifications
Operating Voltage DC 4.5-20V
Quiescent Current <50uA
Output Level High: 3.3V / Low: 0V
Trigger Method Non-repeatable trigger / H-repeat trigger (default)
Blocking Time 2.5s (default), customizable from 0.x seconds to tens of seconds
Operating Temperature -15~70°C

PIR Sensor Datasheet

Electrical parameters of ultrasonic sensor

RCWL-0516 is a microwave sensor module. It detects the movement of objects based on the Doppler radar principle and is greatly interfered by metal objects. This module is low in price and low in power consumption, can output digital signals, and has a stable detection distance of 5-7 meters. It is widely used in the fields of human body induction and intelligent lighting.

Electrical parameters of RCWL-0515

Operating VoltageMin=4V, Max=28V
Operating CurrentTyp=2.8mA, Max=3mA
Microwave Sensor RangeMin=5M, Typ=7M, Max=9M
Transmission PowerTyp=20mW, Max=30mW
Output VoltageMin=3.2V, Typ=3.2V, Max=3.4V
Output Drive CapabilityTyp=100mA
Trigger MethodRepeat Trigger
Output Control Low LevelTyp=0V
Output Control High LevelTyp=3.2V
Operating TemperatureMin=-20℃, Max=80℃
Storage TemperatureMin=-40℃, Max=100℃

Electrical parameters of microwave sensor

HC-SR04 is an ultrasonic sensor. It measures distance by transmitting and receiving ultrasonic waves, and is affected by environmental noise and air temperature. This sensor is moderately priced with good cost performance and can output digital signals. It has a reliable detection range and is widely used in the fields of distance measurement and obstacle avoidance.

Electrical parameters of HC-SR04

 

ParameterSpecification
Operating VoltageDC 5V
Operating Current15mA
Operating Frequency40kHz
Ultrasonic Sensor Range2cm-10m
Measuring Angle15 degrees
Input Trigger Signal10uS TTL pulse
Output Echo SignalOutput TTL level signal, proportional to the range

Electrical parameters of Capacitive Sensor

Capacitive sensors detect the presence of conductors in their surroundings through capacitance. When a conductor is present, the capacitance value between the internal electrodes of the sensor changes, thereby detecting the presence of the conductor. These sensors are moderately priced and are mainly used for detecting metals or as inductive switches and proximity switches. They generally only output analog signals and have a relatively low detection range, such as the induction part of automatic bathroom faucets.

There are many types of capacitive sensors, and different types are selected according to different needs. The operating voltage is generally 5V, 12V (more common) or higher. The measurement angles are divided into shielded and unshielded types. The shielded type can only be used for measuring the front, while the unshielded type can measure a larger angle. The measuring range is selected according to needs, but it is generally relatively short.

Arduino example project

Pir Sensor Arduino: Staircase night light

The example components used in this project are: Arduino UNO, LED, HC-SR505 PIR sensor, BH1750 light sensor.

First, connect each component as shown in the diagram below (the diagram uses HC-SR501, but the interface is the same as that of HC-SR505).
Arduino PIR Sensor

pir motion sensor wiring

Then, connect the Arduino UNO to the computer. Open the Arduino IDE on the computer, select the connected serial port, and then burn the code into the microcontroller to use it.

The code is as follows:

				
					#include <Wire.h>
#include <BH1750.h>

BH1750 lightMeter;

// Pin definitions
const int pirPin = 2;    // PIR sensor connection pin
const int ledPin = 3;    // LED connection pin

// Variable definitions
int lightThreshold = 50; // Light threshold (lux)
bool isDark = false;     // Flag for dark environment
unsigned long ledOnTime = 0; // LED on timestamp
const unsigned long ledDuration = 5000; // LED keep-on duration (5 seconds)
bool ledActive = false;  // Flag for LED active state

void setup() {
  Serial.begin(9600);
  Wire.begin();
  
  // Initialize BH1750
  if (lightMeter.begin(BH1750::CONTINUOUS_HIGH_RES_MODE)) {
    Serial.println(F("BH1750 initialization successful"));
  } else {
    Serial.println(F("BH1750 initialization failed"));
  }
  
  // Set pin modes
  pinMode(pirPin, INPUT);
  pinMode(ledPin, OUTPUT);
  
  // Initial state
  digitalWrite(ledPin, LOW);
}

void loop() {
  // Read light intensity
  float lux = lightMeter.readLightLevel();
  
  Serial.print("Light intensity: ");
  Serial.print(lux);
  Serial.println(" lx");
  
  // Check if ambient light is insufficient
  isDark = (lux < lightThreshold);
  
  if (isDark) {
    Serial.println("Insufficient ambient light, activating motion detection");
    
    // Read PIR sensor (with debounce)
    bool currentMotion = checkMotion();
    
    if (currentMotion && !ledActive) {
      Serial.println("Human motion detected - turning on LED");
      digitalWrite(ledPin, HIGH);
      ledOnTime = millis();
      ledActive = true;
    }
    
    // Check if LED needs to be turned off
    if (ledActive && (millis() - ledOnTime >= ledDuration)) {
      digitalWrite(ledPin, LOW);
      ledActive = false;
      Serial.println("LED has been on for 5 seconds, turning off automatically");
    }
    
  } else {
    // Ensure LED is off when ambient light is sufficient
    if (ledActive) {
      digitalWrite(ledPin, LOW);
      ledActive = false;
      Serial.println("Sufficient ambient light, turning off LED");
    }
  }
  
  delay(200); // Shorten detection interval
}

// Improved motion detection function (with debounce)
bool checkMotion() {
  // Read 3 consecutive times for confirmation
  int positiveCount = 0;
  for (int i = 0; i < 3; i++) {
    if (digitalRead(pirPin) == HIGH) {
      positiveCount++;
      delay(50); // Small delay
    } else {
      break; // Interrupt if there's a low level in between
    }
  }
  return (positiveCount == 3); // Confirm only if 3 consecutive high levels
}
				
			

When the light is sufficient, the LED remains off.

When the light is insufficient, it detects whether there is a human body (or an object with a higher temperature than the surrounding environment), and the LED turns on when detected.

Arduino PIR sensor project-1
4e7b8468ba42d9f6a7924e75a8c1124a

FAQ

What is the difference between a radar sensor and a microwave sensor?

Parameter Radar Sensor Microwave Sensor
Working Principle Uses radio waves to detect objects and measure their distance, speed, and angle Uses electromagnetic waves in the microwave frequency range to detect motion or presence
Frequency Range Typically 1-100 GHz Typically 300 MHz to 300 GHz
Detection Method Measures time delay of reflected signals (Time of Flight) Detects changes in reflected signals caused by movement
Range Capability Long range (up to several kilometers) Short to medium range (typically up to 30 meters)
Weather Resistance Generally good performance in adverse weather conditions Can be affected by heavy rain or snow
Precision High precision in distance and speed measurement Good for presence detection but less precise for exact measurements
Applications Aviation, maritime navigation, weather monitoring, speed enforcement Motion detection, automatic doors, traffic monitoring, security systems
Penetration Capability Can penetrate non-metallic materials like walls, plastic, glass Limited penetration through solid objects
Cost Generally more expensive Typically less expensive
Power Consumption Higher power requirements Lower power consumption

What triggers a microwave sensor?

Microwave sensors can be triggered by any moving object. During normal operation, they may detect people or items on conveyor belts, but they can also be triggered by other situations such as wind-blown leaves and rotating fans. Meanwhile, they may also be interfered with by other electronic devices like routers. Therefore, measures to prevent false triggering need to be taken.

What are three disadvantages of using PIR sensors?

The main issues with passive infrared sensors are that they cannot penetrate walls or detect objects through glass, and they have poor detection capability for extremely slow-moving objects. Secondly, they are susceptible to temperature influences; high temperatures and environments with alternating hot and cold conditions may cause false triggers. Finally, they cannot distinguish between types of targets—any object that emits thermal radiation and can move will trigger them, making them prone to interference from small animals or other factors.

What is the difference between PIR sensor and motion sensor?

The difference between PIR sensors and motion sensors mainly lies in their working principles and methods. PIR sensors mainly detect thermal radiation, while motion sensors (such as microwave radar sensors) rely on physical movement for detection. A detailed comparison has been provided above.

What will trigger a PIR sensor?

Any object that emits thermal radiation can trigger a PIR sensor, such as small animals and heat-generating objects. Additionally, high temperatures and environments with alternating hot and cold conditions can also cause false triggers, so measures to prevent false triggering need to be taken.

What is the difference between a motion sensor and an ultrasonic sensor?

Ultrasonic sensors are a type of motion sensor, while motion sensors are a broader concept, which has been introduced in detail in the main text above.

How far can an ultrasonic sensor detect?

This depends on your requirements. Ordinary low-cost modules typically have a range of 2cm to 4m, industrial-grade medium-range sensors generally range from 0.1m to 10m, and professional long-range sensors usually cover 0.5m to 20m.

What is ultrasonic used for?

Ultrasonic sensors have a wide range of applications and can be used in many scenarios involving object detection, such as obstacle avoidance, distance measurement, liquid level detection, vehicle detection, drone altitude measurement, and anti-collision for large machinery.

Leave a Reply

Your email address will not be published. Required fields are marked *