Skip to content

Latest commit

 

History

History
63 lines (40 loc) · 2.88 KB

README.md

File metadata and controls

63 lines (40 loc) · 2.88 KB

Garage-node

This is the node.js app that is controlling my garage door openers via Raspberry Pi. To get the full details on my project check out my post on my blog.

Requirements

Install node.js and npm onto your Raspberry Pi.

[sudo] apt-get install nodejs npm

I recommend using forever to run your app so that it stays up.

[sudo] npm install forever -g

Installation

After checking out this code from Github, just run npm install from the app directory to install all dependencies.

Dependencies Used

I used pi-gpio over rpi-gpio because I liked the fact pi-gpio made use of GPIO Admin, allowing you to be able to control the gpio pins without being the root user. Couldn't get rpi-gpio to use that.

Configuration

In the root directory there is a file called config.js. In here you will find several variables that should be changed to work for your garage.

  • LEFT_GARAGE_PIN - Location of the gpio pin controlling the left garage door. Using the pin map from the pi-gpio README.
  • RIGHT_GARAGE_PIN - Same as above but for the right garage door.
  • RELAY_ON - Relay on state.
  • RELAY_OFF - Relay off state.
  • RELAY_TIMEOUT - How long the relay should stay on before turning off.

Gotchas

My particular relay I used turns on when you fire low 0, and off when firing high 1. The app them use the RELAY_TIMEOUT to simulate a half second press, as if you pushed the wall switch.

The Raspberry Pi defaults the GPIO pin to low, but the pin is default set to input so it will not immediately fire on bootup. On first call the pin is opened for output and immediately low which turns on the relay since it's in the low state and making the set low call redundant but the relay is set high in the next call so it will need to be set low again on the next call.

Todo

  • Error handling, currently there really is none.
  • Logging.

Parts

Links