Door Sensors

IMG_20150405_165148 IMG_20150405_013926

This post is one in a series of posts relating to my home automation project. My setup is based on the Uber Home Automation instructable by elecetronichamsters, found here.

The first two nodes I created were simple door sensors. The sensor is just a reed switch attached to the door frame and a magnet attached to the door. When the door is closed, the magnet pulls the reed switch closed. When the door is open, the switch is open. It doesn’t get much simpler than that. Additionally, the node measures the voltage from the battery. Every time the door opens or closes, the status is sent wirelessly to the openHAB server.

doorNode_bb
wiring diagram for door switch

The program that runs on the arduino is interrupt driven, meaning that the arduino is in a very low power sleep mode until it detects a signal. This allows the batteries to last much longer. Once the signal is detected, it evaluates the state of the switch and communicates that to the server. The program can be downloaded from my Github repository here.

The openHAB configuration is very straightforward. It updates the interface based on the state of the switch. I decided to use the “contact” mapping rather than the “door” because I liked the graphic better. I also added a feature to see the last time the status was updated by clicking on the individual doors. Finally, on any state change, I receive an email from openHAB alerting me of the change. The email is routed directly to a specific label and marked read so I am not bombarded with status updates, but it is nice to be able to see the history of each node without having to go any further than my gmail account. The email is sent using an openHAB rule.

doors timestamp

These nodes use moteinos with RFM69HW chips preinstalled, which can be purchased here, and reed switches which can be purchased here. The battery packs, wires and small breadboards are all easy to find. I also use a liberal amount of velcro.

These nodes are a great place to get started if you are considering doing this project. The program is very simple and is simpler still if you don’t use the interrupt.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s