Introduction
PIR sensors and modules offer different output interfaces. Choosing the right one and interfacing correctly is essential for reliable operation.
Output Interface Types
Push-Pull Digital Output
Output is actively driven HIGH to VCC and LOW to GND. Can source and sink current.
Examples: HC-SR501, HC-SR505, AM312
Pros: Simple, no external components, clean levels
Cons: May not be 5V/3.3V compatible without level shifting
Open-Drain / Open-Collector Output
Output transistor switches to GND when active; otherwise floats (high impedance). Requires external pull-up resistor to VCC.
Examples: Panasonic EKMB series, some industrial sensors
Pros: Easy level shifting (pull-up to any voltage ≤ max rating), wired-AND capability
Cons: Requires pull-up resistor, slower rise time
Analog Output
Continuous voltage proportional to IR signal. Requires ADC for reading.
Examples: Murata IRA series, some Panasonic variants
Pros: Rich information, enables advanced processing
Cons: Requires ADC, more complex firmware
Interface Characteristics
| Type |
Idle State |
Active State |
Pull-up Needed |
Push-Pull |
LOW (0V)
HIGH (VCC)
No
Open-Drain |
High-Z (pull-up HIGH)
LOW (0V)
Yes
Analog |
Mid-scale
Varies
No
表
Interfacing to Microcontrollers
Push-Pull Digital
Connect directly to GPIO if voltage levels match. For 5V sensor to 3.3V MCU, use level shifter or voltage divider.
Open-Drain Digital
Add pull-up resistor (typically 4.7k-10k) from output to MCU VCC. Then connect to GPIO. This automatically level-shifts because pull-up is to MCU voltage.
// Open-drain wiring
// Sensor OUT ────┬──── GPIO (input)
// └──── 10k resistor ──── 3.3V
Analog Output
Connect directly to ADC input. Ensure ADC voltage range matches sensor output range. Add RC filter if noise is present.
Voltage Level Considerations
5V Push-Pull to 3.3V MCU
Risk: May exceed MCU maximum input voltage (typically 3.6V).
Solutions:
- Voltage divider (2 resistors)
- Level shifter IC
- Choose 3.3V-compatible sensor (AM312)
Open-Drain Level Shifting
Open-drain is ideal for mixed-voltage systems. Pull-up to MCU voltage, and sensor’s open-drain transistor can handle higher voltage (check absolute maximum ratings).
Pull-Up Resistor Calculation
For open-drain outputs: R = (VCC – VOL) / I_sink. Typical values: 4.7k to 10k for 3.3V, 10k to 20k for 5V.
Special Cases
Panasonic EKMB Series
Digital versions have open-drain output requiring pull-up. Some variants offer analog output for raw signal access.
Excelitas PYD 2597
Features one-wire digital interface, which is a bidirectional communication protocol, not a simple output.
Troubleshooting Interface Issues
| Symptom |
Likely Cause |
Output always LOW |
Open-drain without pull-up
Output always HIGH |
Push-pull but reading wrong polarity
Erratic readings |
No pull-up on open-drain, or floating input
MCU damaged |
5V sensor connected directly to 3.3V pin
表
Conclusion
Understanding output interface types is crucial for proper sensor integration. Open-drain outputs offer flexibility for mixed-voltage systems, push-pull is simplest for same-voltage systems, and analog provides maximum information.