Garage Door Monitor and Contoller

Where to begin, oh I know the problem I wanted to solve.

Problem:

I have a 7 year old daughter, who likes to ride her bike, ride her scooter, go play with her friends in the neighborhood, all normal and fun activities. However there has also been some reports of tools stolen from open garages and other unsavory happenings that at the very least require you to be aware when the garage door has been left open.

Solution:

My first idea was to have an Arduino Uno monitor a magnetic reed switch and have it communicate in some way with my some sort of display in the main room. I had thought to have the Uno mounted in a box near where I have the door opener switch in the garage, which is also near the media closet with my home control computer. I could then talk to the Uno via its USB port and that would also power it.

However I happened across an article on Hackaday that showed an implementation of a similar problem, though the author of the article had been wanting to control the door more than monitor it.

It was like a lightbulb went off in my head!

Implementation:

So a quick summary of my implementation, then I will go over it again in a little more detail.

150_rn-xv-150px At the garage door, I have a home security magnetic reed switch bought off Amazon, this is connected to a board hosting a Roving Networks WiFly (RN-XV) which transmits a UDP status update every 2 seconds to my home network. It also allows a single TCP connection from my home control system over which I could control the output pins and via a relay the garage door.

08664-03-l On my home control system, I implemented an application that monitors the UDP broadcasts and maintains an internal state, when the state changes it sends a command via an XBEE module connected via USB to a remote XBEE module in the main room. The remote XBEE is connected to an ultra-bright LED and hidden in an old camera.

The same software I implemented to monitor the WiFly UDP packets, also implements the OSC protocol, and listens for messages from OSCTouch running on my iDevices (iPod touch, iPad, iPhone) and allows me via the TCP link to control the garage door and monitor the doors status from other areas of the house and remotely.

The screenshot from my iPhone shows the UI I created using TouchOSC and its associated editor. The embedded circle in the large button updates and shows the button is pressed, the large circle bottom right shows the status of the door, off is closed and on (it’s an LED) when the door is open. The home control software on;y sends updates when it knows a remote control is connected, the keep-alives from the handheld weren’t starting soon enough for me, so I wasn’t getting updates started in a timely manner, hence the refresh button to kick things off (most of the time I don’t actually need it).

So, basically the UI will send a command to the home control server, it sends a button down and a button up, I trigger a message from the home controller to the WiFly when I see the button up. The WiFly toggles a relay for 250ms when it receives the command; the relay is in parallel with the normal garage door opener;  to open or close the door.

XBEE:

08664-03-l Enough has been written about the XBEE elsewhere, but basically I’m finding the command interface a little unreliable, I guess I need to implement a more robust sender so that it can tell if the remote node was updated and the light switched. I’m sure this is my fault rather than that of the XBEEs, but they are frustrating. I’m sure as a wire replacement for a host to micro controller they would have been fine.

WiFly:

150_rn-xv-150px After the frustrations of the XBEEs I love this little thing! A drop in replacement for the XBEE that talks over WiFi and broadcasts status messages, not only that you can remote into it to control it’s outputs or use it as a WiFi to serial adaptor for a micro-controller. Props to the guys at  Roving Networks and thanks also for their technical guy Mike Conrad for calling me to give me advice on setup.

I used a XBEE USB Explorer to program it, using a terminal application, then wired it into a board, very similar to the one mentioned in the Hackaday article. This is wired into the garage door control via a couple of spade connectors in parallel with the existing door switch. I also wired up the reed relay to an input and the status of the inputs is broadcast every 2 seconds. Fast enough for the front room display and the UI on the TouchOSC.

Remote Display:

It took me a considerable amount to time to find something in which to mount the LED that would tell me that the garage door was open. It had to be something that has the all important WAF (Wife Approval Factor) and that she wouldn’t mind sitting in plain sight at all times, lots of ideas were considered and eventually I settled on an old camera I bought during the summer, neither it nor the attached flash worked, but it’s a beautiful piece of machinery and looks cool too.

The flash was the perfect place to mount the ultra bright LED, and the lens of the flash diffuses it nicely.

