Introduction
ESP32 and ESP8266 are popular choices for IoT motion sensors due to their built-in Wi-Fi and low-power capabilities. However, choosing the right PIR sensor for these 3.3V boards requires attention to voltage compatibility and power consumption. This guide covers the best options.
Key Considerations for ESP Boards
1. Voltage Compatibility
ESP32 and ESP8266 GPIO pins are 3.3V tolerant only. 5V output from a PIR sensor can damage the ESP. Options:
- Use 3.3V-compatible sensors (AM312, Panasonic EKMB, Excelitas PYD)
- Use voltage divider or level shifter with 5V sensors
2. Power Consumption for Battery Projects
ESP boards in deep sleep draw 5-150µA (ESP32 ~5µA, ESP8266 ~20µA). Adding a PIR sensor with 50µA standby doubles consumption. Ultra-low power sensors (1-6µA) are ideal for battery projects.
3. Wake-on-Motion Capability
ESP32 and ESP8266 can wake from deep sleep using an external interrupt. Choose a PIR sensor that can generate an interrupt on motion detection.
Top PIR Sensors for ESP32/ESP8266
Best Overall: AM312
Price: $2-3
Voltage: 2.7-12V (works at 3.3V)
Output: 3.0V (safe for ESP GPIO)
Standby current: 35µA
Pros: 3.3V compatible, small size (10×8mm), low power
Cons: Fixed 2-second hold time, shorter range (3-5m)
Best for: General ESP projects, battery-powered applications
Connection:
AM312 VCC → ESP 3.3V
AM312 GND → ESP GND
AM312 OUT → ESP GPIO (any)
Best for Battery Life: Panasonic EKMB Series
Price: $8-12
Voltage: 2.3-4.0V (3.3V works)
Output: Open-drain (requires pull-up to 3.3V)
Standby current: 1-6µA
Pros: Ultra-low power, high sensitivity, various lens options
Cons: More expensive, requires external pull-up resistor, SMD or TO-5 package
Best for: Ultra-low power battery projects, long-term deployments
Connection:
EKMB VCC → ESP 3.3V
EKMB GND → ESP GND
EKMB OUT → ESP GPIO (with 10kΩ pull-up to 3.3V)
Best for Deep Sleep Wake-Up: Excelitas PYD 2597
Price: $6-8
Voltage: 1.4-3.6V
Output: 1-wire digital with interrupt
Standby current: 2µA
Pros: Lowest power, 1.4V operation, integrated wake-up mode
Cons: Requires external lens, more complex interface, SMD
Best for: Energy-harvesting, coin-cell battery projects
Connection:
PYD VCC → ESP 3.3V
PYD GND → ESP GND
PYD OUT → ESP GPIO (with 10kΩ pull-up to 3.3V)
Budget Option: HC-SR501 with Voltage Divider
Price: $2-3
Voltage: 4.5-20V (use 5V supply)
Output: 3.3V (most clones) or 5V (check with multimeter)
Standby current: 50-65µA
Pros: Cheap, adjustable sensitivity and hold time
Cons: Higher power, needs level shifting if output is 5V, not 3.3V compatible
Best for: Budget projects, USB-powered (not battery)
Connection with voltage divider (if output is 5V):
HC-SR501 VCC → 5V supply (not ESP 3.3V)
HC-SR501 GND → ESP GND
HC-SR501 OUT → 10kΩ resistor → ESP GPIO
HC-SR501 OUT → 20kΩ resistor → GND (voltage divider)
Comparison Table
| Sensor | Voltage | Current (standby) | ESP Compatibility | Price | Best For | AM312 | Panasonic EKMB | Excelitas PYD | HC-SR501 |
|---|
