The Omega_garage simply controls your garage door and allows you to retrieve the doors state (open, or closed). Using nodejs and expressjs, a web server is hosted on the the Onion Omega. The server hosts an API that allows you to control your garage doors and request their states. This makes the Omega_garage easy to integrate with any other pre-existing smart home control hub such as Home Assistant.

The Software


The Onion Omega supports a few of todays leading programming languages, include nodejs. The actual code size is astonishingly small, but unfortunately the overhead of nodejs is a little more. This will nearly fill your 16mb of code space.

To setup the software run through these steps:

  1. Get your Omega and Power Dock (or Expansion Dock) and run through the setup procedure here
  2. Install nodejs
    1. opkg update
    2. opkg install nodejs
  3. Install git
    1. opkg update
    2. opkg install git git-http
  4. There are two options on how to run omega_garage:

The Breadboard


The breadboard mock up for this project was made a lot simpler by using relays that have been built with the proper resistors to connect to a small micro controller such as the Onion Omega.  I bought one for fairly cheap ($7) that had 4 relays on it. SainSmart relay. You also need to get some magnetic proximity sensors. Most of these will work.

In the pictures below, you can see the prebuilt relay board. The I/O lines from the relay board can connect directly to the 5v or 3.3v lines on the Onion Omega, just be sure there is enough power to trip the relay. The control lines can connect to just about any GPIO lines on the Omega.

The Prototype


The breadboard came together really nicely during this project, as did the prototype board! There is something to soldering a header to a perf-board. It’s like you are that much closer to seeing your project come to life.

Final Install


The final installation turned out ok for a garage scenario. An enclosure is planned for the future to help tidy things up and protect the Omega Garage.

Install Omega Garage


To Install on Omegas with only 16 MB of Flash storage

Manuallly Clone the omega garage repo into /tmp/omega_garage

git clone https://github.com/JimJamUrCode/omega_garage.git /tmp/omega_garage

Move the config file to your home directory

mv /tmp/omega_garage/config.json /root/config.json

Modify the config.json file with the appropriate credentials

Move the ‘startOmegaGarage’ file to the ‘/etc/init.d’ directory and grant it rights to execute

mv /tmp/omega_garage/startOmegaGarage /etc/init.d/

chmod +x /etc/init.d/startOmegaGarage

Enable the new init.d script to make the service run at boot. The startOmegaGarage script will load the omega_garage repo into RAM and start the server.

/etc/init.d/startOmegaGarage enable

Reboot the onion omega to make sure that the startOmegaGarage script is executed upon reboot.

reboot

OR To Install on Omegas with more than 16 MB of Flash storage


Manuallly Clone the omega garage repo into your home directory

git clone https://github.com/JimJamUrCode/omega_garage.git /root/omega_garage

Move the config file to your home directory

mv /root/omega_garage/config.json /root/config.json

Modify the config.json file with the appropriate credentials. Also the configuration file needs to correctly correspond with the pins that you have connected your relays and sensors to. Choose your pins wisely. Move the ‘startOmegaGarage’ file to the ‘/etc/init.d’ directory and grant it rights to execute

mv /root/omega_garage/startOmegaGarage16mbplus /etc/init.d/

chmod +x /etc/init.d/startOmegaGarage16mbplus

Enable the new init.d script to make the service run at boot. The startOmegaGarage script will load the omega_garage repo into RAM and start the server.

/etc/init.d/startOmegaGarage16mbplus enable

Reboot the onion omega to make sure that the startOmegaGarage script is executed upon reboot.

reboot


Config File Notes

I had to run some tests to ensure that when the power went out, and then came back on, my garage door didn’t try and open. Depending on the relay you make/buy, and the pin you assign it to, it may activate your garage door when the Omega is powering on. The config file that is included uses pin 6 and 7 for relays because the Omega naturally boots with them in the output state with the pins set to active high. The magnetic relays are on pins 23 and 26 because once again the Omega boots with them set as inputs.


Source code is on Github: Omega_Garage


This project and its instructions for installation have been compiled on hackaday.io as well.