A problem that I’ve had is that I keep forgetting to close the garage door at night, which lets in the elements (and also rats). After being pestered for some time by my parents to find a solution, I finally came up with this.
The solution is to turn on the overhead lights any time the garage door is open at night. Since the garage is in plain view of my house, this makes it really obvious when the door is open. Unlike something that automatically closes the door, a solution like this doesn’t need control of the garage door itself, which I suppose makes it safer.
The thing uses an inductive proximity sensor to detect when the garage door is open, and also a timer switch to power it only at night. The inductive sensor operates a relay, which turns on the lights by back-powering the switched outlet where the lights are connected. It is generally not a good idea to back-power anything, but since the light switch and this device are on the same circuit, it should be fine.
Most of the electronics are mounted on a PCB. The relay is connected via a big resistor to the inductive sensor’s output. This resistor passes just enough current to keep the relay tripped — but not to trip it initially. This task is performed by a 470μF capacitor and smaller resistor in series, connected in parallel to the big resistor: right when the inductive sensor activates, current flows into one side and out of the other of the capacitor, and it essentially behaves like a wire, powering the relay through the small resistor, tripping it. As the capacitor charges up, it stops allowing current to flow, leaving only the big resistor to power the relay. This decreases power consumption and relay heating, and makes the voltage spike from turning off the (inductive) relay coil smaller since less current has to be stopped.
The inductive sensor is mounted on a ceiling rafters and detects a strip of steel on the very top of the garage door. It has a fairly narrow range — about 10 mm — but the garage door opener usually opens the door to a fairly constant position, so this should be fine. I’ve found that by pulling down on the door, you can make it open about 50 mm less than normal, so it is possible that the door opens but is not detected if some complication arises. An ideal solution would detect if the door is not closed, but it would be a bit more complicated to mount.