I gutted the inside of the flash, large capacitor and large battery, this made room for the XBEE module, a power regulator and some wires.

Ok, enough for now, will draw up a diagram or two for the next post and some of the code.

Posted in hardware, Home Automation, software | Leave a comment

Camera Axe – Water Drops

About the Camera Axe

The Camera Axe is an electronic triggering device which can be used to trigger either the camera shutter or external flash or both. Yesterday I experimented with the latter and below you can see some of the results.

The Camera Axe I own is an older version, I’ve had it a couple of years and it’s basically been gathering dust as I take care of other higher priority projects. However this weekend I made time to experiment with it to see what I could do.

Setup:

I built a photo interruptor based on the breakout board from SparkFun, this was hooked up to the camera axe on the sensor 2 input (sensor 1 wasn’t triggering correctly for some reason, will investigate another day). On Camera/Flash port one I had a shutter release cable plugged into my Nikon D700 and on port two I had a flash hot-shoe trigger connected to an SB-600 in manual mode. A second strobe (SB-800) was triggered in SU-4 mode,  that is the light from the SB-600 triggered the SB-800.

I created a frame (sorry no photos) to hold colored cards, one directly behind the water tray and another to camera left. One speed light was camera right, firing across the water at the colored card , the second speed light was below the card on camera left firing at the background. The image on the right conveys better what I am trying to say.

I had the water reservoir (old maple syrup container) up high with a tube and small valve to regulate flow. The end of the tube was aimed between the legs of the photo interruptor so the camera axe could detect the water drops.

After some trial and error (ok, all error) at getting the timings set in the camera axe, I decided to do it the correct way and work out how long a drop of water takes to fall… First I took the distance between the photo interruptor and the surface of the water. I then headed over to Wolfram Alpha to calculate the timings.

The distance I had was 39.5 cm, and according to Wolfram Alpha the drop of water would take 280ms to splashdown, so I had my starting point. I also knew that my Nikon, fast though it is, has a shutter lag of approximately 40ms.

I set Camera Axe to trigger the flash at exactly 280ms, and the camera to trigger 40 ms earlier at 240ms, then adjusted to capture the plume of water rising.

Some Images:

Posted in Gadgets, Photography | Leave a comment

Intelix, TouchOSC and Processing

As mentioned in a previous post, I use the Intelix 4×4 matrix switch for distributing HDMI video throughout the house. The only issue (not a major one) is the remote for switching between sources is never close to where I’m sitting, whereas my iPad or my wife’s iPhone is always within arms reach.

The switch can be controlled by one of the following methods

  • Infrared, this is how the remote works, utilizing an IR eye on the front of the TV which routes the IR to the matrix switch via the balun etc. an IR blaster could be used, but I don’t really want to go down this route.
  • RS-232, the switch has a port on the back which can be used to control the switch via simple commands. Hands up those with a spare RS-232 port on their computer, or any RS-232 port for that matter. I could get a USB to RS-232 adaptor, I already use one for talking to the home security system.
  • LAN, the Intelix 4×4 has a standard lag port an can be controlled remotely via the same simple commands used with RS-232, but from anywhere, no new hardware needed!!

So, network control it is. Now I had to figure out how to connect the iPad (or iPhone) up to the matrix switch. While I’m a software guy, I’m not too experienced programming for OSX, something I want to rectify, but finding the time …

Options:

  • Learn Objective C, long term goal!
  • Use MonoTouch, this looks great, leverages my C# and .Net knowledge and prototyping is free, the downside is that to be able to get the applications on the iPad rather than the emulator would cost $199.  I created a prototype, classes etc. that allow me to interrogate the matrix switch and change sources, but the last step of getting the app on the iPad … too expensive for replacing a single remote control.
  • On Hackaday.com I came across an article about controlling an Arduino with TouchOSC, this seemed promising. Control the Arduino from the iPad, have the Arduino talk to the switch via either the RS-232 or an Ethernet shield. Then the lightbulb lit up. Between TouchOSC and the Arduino was some Processing code, why pass the messages to the Arduino when Processing could talk to the Intelix switch directly.

