Seems like even though the documentation already exists, everyone is writing one of these. So I thought I would add mine as well, but with my little twist.

The first thing you need to do when you get your raspberry pi, is get a case? Well you can 3D print one. Here is a good example for the B+ Raspberry Pi B+ Face Case by adafruit - Thingiverse

Additionally you need to buy a micro SD card. I got an 8GB one and I have my primary RPi which a download server and WebIOPi server with a 16GB one.


Install an OS and setup things

Next you need to install an OS. Go to and download the latest version. I recommend the torrent way. Depending on what you are using on your computer, you need a way to write the OS image to your sdcard. NO you cannot simply copy it to the card and be done with it. For windows, you need win32disk imager and for linux you need either dd or imagewriter. Check out this link for the "official" methods.


The first time you put this card in the pi will start the configuration util automatically. Hence you need to attach a display and keyboard the first time. I suggest the following things be done.

  1. Expand the file system to use the entire card.
  2. Enable SPI
  3. Enable SSH

Most of the above is menu based so should not be a problem. This is the basics and if you want more, you can take a look at these.

The geek getting started guide to the Raspberry Pi | The Embedded Code

Adding a Shutdown Button to the Raspberry Pi | The Embedded Code

RPi Wi-FI Auto Connect and static IP | The Embedded Code

The above are currently at a wordpress blog but I am considering shifting everything to element14. There is no backup posts option at element14 and I have had content disappear before.


Setting up OpenHAB


Now the default method is to install OpenHAB is to download it and unzip it to /opt/OpenHAB and then do all the stuff. Now I don't think that is compulsory since there will be only one user for our tests. Hence I installed it directly in /home/pi/OpenHAB. Copy the code below into a file setup and save it in /home/pi


# Create a folder
mkdir /home/pi/OpenHAB
wget -O /usr/bin/rpi-serial-console
sudo chmod +x /usr/bin/rpi-serial-console
echo "Disable serial Console so that we can use it for EnOcean Pi"
rpi-serial-console disable
echo "Downloading Runtime"
wget -O /home/pi/OpenHAB/
echo "Installing..."
unzip /home/pi/OpenHAB/ -d /home/pi/OpenHAB/
echo "Getting addons"
wget -O /home/pi/OpenHAB
echo "Installing addons"

unzip /home/pi/OpenHAB/ -d /home/pi/OpenHAB/addons/
echo "Default Configuration"
cp /home/pi/OpenHAB/configurations/openhab_default.cfg /home/pi/OpenHAB/configurations/openhab.cfg


Run the above script by executing the following command at the terminal

sudo sh

At this point, you have all that you need. You can download the demo setup from the website as well. The link is openHAB - empowering the smart home


In order to start OpenHAB, cd to the OpenHAB directory and type sudo sh . I made a change in the file as per the link

The serial port needs to be pointed to for the EnOcean Pi to work. I recommend a reboot at this time.


Installing Samba and Sharing OpenHAB

Now I use windows has my primary laptop OS hence I would like to make changes to the OpenHAB system and develop then and there. I have already setup a static IP which means everytime my RPi boots up, it's IP address is the same. I can ssh and then use nano to edit files BUT there is a better option- OpenHAB Designer. The OpenHAB designer is based on eclipse and all you need to do it tell it to open the configuration folder in OpenHAB. But If I use Windows and I want to access the folder, how is it possible?

This is where Samba comes in. It allows us to share the OpenHAB folder we created and share it like a windows share. Then on my windows laptop(which is on the same local network) I can simply "Map network drive" and use the same username and password to access the folder if it was a drive somewhere. Then point OpenHAB designer to it and viola!


To install Samba, you need a terminal on the RPi. SSH to you RPi and then type the following commands...

sudo apt-get install samba samba-common-bin
sudo nano /etc/samba/smb.conf


At this point you will have nano editor open and the file smb.conf open in it. Find the entry workgroup and wins support in the file. Set them up as follows

workgroup = WORKGROUP
wins support = yes


If you have a different workgroup name, please feel free to make changes but the default workgroup name is WORKGROUP. Also add the following lines to the file where it says "Share Definitions"


   comment= OpenHAB Home
   only guest=no
   create mask=0777
   directory mask=0777


At this point use ctrl+x to exit. press y and enter. That should exit nano.

Now we need to set the password for the for the share.


sudo smbpasswd -a pi


Now in your windows machine, point to the ip address of your Pi and map it as a network drive. Download the OpenHAB designer from it's website and point it to the shared folder and you should be good.


At this point you can download the demo file, copy em to the share and OpenHAB do it's thing.

Hope this helps.




<< Previous Post | Table Of Contents | Next Post >>