Will need diode D1 in series with the digital input to block the 12 volts on pin1 of the LM393.
Pullup resistor required on the digital input pin or enable a pullup in the code.
The PIR is read when the digital pin is LOW which happens when the LDR triggers the LM393.
Note the arrangement of R1.

Pullup resistor required on the digital input pin or enable a pullup in the code.
The PIR is read when the digital pin is LOW which happens when the LDR triggers the LM393.
Note the arrangement of R1.

Last edited:






