June Birth Magoncia

user Electronics Engineer

city Innovuze Solutions, Inc.

  • Simple Motion Activated Security Light with Mobile Notification

  • Created: Oct 11, 2016

    • view1062
    • comment0
    • bookmark0
    • fork0


No description available.


A passive infrared (PIR) sensor is an electronic device that can sense infrared light that objects emit within its detection angle. In the field of Electronics, PIR sensors are usually used to detect motions for security purpose, lighting automation, etc. In this reference design, a PIR sensor is used to detect motions to automatically turn ON a security light. A 5V coil relay (G5RL-1A-E-TV8 DC5) switches ON the light whenever a motion is detected. The design is equipped with a WiFi module so that it will also send a mobile notification.

The circuit is mainly composed of a PIR sensor, an ATmega328P-PU microcontroller, ESP8266 WiFi module, a relay driver with the G5RL-1A-E-TV8 DC5 relay, and 3.3V regulator. The sensor used in this design is the 28032 wide angle PIR sensor from Parallax. It operates from 3VDC up to 6VDC with a current consumption of 3.2mA (no load). The 28032 PIR sensor can detect movements up to 30ft away around 180 degrees detection angle. The EN and OUT pins of the sensor are connected to the ATmega328P-PU microcontroller. The EN pin is for enabling or disabling the sensor. By default, the sensor is enabled. By pulling the EN pin to LOW, the sensor can be disabled. When the PIR sensor detects motion, it sends a HIGH output from its OUT pin to the PD3 pin of the microcontroller for about three seconds. But for as long as motion is detected, the OUT pin of the sensor stays HIGH. When the microcontroller detects a HIGH voltage on its PD3 pin, its PB1 pin immediately toggles from LOW to HIGH to switch the G5RL-1A-E-TV8 DC5 relay through the relay driver. The 220VAC line of the security light is connected to the contacts of the relay through the screw terminal ST1. As a result, the security light, which is initially OFF, will turn ON.

The ESP8266 WiFi module communicates with the ATmega328P-PU by serial communication. After turning the lights ON, the microcontroller transmits data to the ESP8266 module. The ESP8266 module notifies the owner of the house or office that a motion is detected by the sensor. A mobile app that connects to the ESP8266 over the internet must also be created and installed to the phone of the owner to receive notifications. The ESP8266 operates on a 3.3V supply which is provided by the AZ1117H-3.3TRE1 3.3V regulator. Since the ESP8266 operates on a 3.3V level, a voltage-divider network which is composed of R7-R9 is used to step down the 5V output of the microcontroller to approximately 3.3V level. This reference design can be installed in houses or offices for additional security.