element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
In the Air Design Challenge
  • Challenges & Projects
  • Design Challenges
  • In the Air Design Challenge
  • More
  • Cancel
In the Air Design Challenge
Blog AirMobile - 4 - Installing OpenHAB on BeagleBoard
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: amgalbu
  • Date Created: 14 Nov 2014 3:41 PM Date Created
  • Views 1204 views
  • Likes 3 likes
  • Comments 11 comments
  • iot_distributed
  • openhab
  • in_the_air
  • beaglebone-black
  • beagleboard
Related
Recommended

AirMobile - 4 - Installing OpenHAB on BeagleBoard

amgalbu
amgalbu
14 Nov 2014

Installing OpenHAB on a Beaglebone Black

 

This post is about installing the OpenHAB home automation software onto the BeagleBone Black. The idea is to collect data from the AirVantage cloud and make automation decisions based on that data

For BeagleBone Black development, i found the homepage of Derek Molloy (http://derekmolloy.ie/) to be extremely helpful, most of the below setup-steps can be found there. However, that page refers to Angstrom distribution, whereas I installed Debian (see @fvan post in this challenge for more info about installation). So this post details the procedure for installing OpenHAB on Debian


1. Installing the Java JRE


Since the Oracle JRE is reported to perform much better than the OpenJVM implementation, I decided to use the first option. JRE can be downloaded here:

http://www.oracle.com/technetwork/java/embedded/downloads/javase/java-embedded-java-se-download-359230.html?ssSourceSiteId=ocomen

http://download.oracle.com/otn/java/ejdk/8-b132/ejdk-8-fcs-b132-linux-arm-sflt-03_mar_2014.tar.gz

 

I copied this to /home/debian and extracted the file:

# mkdir /usr/java
# cd /usr/java
# tar xfvz /home/debian/
ejdk-8-fcs-b132-linux-arm-sflt-03_mar_2014.tar.gz

 

The bin-folder can be added to the search-path by adding it to the PATH environment variable and I also exported the JAVA_PATH variable:

# export PATH=$PATH:/usr/java/ejdk1.8.0/linux_arm_sflt/jre/bin
# export JAVA_HOME=/usr/java/ejdk1.8.0/linux_arm_sflt/jre

 

These two lines can be added to ~/.profile (the users shell profile file) to have it set automatically upon next login.

 

2. Installing OpenHAB

The next step was to install OpenHAB. Just copy the OpenHAB folder into /home/debian/openhab.

I made some changes to start.sh, in particular I created an environment variable

JAVA=/usr/java/ejdk1.8.0/linux_arm_sflt/jre/bin/java

 

and replaced "java" with this variable in the invocation of the runtime

$JAVA -Dosgi.clean=true -Declipse.ignoreApp=true -Dosgi.noShutdown=true -Djetty.port=$HTTP_PORT -Djetty.port.ssl=$HTTPS_PORT -Djetty.home=. -Dlogback.configurationFile=configurations/logback.xml -Dfelix.fileinstall.dir=addons -Djava.library.path=lib -Djava.security.auth.login.config=./etc/login.conf -Dorg.quartz.properties=./etc/quartz.properties -Dequinox.ds.block_timeout=240000 -Dequinox.scr.waitTimeOnBlock=60000 -Dfelix.fileinstall.active.level=4 -Djava.awt.headless=true -jar $cp $* -console

 

OpenHAB will now run (when configured properly) when the start.sh script is invoked. As I want OpenHAB to start automatically after a reboot, some additional work have to be done:

 

3. NTP Support

Next thing was installing the NTP support for the beaglebone. As the systems RTC is not battery buffered,  he date and time information will be lost upon each power cycle. I worked around this by syncing the time via NTP upon each startup

NOTE: I experienced some problems with the led_aging script, so I temporarily removed it

# mv /etc/init.d/led_aging.sh /etc/init.d/_led_aging.sh

First the NTP package has to be installed:

# sudo apt-get update
# sudo apt-get install ntp

 

Then /etc/ntp config file needs to be changed, basically to use the local NTP servers from the ntp.org timeserver pool.

# This is the most basic ntp configuration file
# The driftfile must remain in a place specific to this
# machine - it records the machine specific clock error driftfile /etc/ntp.drift
server 0.it.pool.ntp.org
server 1.it.pool.ntp.org
server 2.it.pool.ntp.org
server 3.it.pool.ntp.org


After that, the local timezone needed to be adapted by letting the symlink /etc/localtime point to the right zone-file:

# rm /etc/localtime
# ln -s /usr/share/zoneinfo/Europe/Rome /etc/localtime

Upon next reboot, the date and time should be correct.

4. Autostart OpenHAB

To automatically start OpenHAB when BeagleBone boots, let's create a file openhab in /etc/init.d

#sudo nano /etc/init.d/openhab

Add the following content

#!/bin/sh

### BEGIN INIT INFO

# Provides: openhab

# Required-Start: $remote_fs $syslog

# Required-Stop: $remote_fs $syslog

# Default-Start: 2 3 4 5

# Default-Stop: 0 1 6

# Short-Description: Start OpenHAB at boot time

# Description: Start OpenHAB at boot time

### END INIT INFO

 

USER=debian

HOME=/home/debian

export USER HOME

 

case "$1" in

  start)

    echo "Starting OpenHAB"

    $HOME/openhab/start.sh

    ;;

  stop)

    echo "Stopping OpenHAB"

    killall java

    ;;

  *)

    echo "Usage: openhab {start|stop}"

    exit 1

    ;;

