Code Monkey home page Code Monkey logo

alexa-smart-garage's Introduction

alexa-smart-garage

A Python example of an Alexa controlled garage door using a Rapsberry Pi posing as a Belkin WeMo switch.

How it works

The Raspberry Pi poses as a Belkin WeMo switch using the Fauxmo service. The Fauxmo service allows the Raspberry Pi to be detected by an Amazon Alexa device without the need of an IoT Alexa Skill and app. This allows Alexa to perform on, off commands as well as query the status of the Fauxmo switch. The Fauxmo service is configured (see config.json) to run the garage_door_btn.py script to open/close the garage door and the garage_status.py to get the status of the door. i.e. is it open or closed?

Triggering the Door

The Raspberry Pi is connected to a relay switch that grounds the OSC (Open/Stop/Close) input port of the garage door opener. To open/close the relay switch the Raspberry Pi grounds the signal input.

Sensing the Door Status

Two photo resistors (a.k.a LDR) were used to detect the status of the door. One LED on the garage door opener lit up solid when the door was open, the other when closed. Each LDR was placed over the garage door opener status LEDs and a luminescense threshold was set in code to differentiate between LED on/off in the given environment scenarios. i.e. LED lit and ambient light present, or LED lit and no ambient light present.

Installing & Configuring Fauxmo

  1. Install Raspbian Lite on the Raspberry Pi, go through the motions of setting up locale, wifi, etc...
  2. Clone the fauxmo and fauxmo-plugins git projects to the /home/pi location
  3. Clone this repository in your /home/pi directory.
  4. Copy the fauxmo.service and garage.door.service files to /etc/systemd/system/ (you will need sudo do do this)
  5. Update systemd sudo systemctl daemon-reload && sudo systemctl enable fauxmo.service && sudo system enable garage.door.service
  6. Start the services sudo systemctl start fauxmo.service && sudo systemctl start garage.door.service

Alexa, open/close garage door

  1. With the Alexa device on the same network as the Raspberry Pi, Open the Alexa app and select add a device
  2. Select Other Devices
  3. Wait for the app to finish scanning
  4. The Belkin WeMo Switch should be detected
  5. It will appear as Garage Door and only have on/off keyword capability. i.e. 'Alexa, turn on Garage Door'
  6. (Optional) Create an Alexa Routine in the app with whatever key-phrase you want e.g. 'Alexa, Open Seasame!'

Wiring & Components

This project uses:

  • 1 x Raspberry Pi
  • 2 x Light Dependent Resistors (LDR) RD3485 (Dark Resistance: 0.5M Ohms/min, Light Resistance: 2.8k Ohms/min)
  • 2 x 1uf Capacitors
  • 1 x 5v relay switch
  • Wire & Solder
  • Prototyping Breadboard

Note: The black and red wires coming from the top of the relay switch are connected to the GND and OSC terminals on the garage door opener.

alternative diagram

Door Logic

The python scripts follow the following state machine:

alternative diagram

Prototype

alternative prototype alternative prototype alternative prototype

References

alexa-smart-garage's People

Contributors

stephenohair avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.