Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
This repository was archived by the owner on Nov 13, 2023. It is now read-only.
/garaduinoPublic archive

Arduino sketch for connecting Home Assistant to a garage.

License

NotificationsYou must be signed in to change notification settings

kpfleming/garaduino

Repository files navigation

OpenSource Initiative Approved License logo

Arduino sketch for a garage-monitoring system which supports a garagedoor, light level sensing, and BLE beacon for the vehicle.

Compatible with Home Assistant, and inspired byGarHAge.

Open Source software: Apache License 2.0

 

Overview

Garaduino is an Arduino sketch designed to connect Home Assistant (orany other MQTT-enabled automation platform) to a garage, including thedoor, light level, and vehicle presence. It supports Over the Air(OTA) updates as well.

Features

Garaduino provides control of a garage door (via connection to itsopener) and status of the door; measurement of the outdoor lightlevel; and presence detection of a vehicle in the garage (using a BLEbeacon in the vehicle).

All of these features are supported via MQTT, and can be used with theHome Assistant MQTT Cover and MQTT Sensor device configurations.

In addition there is a simple read-only web interface which can be usedto troubleshoot Garaduino's connections and get raw light sensor readings.

Requirements

Hardware

  • Any ARM-based (SAM core) Arduino should be sufficient for thissketch; as of the current release the code requires less than 90KB ofFlash and less than 10KB of RAM. The sketch was developed using anArduino MKR WiFi 1010.

    Note: ARM-based boards are required because this sketch is writtenusing 'modern C++' features, and the AVR toolchains for Arduinoboards do not support those features.

  • An Ethernet interface supported by the standard Arduino Ethernetlibrary. The sketch was developed using an Arduino MKR EthernetShield.

  • Connections to two analog pins, and a door control relay on adigital pin. The sketch was developed using an Arduino MKR Relay ProtoShield.

  • For vehicle presence detection, a Bluetooth interface supported bythe standard ArduinoBLE library, and a beacon (tested with a BlueCharmBC037). Note that the code only uses the beacon's name; if the beaconalso broadcasts data it is unused, and so it does not matter whichformat the beacon uses for this data. The sketch was developed usingthe Bluetooth support included in the MKR WiFi 1010.

Software

  • Arduino IDE. Required to obtain the toolchain (compiler/linker/etc.)and libraries. It is also used to bootstrap the board so thatGaraduino can be installed (see Installation section below). The IDEcan be installed using any available method; this sketch was developedusing version 1.8.13 but any recent version should work.

  • Board package for your selected board. The simplest way to installit is to open the Arduino IDE and then plug your board into thecomputer via USB. The IDE will detect it and prompt you to allow theinstallation of the necessary package. This sketch was developed usingversion 1.8.9 of the SAM board package.

  • Standard Arduino libraries:

    The simplest way to install them is to open the Arduino IDE and selectTools->Manage Libraries from the menu, then find each one and clickthe 'Install' button.

  • arduino-timer-cpp17library. Since this is not a standard library, it can't be installedusing the Manage Libraries tool. The simplest way to install it is togo to theTags page ofthe repository on GitHub, and click the 'zip' link for the latestversion. Once the file has been downloaded, open the Arduino IDE andclick Sketch->Include Library->Add .ZIP Library, then navigate to thedownloaded file and install it. Note that you may have to update theARDUINO_LIBS variable inMakefile to include the version number ofthe library that you downloaded.

  • Arduino-Makefile. Ratherthan use the Arduino IDE for development, build, and upload, thisproject uses the Arduino-Makefile kit to allow all of these operationsto be done from the command line. Use of this kit also eliminates theneed to modify the Arduino IDE toolchain configuration to supportC++17 mode in the compiler. GNU Make will also be required, and can beinstalled using your operating system's normal software installationtools. For monitoring the output of the Arduino (when a DEBUG build isin place), see the Debugging section below. Clone this repository intoa suitable location.

  • MQTT broker. An MQTT broker will be required to communicate withGaraduino. The sketch was developed using the Mosquitto broker (whichis also the broker most commonly used with Home Assistant).

Hardware Configuration

SeeHARDWARE for connection details.

Door Sensor

A normally-open switch must be connected to an analog pin and to avoltage source compatible with the analog input of the chosenboard. In addition a pull-down resistor must be used to hold the input'low' when the switch is open.

The sketch was developed using a LittelFuse reed switch and magnet,and a 1/8W 3.3KOhm resistor installed into the provided pads on theMKR Relay Proto Shield.

Door Control

To activate a door opener, a normally-open relay must be connected toa digital pin. The relay's load pins must be connected to the pins onthe opener's control panel.

The sketch was developed using one of the relays on the MKR RelayProto Shield, wired to the control panel of a LiftMaster 8500W opener.

Light Sensor

A light-dependent resistor (LDR) must be connected to an analog pinand to a voltage source compatible with the analog input of the chosenboard. In addition a pull-down resistor must be used to hold the input'low' when the LDR in its 'open' (dark) state.

The sketch was developed using an NTE 02-LDR2 and a 1/8W 100KOhmresistor installed into the provided pads on the MKR Relay ProtoShield. The high resistor value was chosen in order to providesufficiently wide range between 'light' and 'dark' states of the LDR.

Vehicle Sensor

As noted above, a BLE beacon must be configured to broadcast aconsistent name.

The sketch was developed using a BlueCharm BC037, which was configuredusing the Eddystone Android app.

Software Configuration, Build, and Installation

SeeBUILD.

Debugging

SeeDEBUG.

Web interface

Once Garaduino is up and running, use a browser to navigate to itsIP address (or hostname, if one has been assigned). Garaduino willdisplay something like this:

Garaduino web interface

Home Assistant

SeeHOMEASSISTANT.


[8]ページ先頭

©2009-2025 Movatter.jp