Triggering Actions on Smart Home Devices with Arduino

3 min read Michael Carroll on Nov 19, 2014

It’s time to crack open this blog with a post dedicated to my first home automation mini-project – opening and closing my garage doors by replacing the original RF (Radio Frequency) remote control with my mobile phone.

For this I’ve decided to use an Arduino with Ethernet Shield:


Idea and Approach

Idea and Approach

The idea initially came up when I wanted to replace my central heating system control with Nest, which would not work in my case because the only way to control the heating system is by a RF remote control.

Then I saw Bradley’s SwitchIt video which gave me another idea – to capture the RF signal from the remote and then replicate it by using Arduino and RF Transmitter/Receiver. Having one remote to control all the different settings for the heating system seemed a bit complex (it must be very long and variable signal) for a first project, which led to this simpler use case to begin with, where the remote has a fixed RF code – the garage remote!

I know, I’m a little bit late in the game, though I still found it a bit challenging and wanted to share my solution. Every case is unique and there is no right or wrong solution nor there is an example out there that will work 100% for your idea or project without having to adjust bits and pieces.



I didn’t want to build a mobile app specifically for this idea, I could leverage the Salesforce1 App and build just a VisualForce page so that was an easy decision. The interesting part was how to connect the Arduino to the SF1 app…

I also didn’t want to open ports on my router at home, so it had to be some service that the Arduino can connect to, from behind the router. Ideally the Arduino would subscribe to a push notification channel (using some online service that supports web sockets) and the VF page will trigger an event on a click of a button on the same channel to which the Arduino is subscribed to receive notifications.

The ideal service would offer support for both, Arduino and JavaScript. After a bit of a research I discovered PubNub, who offered a free account and both have Arduino and JavaScript libraries. The reason I went with PubNub is because I found their JavaScript library easier to use, as well as better overall support (Stephen Blum instantly offered help on twitter).


The most challenging part was to find the RF code from the garage remote using a RF receiver module. This 433.92MHz transmitter/receiver module from eBay ($1 including postage) proved to be sufficient.


Basically what I had to do was to listen to the incoming signal from the original garage remote, capture the highs and lows and their frequencies. There are a few libraries that can do that (VirtualWireRCSwitch and others) but they all have their own patterns and ways of encoding data, so that wouldn’t cut the mustard.

The quickest (I’m not saying the cleanest) way was to listen on one of the analog ports on the Arduino and determine whether a high or low signal was received and measure the frequency. I found a really good tutorial on how to do that and also visually represent the signal so that it’s easier to replicate it later – credit goes to Arduino Basics. Once I found the code, it was easy to re-transmit. So this is what the final code on my Arduino looks like:


As I mentioned above, this was the easiest part of this mini-project. Just a page with a couple of buttons and a few lines of JavaScript code in order to trigger an event to the PubNub channel to which the Arduino is subscribed to and listening for events:

That’s it! Check out the video below for real-life demo:

My next step is to write a pebble app for the scenario above, as well as add functionality to arm/disarm the alarm on my house, so watch this space!