Project Description

Description:

The following outlines how to build an Arduino Garage Door Opener that integrates into OpenHAB/MQTT. This is designed to work with an Arduino Uno Rev3 with Ethershield board .

OpenHAB and Mosquitto:

 

The Arduino code has been written specifically to work with Open HAB(open source home automation software) and an MQTT broker such as Mosquitto (a messaging subscribe/publish type protocol that is lightweight and great for communication between devices) Don’t let the names or acronyms scare you, they are really quite simple to use once you get to know how they work. I utilise OpenHAB on a NTC C.H.I.P  however many people use a Raspberry Pi or similar. This tutorial assumes you have implemented OpenHAB .

To install Mosquitto, following this link then select the type of device you are using and follow the instructions. Because C.H.I.P runs Debian (Jessie), you can follow the Raspberry Pi instructions if you are using C.H.I.P. for your Home Automation device (also note, its best to reconfigure CHIP to boot from the CLI. There are instructions for this here)

Once you have OpenHAB and Mosquitto running, you need to prepare the Arduino IDE for the code below. First, you need to add the PubSubClient library. In the Arduino IDE, from the menu’s go to Sketch, Include Library, Manage LibrariesIn the filter search box, type PubSubClient then highlight the search result and click to Install (at time of writing, the latest version is 2.6.0) You will also need the Ethernet library which covers extensions for the Ethernet shield.

The Garage Door opener does 2 things. First, it provides a button in OpenHAB to activate the door to open or close. Secondly it provides feedback to OpenHAB on the status of the door (either open, closed or partially open)

Hardware:

• Arduino uno R3

• Ethernet Shield

• 5 V relay

• 1K resistor

• Transistor(2N2222)

•Diodes

• Reed Swictes

The resistor, transistor and diode help create the circuit to the relay, which is triggered by a button in OpenHAB to open/close the door. The reed switches provide feedback to OpenHAB as to the garage doors status. These parts can be sourced cheaply from any electronics shop. Using these components is also the recommended way to configure the Arduino with a relay as per the Arduino site (note: the LED on the breadboard below is simply for test purposes, the red/black wires will usually go to the garage door opener)

180

With the garage door in an ‘open’ state as shown below, clicking the ‘Close’ button will trigger OpenHAB to send an MQTT message to the Arduino, the Arduino will then open the relay for 1 second, causing the door to close. The (door open) reed switch will become open which the Arduino will pick up and send a new door status back to OpenHAB which will then display the updated status ‘Partially Open’ until the door fully closes, at which stage the (door closed) reed switch will close, this will be detected by the Arduino which will then send a new message to the MQTT broker and status will then update to ‘Closed’ .

182

 

 

 

More information:

http://www.chimera.co.nz/electronics/garage-door.ino