An Arduino relay control server and Android client
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
android fix context menu bug in android fragments Nov 13, 2017
arduino fix README list numbering Nov 13, 2017
arm merge wifi server and client code into arm directory Nov 13, 2017
desktop rename c_client to desktop client Nov 13, 2017
.gitignore rename c_client to desktop client Nov 13, 2017
COPYING
COPYING.LESSER initial commit Dec 30, 2012
README.md

README.md

RelayRemote

Shane Tully (shanetully.com)

An Arduino-based relay control server and Android client

Note: This project may go long periods of time without being updated, however it is actively used and maintained. Bug reports and pull requests are welcome.

About

RelayRemote is an Arduino-based server for remotely controlling electrical relays which in turn turn on/off devices run from a standard 120V AC circuit. The project includes three clients, an Android application, a desktop client for control from Linux systems, and an Arduino-based wall switch.

The Android app supports multiple relay servers, relay groups, homescreen widgets, and NFC tags.

A demo video and brief description of how it works is available at: https://shanetully.com/2012/12/controlling-a-relay-via-an-arduino-from-an-android-client-with-nfc/

The original version of this project used an Arduino Uno and Arduino ethernet shield. See the legacy documentation for instructions on using the legacy hardware.

Hardware

Relay

RelayRemote was built and tested on an Adafruit Feather M0 WiFi. A PowerSwitch Tail II is the recommended relay.

Wall Switch

An optional piece of hardware is a wall switch for turning on/off relays more like a traditional light switch.

Usage

Setting up the hardware

  1. Connect a wire from the positive terminal of the relay to a pin between 2 and 9 (inclusive) on the Feather. Keep note of the pin you choose. Multiple relays can be connected to the same Feather by connecting them to different pins.
  2. Connect a wire from the negative terminal of the relay to a ground pin on the Feather.

Setting up the software dependencies

These instructions are for Linux (x86_64).

  • Download and extract the Adafruit SAMD library to ~/.arduino15/packages/adafruit/hardware/samd/1.0.9
  • Download and extract the ARM compiler to ~/.arduino15/packages/adafruit/tools/arm-none-eabi-gcc/4.8.3-2014q1
  • Download and extract Bossac to ~/.arduino15/packages/adafruit/tools/bossac/1.6.1-arduino.
  • Download and extract CMSIS to ~/.arduino15/packages/adafruit/tools/CMSIS/4.0.0-atmel.

Note: The archives above can be extracted whenever you'd like, but the paths at the top of the Makefile must be adjusted accordingly.

Compiling & Uploading

  1. Create arm/src/secrets.h with the following content:
    #define _SSID "your_ssid"
    #define _PASSPHRASE "passphrase"
    
  2. Change the network settings (IP, DNS, netmask, and gateway) for the Feather by editing the server header (arm/server.h) in the arm directory of this repo.
  3. Then:
    $ cd arm
    $ make WIFI_SERVER
    $ make upload
    

Android app

  1. Install the APK provided on the Releases page

Alternatively, the Android app can be compiled by:

  1. Install the Android SDK (http://developer.android.com/sdk/index.html).
  2. Create local.properties in the android/ directory with the following contents: sdk.dir=/path/to/android/sdk.
  3. From the android directory, run:
    $ ./gradlew assembleDebug
    $ ./gradlew installDebug
    

Desktop client

  1. If desired, build the desktop client in the desktop directory of this repo on a Linux system by running make from that directory.
  2. The desktop client is fairly straightforward. Run it with --help for more info.

Wall Switch

  1. Wire the circuit as follows: On the switch VDD is pin 1 (left most) and LED- is pin 4 (right most).
  2. Then follow the instructions in the "Setting up the software dependencies" and "Compiling & Uploading" sections above.
  3. Use make WIFI_CLIENT to build.

Networking

The default port is 2424. Don't forget to add rules to allow communication on this port on any firewalls or gateways between the client and the server.

License

Copyright (C) 2012 Shane Tully

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/.