Final Solution:

iPad/iPhone running TouchOSC ($4.99 on the app store), free TouchOSC editor, and 5 minutes to create the user interface and have it running on the iPad.

Processing module, first running on my Macbook Pro (did all this sitting on the sofa) then on the home control PC (the longest part of all this was un-zipping Processing on the  PC). which used an OSC library to receive the commands from the TouchOSC application and allow me to do stuff in Processing. The code opens a network connection to my switch and sends commands when buttons are pressed on the iPad.

Total cost, $4.99 for the iPad software, 20 minutes of my time coding and configuring. Now I have control from both the iPad and iPhone.

import processing.serial.*;
import processing.net.*;
import oscP5.*;
import netP5.*;

OscP5 oscP5;
int alphaValue;
Serial arduinoPort;
Client intelixClient;
byte[] byteBuffer = new byte[20];

float v_push1 = 0.0f;
float v_push2 = 0.0f;
float v_push3 = 0.0f;
float v_push4 = 0.0f;
float v_push5 = 0.0f;
float v_push6 = 0.0f;
float v_push7 = 0.0f;
float v_push8 = 0.0f;

void setup() {
    size(320, 440);
    frameRate(25);

    oscP5 = new OscP5(this, 8000);
    intelixClient = new Client(this, "x.x.x.x", 23);
}

void oscEvent(OscMessage theOscMessage)
{
    String addr = theOscMessage.addrPattern();
    float val = theOscMessage.get(0).floatValue();

    if (addr.equals("/1/push1")) {
        v_push1 = val;
    }
    else if (addr.equals("/1/push2")) {
        v_push2 = val;
    }
    else if (addr.equals("/1/push3")) {
        v_push3 = val;
    }
    else if (addr.equals("/1/push4")) {
        v_push4 = val;
    }
    else if (addr.equals("/1/push5")) {
        v_push5 = val;
    }
    else if (addr.equals("/1/push6")) {
        v_push6 = val;
    }
    else if (addr.equals("/1/push7")) {
        v_push7 = val;
    }
    else if (addr.equals("/1/push8")) {
        v_push8 = val;
    }
}

void SendCommand(String command)
{
    intelixClient.write(command);
}

void draw() {
    background(0);
    if (intelixClient.available() > 0) {
        // Read in the bytes
        int byteCount = intelixClient.readBytes(byteBuffer);
        if (byteCount > 0 ) {
           // Convert the byte array to a String
           String myString = new String(byteBuffer);
           // Show it text area
           println(myString);
        }
    }

    fill(0);
    stroke(0, 196, 168);
    rect(17, 21, 287, 55);
    rect(17, 369, 60, 50);
    rect(92, 369, 60, 50);
    rect(168, 369, 60, 50);
    rect(244, 369, 60, 50);

    fill(0, 196, 168);
    if (v_push1 == 1.0f) {
        rect(22, 374, 50, 40);
        SendCommand("a09");
    }

    if (v_push2 == 1.0f) {
        rect(97, 374, 50, 40);
        SendCommand("a1D");
    }

    if (v_push3 == 1.0f) {
        rect(173, 374, 50, 40);
        SendCommand("a1F");
    }

    if (v_push4 == 1.0f) {
        rect(249, 374, 50, 40);
        SendCommand("a0D");
    }

    /* Code for other 4 buttons here */
}
Posted in hardware, Home Automation, Network, software | Tagged , , , | Leave a comment

AirServer (or my prayers have been answered)

AirServer for OSX is a small application that enables airplay streaming to my mac pro, it does so without fuss, it sits quietly in the menubar and allows me to play music, video or pictures on the mac.

Posted in Home Automation | Leave a comment

Homeseer and Napco

I have already documented my tribulations over the state of the Napco plugin from HomeSeer.

Today is a more positive note, after a few hours of work on a couple of DLLs I have created my own C#.Net Plugin which performs the following:

  • Listens to and decodes the data-stream from my Napco Gemini 9600 security board.
  • Uses the information to maintain a record of the state of the door and window switches.
  • Exposes a single unit with multiple zones (one per door / window / motion sensor).
  • Creates a pseudo sensor for controlling my heating / cooling based on a list of the switches I designated as affecting the HVAC performance, i.e. great room windows and doors etc.

