I am designing simple security system to protect 20-30 windows (total length about 50m) with vibration sensors (based on SW-420 modules). Window are on the roof and due to environment i use optocouplers for controller isolation.
I want all of that sensors to be connected to one wire, something like Logic OR.
When sensors has LOW on OUT pin, optocoupler cathode has ground pulled via R21 resistor - controler pin has LOW.
When sensor is active, transistor Q sends 5v to optocoupler cathode, and IO pin getting HIGH via Pullup resistor R20.
Note: I places pulldown resistor at the end of line. So if signal or ground wire is terminated (cutted, disconnected), alarm will be activated.
I tested this circuit with only two sensors (don't have any more). Look's like working well. But i am worrying about stability and safeness when there will be 20-30 sensors on single line 50m long.
Also i were trying to replace sensors with HC-SR501 PIR Motion.
Unfortunately this circuit not working. Looks like 3.3v with 0.6v drop cannot drive 2N2222. May be other transistor will work?
So, will this circuit works stable and safely when scaled up? (may be some capacitors).
Also is R23/R24 resistor is necessary (i tried without them, and placed in schematic just in case).
Is 2n2222 is right choice for this circuit?
Another idea is breaking connection between led cathode and ground with mosfet
Will this works?
Is 2kOhm for mosfet gate pullup is enough/to much?
Will mosfet close when transistor closes?