How can I detect if a garage door is opened or closed?

In many home security systems they use magnet switches to detect the state of the door.

You could also use something like IR to see if a certain part of the door frame is blocking the light.

And one more option is to sense if the door is horizontal or vertical, basically you would mount it to the inside of the door, when it opens it would be horizontal and closed would be vertical. This is actually how most of the off-the-shelve generic sensors work.

If you have a particular method that you prefer I can give some specific sensor recommendations as well.

Edit: I missed that you said you wanted it 4 meters from the door. I am not sure if you just want this because you don't want to deal with wireless, but the IR method can also work in which you put something that reflects IR on the door and then have your sensor look to see if your IR beam has been reflected or not.


Some more additions:

If it were me, I would get something like this, there are lots of other brands and methods that are used. Buying sensors and wireless modules can be pretty expensive when bought in quantity 1 and probably wont be worth the cost over just buying the off the shelf method.

Now if it were me wanting to tackle a fun project, I would use an accelerometer attached to the inside of the door (could even be a board just Velcro'd to the inside of the door). The accelerometer doesn't need to be anything special, just something that when attached can detect acceleration in the down direction when the door is vertical and the down direction when the door is horizontal. It so happens that the force of gravity will show up on an accelerometer. I would then use an Xbee module to transmit the status to an xbee that is inside.

Realistically you don't need to transmit very much very often, you could put everything into sleep mode when ever you aren't reading and then once every minute or so wake up and transmit the current state. Because of how little the device is on it could easily run off of a battery for a decently long time.

There may be other, better, methods of detection, but when ever I do a "for fun" project I like using parts that I might use in other projects. It helps to grow the intellectual property that I have, which is useful for the future.


If you really don't want the sensor on the door itself, you could opt for a Sharp GP2DXX IR sensor. There are different versions depending on the range, this document gives you an overview.

If the sensor can be on the door, there's microswitches like

microswitch

(Despite their name they're often not really micro, but rather for heavy duty industrial use. I guess the name derives from a Honeywell trade mark.)


This is interesting because it's something Ben Franklin solved with a string, a wire eyelet hammered into the door, a counterweight, and a semaphore flag he could see from the second floor. There are some interesting women's solutions from any era you like as well, used to check if heifers and chickens are in during rain, etc.

If it's an apartment, perhaps a lightly convex stainless mirror facing you and the garage door is not out of the question.

I think separate switches for the door and automatic opener are a good idea. It's pretty trivial to run a wire (or commonly a twisted pair) to the next floor; terminate the ends near grounded shunts so you don't have some kind of lightning antenna that zaps your Arduino or light semaphore circuit when there's a storm nearby! Then add an polling optoisolator (again for circuit protection) if you want the Arduino to check the garage for you. Then again, if you install a lightbox and camera in the garage, the radio thing would work and you could see how open the door was, maybe operate an illicit (or merely aseasonal) tomato growing operation, and/or decide whether you should have aired up the tires.

Tags:

Arduino

Sensor