A Gate Open Transmitter

After a burglery we wanted to know if the gate at the side of oour house was opened. This replaces a push-button switch of the type used for car doors, embedded into the gatepost. It was wired to an X10 interface by concealed underground wiring. The X10 transmission went to a lamp, the Weather Loggger, and an alarm. The wire failed and I decided to use RF instead. A magnetic switch is in the top of the box containing the electronics. The matching magnet is enbedded in a block of wood screwed to the gate near its hinge.

Here is the circuit diagram. I could not find a button which was open when the magnet is in place so this design is dominated by the necessity to reduce the gate closed current as much a practible. This required two PNP transistors in tandem.
During operation the power to the circuit is maintained by the NPN transistor until the gate is closed again.
The transmitter module draws no power while its modulation input is low.
The 4-pin header is for programming. Normally the input pin is shorted by a jumper block.

Here is the program code. It is quite customable using constants.