
So the load connected with the relay also turns on. When the transistor turns on, the current can flow through the relay coil.The Pin-2 of CD4017 is connected with the base of the BC547 NPN transistor, So when the Pin-2 becomes high the transistor turns on.So when any motion detected, the 4017 IC receives a clock pulse and changes the current state of Pin-2. The clock pin (Pin-14) of CD4017 IC is connected with the output pin of LM358.When any motion detected the voltage across the IR receiver crosses the predefined value, so the output pin (pin 1) of LM358 becomes high. The LM358 compares the voltage across the IR receiver LED with the predefined value.When any object comes within the range, some amount of infrared reflects from the object surface and that reflected infrared can be detected by the IR receiver LED. The IR emitter LED continuously emits infrared.

CD4017 Pinout How the Motion Sensor Circuit works
