Use a foscam (or clone) to control liftmaster garage door

http://hit-mob.com/forums/viewtopic.php?f=8&t=674&p=2088&hilit=liftmaster#p2088

This is how I use the “relay” function to open/close my chamberlain liftmaster garage door (through a foscam FI8908W camera) using my IP Cam Viewer app.

The garage door switch just shorts 2 wires when pressed (this causes the garage door to take action).

The foscam has a relay that shorts 2 wires (pins 1 and 2) when turned on.

Based on this, a simple solution is to:
1. connect pin 1 of foscam to left most pin on liftmaster.
2. connect pin 2 of foscam to 2nd left most pin on listmaster.

Now, when foscam relay is turned on, the garage will go into action. however, you’ll have to remember to turn the relay OFF to allow your garage door switch to work again.
A solution for this problem is to upgrade to the next release of IP Cam Viewer (3.7.9) and enable the “Pulse Relay On” option. With this option on, click on the relay ON button in my app will actually toggle on/off the camera’s relay so you don’t have to remember to turn relay off.

So far so good, everything works, but there is one more problem. The foscam, by default, does something unexpected. When the foscam first gains power, the relay is off (normally open). Within a few seconds (~10s), the camera always turns on the relay, by default!!! This means that when you lose power to the house and then get power back, the garage door will open because of the foscam relay turning on.

It think the reason the foscam does this is because the relay was designed for use with an alarm system. By default (after 10 seconds), the relay is ON to signal all ok to the alarm system. It turns the relay OFF to trigger an alarm to the alarm system. In this case, I’m not using it with an alarm system.

The work around for this solution was a little more work. Just a get a 8 pin microcontroller and program it to delay 30 seconds before copying the camera’s relay to another relay for the garage door. A little more money is to use an Arduino (very easy to program, code given below).

Basicallly, use digital io 2 to read camera relay and use digital io pin 3 to control a separate relay to trigger garage door. Here’s an example circuit for Arduino to control a relay:
http://www.ecs.umass.edu/ece/m5/tutoria … orial.html

here’s a cheap relay module on ebay (if you don’t want to wire one up):
http://shop.ebay.com/i.html?_nkw=lm2596+module

Finally, don’t forget to enable the “Pulse relay ON signal” option in my app, found under Edit Camera -> More Options.

Here’s my arduino code:


// constants won't change. They're used here to
// set pin numbers:
const int buttonPin = 2; // ping which is HIGH when camera relay is shorted/closed, LOW when camera relay is open
const int relayPin = 3; // the number of the garage relay pin

// variables will change:
int bInitialized = false;
int buttonState = 0; // variable for reading the pushbutton status

void setup() {
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);

// initialize the relay pin as an output:
pinMode(relayPin, OUTPUT);
digitalWrite(relayPin, LOW);

}

void loop(){

if( bInitialized == false )
{
// it seems the camera bounces relay during startup so just delay 30 seconds on power up
delay( 30 * 1000 );

bInitialized = true;
}

// wait until camera relay goes low
while( true )
{
buttonState = digitalRead(buttonPin);
if( buttonState == LOW )
{
break;
}
}

// wait until user clicks camera relay on
while( true )
{
buttonState = digitalRead(buttonPin);
if( buttonState == HIGH )
{
break;
}
}

// pulse garage door
digitalWrite(relayPin, HIGH);
delay( 200 );
digitalWrite(relayPin, LOW);

 

 

// delay a bit before next action to let things settle down
delay( 250 );
}

Tags:

Comments are closed.