Project Overview
This project creates a self-powered PIR motion sensor that runs entirely on solar energy. It is ideal for remote locations where running power cables or changing batteries is impractical. The system stores energy in a supercapacitor or rechargeable battery, providing operation through the night.
Difficulty: Advanced
Estimated time: 4-6 hours
Estimated cost: $40-60
How It Works
A small solar panel charges a supercapacitor or lithium battery during the day. An ultra-low power PIR sensor (Excelitas PYD 2597 or Panasonic EKMB) draws only 2-6 µA, allowing continuous operation. When motion is detected, the system wakes a microcontroller to process the event and optionally transmit via low-power radio (LoRa, Zigbee, or Bluetooth).
Materials Needed
- Ultra-low power PIR sensor (Excelitas PYD 2597 or Panasonic EKMB 1µA variant)
- ESP32-C3 or nRF52840 (low-power microcontroller)
- Solar panel (5V, 100-200mA, 80x80mm or larger)
- TP4056 charging module (if using Li-ion battery)
- Lithium battery (18650 or LiPo, 1000-2000mAh) OR
- Supercapacitor (2x 10F 2.7V in series for 5F 5.4V)
- Low-dropout regulator (MCP1700, 2µA quiescent)
- Schottky diode (1N5819) for solar panel isolation
- LoRa module (RAK811 or Heltec) or BLE module (optional)
- Waterproof enclosure (IP65 rated)
Circuit Diagram
Power Management Section
Solar Panel (+) --- Schottky Diode ---+--- TP4056 IN (if using battery)
|
+--- Supercapacitor (+) (if using cap)
|
+--- LDO (MCP1700) IN
|
Supercapacitor/Battery (-) ------------+--- LDO GND
|
LDO OUT (3.3V) ------------------------+--- PIR VCC
+--- MCU VCC
Sensor Connection
| Component |
Pin |
MCU Pin |
PIR Sensor (PYD 2597) |
VCC
3.3V
PIR Sensor |
GND
GND
PIR Sensor |
OUT
GPIO (with 10k pull-up to 3.3V)
PIR Sensor |
WUP
GPIO (interrupt pin)
表
Arduino Code (ESP32-C3 with Deep Sleep)
// Energy Harvesting PIR Sensor
#include <esp_sleep.h>
const int pirPin = 4;
const int wakePin = 5;
const int ledPin = 8;
const int batteryPin = 3;
RTC_DATA_ATTR int eventCount = 0;
RTC_DATA_ATTR unsigned long lastWakeTime = 0;
void setup() {
Serial.begin(115200);
pinMode(pirPin, INPUT);
pinMode(ledPin, OUTPUT);
esp_sleep_wakeup_cause_t wakeup_reason = esp_sleep_get_wakeup_cause();
if (wakeup_reason == ESP_SLEEP_WAKEUP_EXT0) {
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(ledPin, LOW);
eventCount++;
sendNotification();
lastWakeTime = millis();
} else if (wakeup_reason == ESP_SLEEP_WAKEUP_TIMER) {
reportBattery();
}
goToSleep();
}
void sendNotification() {
Serial.print("Motion detected! Total events: ");
Serial.println(eventCount);
delay(100);
}
void reportBattery() {
int raw = analogRead(batteryPin);
float voltage = (raw / 4095.0) * 3.3 * 1.5;
Serial.print("Battery voltage: ");
Serial.println(voltage);
}
void goToSleep() {
esp_sleep_enable_ext0_wakeup((gpio_num_t)pirPin, 1);
esp_sleep_enable_timer_wakeup(24 * 60 * 60 * 1000000ULL);
esp_deep_sleep_start();
}
void loop() {}
Power Budget Calculation
Component power consumption:
- PIR sensor (PYD 2597): 2 µA
- ESP32-C3 deep sleep: 5 µA
- LDO (MCP1700): 2 µA
- Total standby current: 9 µA
With 10 events/day: 0.216 mAh + 0.021 mAh = 0.237 mAh/day
With 1000 mAh battery: 1000 / 0.237 ≈ 4,200 days ≈ 11.5 years (battery self-discharge limits to 2-3 years)
Installation Steps
- Assemble power management circuit on PCB or protoboard
- Program ESP32 and test with motion detection
- Measure standby current to verify it is under 10 µA
- Mount components in weatherproof enclosure
- Place solar panel facing south (northern hemisphere) at optimal angle
- Deploy in field and test for 24 hours
Project Extensions
- Add LoRa radio to transmit motion events to a central receiver
- Add DS18B20 to report ambient temperature
- Use MQTT to send data to Home Assistant via Wi-Fi
- Create a network of solar-powered sensors for perimeter security
- Use PIR to wake a camera for wildlife photography
Conclusion
This energy-harvesting PIR sensor provides maintenance-free operation in remote locations. With proper design, it can operate indefinitely without battery changes.