esac

 

exit 0

 

and save the file.

Now grant execution permissions to the file

# cd /etc/init.d
# chmod 755 openhab

Now let's create a link to the script file in rc5.d (this directory includes all the scripts that are executed when system enters run level 5, which is the default runlevel)

# ln -s /etc/init.d/openhab /etc/init.d/rc5.d/S18openhab

Finally, let's update the service entries

# updaterc.d /etc/init.d/openhab defaults

If you get an error, try

# updaterc.d openhab defaults

 

5. Setting up a Samba

To make the copy of configuration files easier, Samba can be a valuable approach. Install the SMB server via apt-get:

# sudo apt-get install samba
# smbpasswd


Edit the Samba config file:

# sudo nano /etc/samba/smb.conf

 

I stepped through the config and configured samba to the local needs, most defaults already fitted. I installed a new share:

[openhab]

comment = OpenHAB
path = /home/debian/openhab
public = yes
writable = yes
printable = no
write list = root

 

That's all... I am now ready to get data out from the cloud by means of MQTT

  • Sign in to reply

Top Comments

  • amgalbu
    amgalbu over 10 years ago in reply to markvenn +1
    Hello Mark I just made a quick test with openhab with a very limited configuration so I don't know what will happen with a real configuration. I will let you know! Bye Ambrogio
  • markvenn
    markvenn over 10 years ago in reply to amgalbu

    Thanks Ambrogio. Look forward to reading as your progress.

    Mark

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • amgalbu
    amgalbu over 10 years ago in reply to markvenn

    Hello Mark

    I just made a quick test with openhab with a very limited configuration so I don't know what will happen with a real configuration. I will let you know!

     

    Bye

    Ambrogio

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • markvenn
    markvenn over 10 years ago

    A great description, thanks for the methods.

    I wondered about BBB and openhab, are you seeing problems with the system running out of resources or being slow?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • amgalbu
    amgalbu over 10 years ago in reply to nikil511

    I had no benchmark, just assumptions...

    I will make a try with the hardfp

     

    Thanks!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • nikil511
    nikil511 over 10 years ago in reply to amgalbu

    Have you found any performance benchmarks comparing headless with headful ?

    I always assumed that headless justs saves space, nothing more.

    Anyway, hardfloat + openhab works fine (see my post) and I think it makes sense to improve performance for secure HTTP applications etc.

    [Air ex Machina] #04 Beaglebone for dummies - JAVA,OpenHab

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube