Electronic – Mosfet on/off with delay

mosfet

Trying to make a circuit for a door sensor. The objective is send a RF signal when door opens, another one when door closes (in the simulation, all RF part is simulated as a 1k resistor and door open/close is simulated as a switch: door open = switch off, door close=switch on).

In order to save energy, RF module will be powered only immediately after door is open and until a few seconds after door closed (to allow RF module to send the pending messages).

The first try is following circuit:

enter image description here

(simulation is here)

Problems:

1) There are a delay between open door and RF power on (mosfet open). This is not acceptable, because it means a fast door open-close could be not registered by the system.

2) Mosfet is in cut when door is closed, this is ok, and in linear mode when door is open, it could be better in saturation.

Could someone suggest some changes to reach these objectives?

Thanks.

Best Answer

Try using an EXOR gate with an RC to generate a pulse of limited duration when a switch opens or closes: -

enter image description here

The output pulse width is roughly equal to about R x C in time. It will produce a pulse when an edge is detected within tens of nano seconds (or less) and when the capacitor eventually charges, the pulse output will reset.

When the input changes state another pulse will be generated.