Garage Door Alarm

27/08/2011

In our house, we have an electric garage door. Unfortunately, the radio control for the electric opener doesn’t work. Initially, we worked around this by going into the garage through the side door, but this became old really quickly. I realised that I could tap into the existing connection for the internal opener (a bell-push mounted on the back wall of the garage) by running a cable into the house and fitting a second push-button. However, I also realised that we wouldn’t have the discipline to remember to close the door when we got home sometimes (especially since we’d forgotten a few times by that point). My first thought was that some sort of alarm that reminded me when the door had been left open for a short while would be super-helpful since it would stop us leaving our bikes exposed overnight.

The obvious candidate was to use a pic microcontroller to sound a beeper, and it just happened that I had a most of the components I needed in my parts bin already, including a pic18f2550, a piezo beeper and a pcb ready for a pic with plenty of io connections on it.

Because I didn’t want to chew power monitoring the door, I decided that I wanted the circuit to be battery powered rather than using a wall adaptor, but this introduced another issue: how to make it last for ages on a single battery. Since the door is closed for the majority of the time, it’s hopefully clear that the cleverest thing to do is switch the whole thing off when the door isn’t opened. To do this, I employed a normally closed reed switch. I had a normally open reed switch door sensor from an old burglar alarm installation that I fitted years ago, so I purchased an nc switch and transplanted it into the casing and fitted this to the door.

Then, I drilled a hole through wall between the garage and the house to let me fit a wire through. The wiring is super simple. A 2 core cable is connected from the bypass terminals on the back of the door closer at the roof of the garage to a junction box near the hole in the wall. Another cable connects to the door switch. A second 4 core cable connects from the junction box through the wall to a case that’s mounted on the wall in the hall. The circuit diagram is shown in the picture below.

Parts List

The parts include

PIC18F2550

PP3 Battery

Printed Circuit Board

Piezo Buzzer

How it works

When the door is closed, the reed switch is open and the power is turned off. When the door is opened by pressing the button on the control panel, it closes the reed switch and the pic starts a timer. The timer counts up for 5 minutes, and then starts a beeper. At any time you can press the silence button, which stops the timer from counting and puts the pic to sleep to save power. I employed a couple of other tricks to try and save battery by only testing the state of the silence switch once every half a second. The pic also controls the state of the pull-up resistor on the silence switch so it also de-energises the pull-up voltage when the state of the switch isn’t being tested.

The firmware is written in c18, using the microchip c compiler and is shown below.

Since I installed this system, it’s been activated about once per week, which means that the number of times we’ve accidentally left our garage door open overnight has been significantly reduced. It goes without saying that I’m very pleased with the performance of this system.