Garage Sensor and Remote

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.

IMG_20150426_173318 IMG_20150426_173313

This is one of the more exciting nodes I’v gotten working so far. Late last year, I left the house for a hockey game, and when I got home I found that I had left the garage open the whole time. Having a monitor on it is useful for alerts if the door is open for too long, and being able to close it remotely if it’s accidentally left open is even more useful. I used this as a catalyst for figuring out how to trigger actuators (a relay in this case) from openHAB. It was a very slow and painful process but it’s really cool to have working now.

the first try

I started this project by buying the “garagemote” from lowpowerlabs (here). It comes with all the necessary hardware, including a relay and a pcb that holds all of the components. The kit includes 2 hall effect sensors, which are used to detect a magnetic field. They are more complicated to use than reed switches because they need to be enabled by a digital signal from the arduino. I opted to use reed switches after frying one of the hall effect sensors while soldering wires to it.

The kit comes with a sensor for “open” and a sensor for “closed”. A magnet is attached to the belt (or chain in my case) that physically opens and closes the lift gate. I used the program provided by lowpowerlabs and tailored it to fit into my setup. The code uses logic to detect open, opening, closed, closing and unknown states. It also uses logic to open the door (instead of just the incoming signal).

The first issue I ran into was consistently detecting the open door. The closed side always stopped in exactly the same spot, because the door was resting on the ground. The open side would sometimes be off by a little. As a result, the door would sometimes receive multiple relay pulses if I tried to trigger it. I ended up disconnecting the setup until I had more time to play around with it.

the good try

I simplified the system by removing the open sensor and removing a lot of the logic. Instead of trying to figure out opening/closing states that don’t actually accomplish anything, I simply look at the closed sensor. If the sensor is on, I know the door is closed. If the sensor is off, I assume the door is open. I also will only send one pulse to the relay no matter what state the door is in. This setup has been working for a couple of weeks now and has been working well. The schematic for the current circuit is here:

garageNode_bb

the program

This program sends state changes of the door back to the openHAB server. If the door is open for more than 2 minutes, it sends me a warning email (I don’t get notified by the normal state change emails that I set up because there are too many of them).

To read the switch from openHAB, the signal travels from the openHAB server to the rfm gateway via a mosquitto subscribe call. The mosquitto topic is the same format as all of the reads (2 digits for the node number, one for the device and one for the variable). When the gateway sees the signal, it sends the signal to the node and the node pulses the relay. The way I have it set up, each device is only capable of handling one variable, even though there are three variables allowed in the other direction. It was much simpler to do it that way and it works well enough. For more info check out the original post I wrote about my setup here.

The openHAB sitemap is straightforward. The status of the door is displayed on the home screen. Clicking on it exposes the switch and the last update time. As usual, the arduino code can be found in my github repo here. The modified server can be found here as a fork from the original version.

gdoor

gdoor2

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