X10 Radio Frequency ‘Door-Open’ Detector

By Ron H (Rholmesa)

 

Back in the days when I had time to spare, I developed the following circuit and software. I thought I would share this with the Proton community.

I have several X10 Home Automation switches in my house. X10, whilst not totally robust, does work. It certainly helps to make the place looked ‘lived in’ even when we are away by automatically switching on and off various lights in the house. Parts can be found at www.letsautomate.com and www.laser.com to name but two.

The problem I set out to solve was that the kids would leave the garage door open after putting bikes away etc. Due to the position of our garage, we cannot see the doors to check without going outside – and that may be too late after it gets dark. (I’ve already lost a set of golf clubs to an opportunist thief in this way!).

I did not wish to drill holes or run cable from the garage into the house, so opted for X10 Radio Frequency transmissions. This is a well-documented protocol and receivers are readily available. The X10 receiver passes the signal on to the mains wiring of the house and can therefore be used to switch lights on/off anywhere to remind you the garage door is open.

I first built a power hungry module. Worked brilliantly, but I wanted to run it from a battery so I came up with a second version of the circuit. The second version also meant I improved the code, so there is only one version of the software. The two circuit diagrams are attached.

Basic Operation

The basic operation is as follows:

The software in the PIC initialises the device such that it is pretty much in SLEEP mode all the time. This considerably reduces the power consumption and allows the use of batteries to drive the circuit. After initialising its X10 House and Unit codes it enables interrupts on GP0 and goes to SLEEP.

To maintain low power consumption, the RF Transmitter is actually supplied with power from one of the PIC pins. There is adequate current available for this to happen directly. However driving the Transmitter in this way will limit the range of the device as we are supplying it with only 5 volts instead of the nominally required 9 volts. That aside – it does work over a short range consistently.

When the door is opened/closed, magnetic reed relays cause a change in the state of GP0 on the PIC. This has the low power pull-ups enabled that removes the need for an external resistor. This causes an interrupt that awakens the PIC from its SLEEP. The interrupt is checked for validity before continuing.

The following sequence then occurs:

NOTE: The X10 commands in the compiler are not written for RF transmissions and cannot be used for this application.

I have found that the PIC can survive the 4 AA cells as a power source. This is nominally 6v – but never actually is!

The RF Transmitter is available from RF Solutions.

Downloads

Download the Code here

About the Proton Compiler

Crownhill's Proton Plus Compiler is a part of the Proton Development Suite - A suite of British-developed applications enabling fast development of PICmicro's using the PICBASIC Language.

For more information on the Proton Development Suite, please visit www.picbasic.org

Disclaimer

Please note that this project is published AS IS. No responsibility of the author in any cases can be invoqued. This project is for learning and entertainment purpose only. No vital application can be connected to it. As this project is published on a free and friendly base for the user site of PROTON +, it cannot be used in any condition for business or commercial use without explicit permission of the author.