In tutorial will make overview of using heimcontrol platform (is NodeJs application for home automation Open Source under MIT license)

Some of there features:

  • Responsive :The responsive design allows you comfortable control of your home devices using your smartphone or tablet.
  • Everywhere : Open your Raspberry PI to the world and access your home automation app from everywhere in the world.

  • Extendable: An elaborated plugin system makes it easy to extend the application with your own plugins.


  • GPIO Plugin

  • Arduino
  • RGB Lights
  • Web Cam
  • Wake on Lan

heimcontrol.js was created to gain experience in Node.js, MongoDB,
Websockets and a lot of other great technologies that were used in the project. Take a look in the package.json for a full list of used open source projects.
The project is in active development and a very early prototype, so use it at your own risk!

Full access to the GPIO of the Raspberry PiCommunication with an attached Arduino Wake-on-LAN (not really hardware, but at least it wakes up hardware)Stream your webcam via socket.io


Node.js, Socket.io, Expressjs, RequirejsHTML5, CSS3 and Websockets Jade templating Responsive design

Step 1: Get Started With Heimcontrol.js on Your Raspberry Pi

Install the dependencies: Node.js and MongoDB

heimcontrol.js has two dependencies: Node.js and MongoDB. Unfortunately, neither are currently available in the Raspbian repositories.
This can be dealt with in several ways, each of which has benefits and trade-offs:

  • Compiling the programs yourself is a safe, clean solution, but takes many hours on the Pi. Cross compilation alleviates this, but is beyond the scope of this guide (see rpi-cross if interested).
  • Installing a third party package is extremely convenient, but it puts you at the mercy of the packager, who may be neither trustworthy nor competent. In practise, using these packages for a hobby project like this is almost certainly going to be fine; but the security risk should be noted.
  • Finally, if you’re not attached to Raspbian, you could just install a distro that does supply Node and MongoDB. Archlinux fits the bill — with the obvious consequence of needing to install and configure Archlinux.The first two options are described below.

Manual compilation and installation

Install build prerequisites

First, install the following packages, which are required for the compilation.

sudo apt-get update<br>
sudo apt-get install git-core git scons build-essential scons 
libpcre++-dev libboost-dev libboost-program-options-dev 
libboost-thread-dev libboost-filesystem-dev

You may also want to use tmux:

sudo apt-get install tmux<br>
# start session:

Now, if your SSH connection is interrupted, you can reconnect and use tmux attach to continue the shell session.


The next step is to compile and install Node.js on your Raspberry Pi from the official sources:

wget  <a href="http://nodejs.org/dist/v0.10.28/node-v0.10.28.tar..." rel="nofollow"> http://nodejs.org/dist/v0.10.28/node-v0.10.28.tar...</a><br>
tar xvf node-v0.10.28.tar.gz
cd node-v0.10.28 
 sudo make install<br>


node --version 

— it should of course output the version.


If you are using a Raspberry Pi with 256MB RAM, then you have to edit the file /etc/dphys-swapfile and change the value of CONF_SWAPSIZE from 100 to 200.
You can find a Raspberry Pi version of MongoDB on GitHub: Rick Pannen’s mongopi has been working well, despite having been last updated in 2012. With the following command you can build an install it:

git clone git://github.com/RickP/mongopi.git<br>
cd mongopi
sudo scons --prefix=/opt/mongo install
scons -c

Now add the MongoDB binary directory to the PATH, for example by adding the following to /etc/environment:

export PATH

Finally you have to create a MongoDB user, the MongoDB database directory, and an init script:

sudo useradd mongodb<br>
sudo mkdir /var/lib/mongodb
sudo chown mongodb:mongodb /var/lib/mongodb
sudo mkdir /etc/mongodb/
sudo sh -c 'echo "dbpath=/var/lib/mongodb" > /etc/mongodb/mongodb.conf'
cd /etc/init.d
sudo wget -O mongodb <a href="https://gist.github.com/ni-c/fd4df404bda6e87fb718/raw/36d45897cd943fbd6d071c096eb4b71b37d0fcbb/mongodb.sh" rel="nofollow"> https://gist.github.com/ni-c/fd4df404bda6e87fb718...</a>
sudo chmod +x mongodb
sudo update-rc.d mongodb defaults
sudo service mongodb start

If the service starts successfully, you can move on to installing heimcontrol.js.

Installation from prebuilt third-party packages

Once again the disclaimer: You should be aware that installing
packages from untrusted third parties is dangerous. The sources listed below do work and appear safe at the time of this writing, but the contents could change anytime. So if you’re using heimcontrol.js for something mission-critical, a) tell us what — because that sounds cool! — and b) compile everything yourself from official sources. With that out of the way, the actual installation is really easy: Simply download and install node_arm by Nathaniel Johnson and mongodb-armhf-deb by Tom Janson as follows:

wget <a href="http://node-arm.herokuapp.com/node_latest_armhf.deb" rel="nofollow"> http://node-arm.herokuapp.com/node_latest_armhf.d...</a><br>
sudo dpkg -i node_latest_armhf.deb
# Check installation:
node -v
wget <a href="https://github.com/tjanson/mongodb-armhf-deb/releases/download/v2.1.1-1/mongodb_2.1.1_armhf.deb" rel="nofollow"> https://github.com/tjanson/mongodb-armhf-deb/rele...</a>
sudo dpkg -i mongodb_2.1.1_armhf.deb
# Start service:
sudo /etc/init.d/mongodb start
# Automatically start service at system startup, if desired:
sudo update-rc.d mongodb defaults

If the node binary is present (and returns the expected version) and the
MongoDB service starts successfully, you’re all set. (If not, please file an issue.)

Install heimcontrol.js

You only have to clone the GitHub repository and run npm install to install homecontrol.js:
(If you have Python 3 installed, run npm config set python python2.7 to make node-gyp play along.)

git clone git://github.com/ni-c/heimcontrol.js.git<br>
cd heimcontrol.js
npm install

Now you can run heimcontrol.js by typing

 node heimcontrol.js

Step 2: Arduino Plugin

With the Arduino plugin heimcontrol.js can communicate with an attached Arduino.


The Arduino plugin builds upon the duino library and allows the Raspberry PI to communicate over the USB port to an attached Arduino.


The following methods are implemented:

  • rc-switch Use your Arduino to operate remote
    radio controlled devices. This will most likely work with all popular low cost power outlet sockets. (see: http://code.google.com/p/rc-switch/)
  • sensor Read the value from sensors attached to the Arduino
  • ir-remote Control TVs and other multimedia devices with an Infrared LED attached to your Arduino. (see: https://github.com/shirriff/Arduino-IRremote)
  • Led - simple turn On / Off (High/Low) any device attached to arduino pin

Step 3: Examples Coffee Maker IoT

Heimcontrol in action with coffee maker .. This is pretty cool !!

Step 4: Example Infinity Mirror IoT

With Heimcontrol you can easy switch on and off any devices

Step 5: Example Light Switching ON / OFF

There's no more need to get up through the night or to throw different objects at the light switch.


Step 6: Something Unclear

For more information visit the web site of the platform :


<p>Very nicely done!</p>

About This Instructable




More by dmanovski:Home automation with  node js , raspberry pi  and heimcontrol 
Add instructable to: