Introduction: Intel Galileo Garage Monitor

Picture of Intel Galileo Garage Monitor

The intel Galileo is an amazing platform to make IoT devices. This is an example of using Python and a few sensors to create a garage monitor/alarm system.

Step 1: Parts

Picture of Parts

You will need the following parts:

-Intel Galileo

-Intel Galileo compliant Wifi card

- 2x Overhead Door Switch http://www.amazon.com/Potter-Amseco-ODC-59A-Overhe...

-1x Magnetic Door Switch https://www.sparkfun.com/products/13247

- 3x 1K resistors

- Arduino Proto Shield http://www.amazon.com/Arduino-Proto-Shield-R3-Asse...

- 3x Screw Terminals https://www.sparkfun.com/products/10571

- DuinoCase Enclosure http://www.amazon.com/duinoCase-G2-Quality-Metal-E...

-TMP36 Temp Monitor https://www.sparkfun.com/products/10988

- Terminal Block https://www.sparkfun.com/products/13061

Step 2: Assemble

Picture of Assemble

Assemble your switches. I wanted to make this modular but also a production service, so I needed to move beyond the solderless breadboard.

To do that I used a Arduino Protoshield and screw terminals. This would allow me to open the case and tinker while also being hardwired.

Step 3: Case

Picture of Case

I added a 6 screw terminal block to the outside of the DuinoCase to make wiring it to the switches easier.

Step 4: Switches

Picture of Switches

Install your switches at the door and attach it to the terminal blocks

Step 5: Software Prerequisites

Picture of Software Prerequisites

You will need to install flask and gunicorn. To do that you need to use pip.

Pip relies on ez_setup, so install that first. If you have not installed PIP, follow these instructions.

curl https://bootstrap.pypa.io/ez_setup.py -o ez_seetup.py

python ez_setup.py --insecure

Then you must install PIP. curl https://bootstrap.pypa.io/ez_setup.py -o pip-8.0.2.tar.gz

tar -zxvf pip-8.0.2.tar.gz cd pip-8.0.2

python setup.py build install

pip install gunicorn

pip install Flask

Step 6: Code Overview

Picture of Code Overview

Now we get to the heart of the matter. This consists of 2 scripts, one which will run every minute to make DB entries and send emails. The other script is the flask web server.

The scripts can be downloaded from GitHub here: https://github.com/joemcmanus/galileoGarageMon

You want to read the door pins with mraa.

In python you will import mraa, define a pin, then read it.

pin=mraa.Gpio(7)
pin.dir(mraa.DIR_IN)

pinVal=pin.read()

Step 7: Door Code

Picture of Door Code

The script that will monitor your doors for email purposes is called door.py. It will run as a systemd process and start on boot.

Edit the mailto and mailfrom lines to receive email.

Step 8: Flask

Picture of Flask

The web server is written in python using flask. You will want to copy the flask folder from git hub in to /data/flask .

There is a login page... although I am not doing anything with it in this first version.

Step 9: Startup Processes

Picture of Startup Processes

You will want all of this to start on boot. In this IoT OS we will use the systemd unit files to get this working.

Copy the garage*.service files /lib/systemd/system/

Then add them to the startup process using systemctl enable .

systemctl enable garagemon.service
systemctl enable garagealert.service

Start it up!

systemctl start garagemon

systemctl start garagealert

Step 10: Email

Picture of Email

Sample email shown. It will email if a door is open more than 5 minutes.

Step 11: Web Interface

Picture of Web Interface

If you browse to http://yourGalileo.local you will see the status of the doors. There is also a temperature read out... because why not?

Next version will allow you to edit the time frame for alerts and email info from the web.

Step 12: Done

Picture of Done

I hope you enjoyed checking out an example of a garage monitor/alarm system using the Intel Galileo Gen 2 and python.

Comments

andrew76092 (author)2016-04-14

Seems to be quite a lot involved for just a notification of open/close. I was able to build a 100% wireless garage door operator using the Particle Photon. When I leave for the day, I tell my Amazon Echo, “Alexa, open garage”.....based on my iOS proximity and the app, IFTTT, the garage door closes automatically. When I’m 100 yards from my home the garage automatically opens. During the day, I can “check in” both through the streaming camera and by running a recipe on IFTTT to be sure it was closed. Don’t get me wrong, using any type of technology in our lives is great, I was just making comment that it seemed to be a little overkill. Of course, with 4 Edison’s and 4 Galileo’s to my name, I still have not done anything with them...yet.

joe (author)andrew760922016-04-14

Hey Andrew - Congrats on making something cool. I'd love to check out your project, is it here on instructables?

As with most gadgets on instructables there is almost always a better way to accomplish it, it's the journey not the destination as they say. For instance everything in this instructable and the project you described can more or less be done plug and play with a MyQ by Chamberlain http://www.chamberlain.com/smartphone-control-products/myq-smartphone-control

This is all open source released under the GPL, Feel free to take the code and make it less complex using an Intel Galileo. I'd love to check it out.

Cheers,

-Joe

About This Instructable

2,520views

39favorites

Bio: I like to tinker with just about anything, sometimes it works out in the end. Have fun looking at the projects, try tearing something open ... More »
More by joe:Intel Edison Garage Monitor and Alert SystemIntel Edison Fat Bike Tire AnalyzerIntel Galileo Garage Monitor
Add instructable to: