Door Switch 2.0

For my first Intro to IM assignment I made a door switch that turns on the LED when the door gets open. For my third assignment, I expanded the original circuit by incorporating a photo sensor that renders the mechanism more robust and friendlier to all parties involved.

Let’s first spend a moment talking about the initial door switch. The project was inspired by my roommate who often leaves the room door open when he goes to the common room. When the door switch is open (i.e. when the door gets open), the LED lights up and reminds the leaving roommate to close the door behind him. In spite of the apparent merits of the switch, it would be impractical if the LED turned on every single time my roommate or I opened the door. The switch only serves its purpose at night while my roommate or I are asleep. The original mechanism could thus be improved by making it discriminate between day and night.

This is when the light sensor comes into play. The purpose of the light sensor is to detect changes in light intensity. Importantly, the sensor’s analog input can be easily turned into a logical statement. Once that is done, the behavior of the LED is contingent upon two conditions: the open door and low light intensity corresponding to the nighttime.

The positive effects of the door switch conditioning are not to be neglected, so the LED lights up in the daytime as well, but blinks with a slow pulse.

In the nighttime, however, the LED flashes with a delay corresponding to the value read by the light sensor (e.g. 439 read by the photocell means the LED will blink with a delay of 439 ms). The sensor threshold is set rather low, which means that opening the door at night results in furious flashing of the LED. In short, the LED is put to work only when that is really needed of it.

And while even the original switch ensured me a good night’s sleep, the new switch also makes sure that my roommate and I don’t go crazy while opening the door in broad daylight.