In this project we’ll modify a commercial motion sensor (powered with mains voltage) with an ESP8266 to log data whenever motion is detected. The data will be sent to Node-RED using MQTT communication protocol. The ESP8266 will be powered through the motion sensor phase out wire using the HLK-PM03 AC/DC converter.
Prerequisites
Before continuing with this project, we recommend taking a look at the following resources:
- You need to have installed in your Raspberry Pi: Node-RED,Node-RED Dashboard, and Mosquitto MQTT broker
Parts Required:
Here’s a list of the parts needed for this project:
- ESP8266-01 Serial Adapter (to upload code to the ESP8266)
- Hi-Link HLK-PM03 (to convert mains voltage to DC 3.3V)
- Fuse Slow Blow (200mA)
- Raspberry Pi (to host Node-RED and MQTT broker) – read Best Raspberry Pi Kits
EXPANDED TECHNICAL DETAILS
Thermal Signature Sensing
The alarm relies on the HC-SR501 PIR (Passive Infrared) sensor. Unlike ultrasonic sensors, it detects the movement of heat-emitting objects (like humans or pets).
- Fresnel Lens: The plastic dome focuses infrared energy onto the pyroelectric sensor. The sensor outputs a digital HIGH signal when a moving heat source is detected within its 7-meter, 110-degree field of view.
Alert Logic & Security
- Delay Control: The Arduino allows for a software-defined "Arming Delay," giving the user time to leave the room before the alarm becomes active.
- Feedback: Upon detection, it triggers a 110dB Piezo Siren and high-intensity flashing LEDs. For added security, the system can be expanded with an RTC to only "Arm" itself during specific nighttime hours.