HomeSeer has been configured with a number of events that react to the zone going to a fault status, e.g. activate X10 chime when garage door is opened. And 2 relating directly to the HVAC control:

OPEN:

  • If the Pseudo Zone “Heat Control” is faulted, it means a door or window is open letting out the hot or cold air (or in the hot or cold air depending on time of year), so switch off the HVAC.
  • Tell the occupants that the HVAC is being turned off.
  • Disable the event (stops if from being re-triggered).

CLOSE:

  • Re-enable the OPEN event, this one is triggered by the “Heat Control” zone returning to normal.

Example above shows a faulted zone (motion detector).

Posted in hardware, Home Automation, House, software | Tagged , , | Leave a comment

House Temperature


Posted in Home Automation | Leave a comment

Play iPad streaming music through the my Mac

Not strictly home control, but this morning I was lamenting the lack of AirPlay for my Mac and OSX.

What I wanted was:

  • Play streamed music (iHeartRadio) on the iPad.
  • Have the music come out of my Mac Pro (connected to a stereo with large speakers).

My first thought was to find an AirPlay client, like AirPlay on the Apple TV. But no such thing exists for streaming music (or that I could find). Then I decided to go old-school, and connect the iPad via a wire! I know “how quaint”. But this lead to the next issue, setting the input on the mac pro to Line-In did not result in the music issuing from my speakers.

A little googling later and I found an awesome single tasker application called LineIn from Rogue Amoeba.

It does exactly what was needed, it streams the input from the LineIn to my speakers!

So now I have my iPad playing streamed music through a wire into Line-Input on the back of the MacPro, run LineIn andthe music comes from the large speakers connected to the stereo in my office, sound great. Plus I still get the notification noises mixed with the music.

 

Posted in House, Music | Tagged , , , , , , | Leave a comment

Netduino

I have a few project ideas for which a small micro-controller would be a perfect fit. Once such project is a traffic light controller for entry into my garage, to let me know when I am close enough to the wall to allow the garage door to close, while still allowing me to walk in front of the parked car for access to the workbench. The other part of the same project is for leaving the garage, when the door is opening I don’t want to start backing up and hitting the door before it’s fully open. Yes I could manage the former by paying attention, or judging the distance, the latter by being patient and waiting, but where is the fun in that? :)

That brings us to the Netduino, I recently acquired the standard Netduino and let me start by saying it’s awesome. You program this little beast in Visual Studio on Windows, deploy directly to the board from Visual Studio, and can debug directlt from Visual Studio. Oh and perhaps best of all (for me at least), I can program it in C#!

Not only C# but it supports threads, timers and high level events, no more bit twiddling (unless that’s your thing)!

Posted in Microcontrollers, Netduino | Tagged , , , , | Leave a comment

HomeSeer Support – Review

In a word: Abysmal.

After buying the control software, the Napco Interface hardware and the plugin for homeseer to communicate with the alarm control panel I am no closer to getting the alarm and the home control software to talk than I was at the beginning, of course I am a little ($350 or so) lighter in the pocket.

It seems that Napco has updated their protocol and the plugin from HomeSeer fails to communicate properly. At one point the HomeSeer support offered to let me update the plugin for them which I would have happily done and returned it to the community. However after the initial offer, they failed to follow through, despite repeated attempts at getting a response from them. They also closed the online support ticket, I re-opened it but still, no response.

I would NOT recommend the HomeSeer system if you want to control your Napco security system.

Posted in Home Automation, HomeSeer | Tagged , | Leave a comment

Wayne-Dalton Review – Update

Time to eat humble pie. The thermostat was not at fault, it was the house wiring or rather the original installer of the heating system. The ‘C’ wire though present at the thermostat end was not attached to the 24V source so the unit was running off the batteries and quickly draining them. Since rectifying the wiring the Thermostat has been perfect.

Posted in Home Automation | Leave a comment