We’ve already talked about the relative merits of Arduino and Raspberry Pi — they each have their own strengths. They don’t have to be either — combine them to get the best of both worlds. Home automation is the perfect candidate for this. The home automation market is flooded with expensive consumer systems that are incompatible with each other and costly to install. If you have a Raspberry Pi and Arduino, you can basically do the same for a fraction of the price if you’re willing to put in the time and effort.
Update: Since this article was written, I’ve discovered OpenHAB, a free and open source home automation platform that runs on the Raspberry Pi and can be integrated with a huge range of prebuilt smart home kits as well as Arduino. Watch the video below to see the top of the line, then skip to Getting Started with OpenHAB for Raspberry Pi guide to learn more.

Heimcontrol.js is a Node.js application built to run on the Raspberry Pi. Combined with an Arduino and some standard remote control sockets, this makes it easy to control AC devices. You can add temperature sensors and even control your TV — but today we’ll stick to the basics and expand on the project in the next tutorial.
Here is the breakdown of the project:
- The Raspberry Pi will act as the brain and gateway of operations — it will run a Node application tied to a Mongo database and provide a front-end interface to any web browser.
- The Arduino, powered by the Pi, will communicate between the electronics — the radio control’s power switches.
For this you will need:
- Arduino and Raspberry Pi
- Some sockets and a remote controller (I used these)
- Powered USB hub
Before we get started, here is a demo video from the creator of the project himself.

Start over
We are going to use Raspian for this project. and I highly recommend starting with a fresh install if you’ve done other hacks and such before. Download the latest Raspian image, copy it to your SD card, and be sure to expand the filesystem and enable SSH. The rest of this guide assumes that you have done this and are connecting via SSH using the default user.
If you haven’t already, this video explains the process of preparing your SD card in OS X:

And this one for Windows users:

preparation
The installation process is quite laborious, and follows from the instructions here. Unfortunately they were outdated or not intended for Raspian, so I have adjusted them significantly below. The codes below can basically be pasted in blocks — you don’t have to paste one by one. Since we’re putting together a few things on the Pi itself, keep in mind that this whole process will take a long time. I’d say go make yourself a cup of tea — but when I say «long» I mean the best part of the day — so 178 cups would be more appropriate.
All commands must be entered into the Terminal and you may need to press Enter at some points. These first few commands will update the system and install the prerequisites:
sudo apt-get update sudo apt-get upgrade sudo apt-get install git-core git scons build-essential scons libpcre++-dev xulrunner-dev libboost-dev libboost-program-options-dev libboost-thread-dev libboost-filesystem-dev
Next, we need to install Node:
sudo mkdir /opt/node wget http://nodejs.org/dist/v0.10.2/node-v0.10.2-linux-arm-pi.tar.gz tar xvzf node-v0.10.2-linux-arm-pi.tar.gz sudo cp -r node-v0.10.2-linux-arm-pi/* /opt/node sudo ln -s /opt/node/bin/node /usr/local/bin/node sudo ln -s /opt/node/bin/npm /usr/local/bin/npm
Add a PATH variable to your profile so the OS knows where Node. Use the nano text editor like this:
sudo nano /etc/profile
Find the line that says export PATH and replace it with:
NODE_JS_HOME="/opt/node" PATH="$PATH:$NODE_JS_HOME/bin" export PATH
Press Ctrl-X to exit and Y to save.
You may need to logout and log back in for the path changes to take effect, but you can check with the command: