Archive

Archive for the ‘Uncategorized’ Category

Running camel-tinkerforge on Karaf

Running the Camel-Tinkerforge component is really easy on Karaf. The ready to go feature files make installation easy, and the use of the auto-deployment directory makes testing different route configurations also easy.

The camel-tinkerforge component is part of the Camel-labs IoT project. We just got started with this so the first release is still pending. This means you need to checkout the code from https://github.com/camel-labs/camel-labs and run “mvn install -DskipTests=true”. There’s no need to run the tests since the buildserver has already done that. 🙂

To intall Camel-Tinkerforge on Karaf 2.x run the following commands in the Shell:

features:chooseurl camel 2.15.2
features:install camel-blueprint

features:addurl mvn:com.github.camel-labs/camel-tinkerforge/0.0.0-SNAPSHOT/xml/features
features:install camel-tinkerforge

Now create a file with the following content:

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
    <camelContext xmlns="http://camel.apache.org/schema/blueprint">
        <route>
            <from uri="tinkerforge:/temperature/T9"/>
            <to uri="log:default"/>
        </route>
    </camelContext>
 </blueprint>

Run log:tail in the karaf Shell and copy the xml file to the deploy directory in the karaf installation directory. Notice how Karaf starts the camel routes defined in the xml file, and writes messages to the log whenever the temperature changes.

Now you can start experimenting with different routes in the xml file, and as soon as you save the file Karaf will automatically reload the routes.

Advertisements
Categories: Uncategorized

How to control the fan speed on the Odroid U3

January 25, 2015 Leave a comment

I noticed the (optional) fan on my Odroid U3 frequently spinning up only to shut down again 1 second later. This appeared rather buggy to me so I looked into how to control the fan. This is what I found:

You can switch the fan into ‘auto’ or ‘manual’ mode:

echo auto > /sys/devices/platform/odroidu2-fan/fan_mode
echo manual > /sys/devices/platform/odroidu2-fan/fan_mode

Note: The ‘odroidu2’ part of the path is not a typo! Strangely enough the U3 uses the same device path as the U2.

Once you’ve switched the fan into manual mode, you can set the speed of the fan by echo-ing a value between 0 (0%) to 255 (100%) to the fan controller:

echo 0 > /sys/devices/platform/odroidu2-fan/pwm_duty (fan off)
echo 255 > /sys/devices/platform/odroidu2-fan/pwm_duty (fan on full speed)

Fun fact: You can get into an argument with the automatic fan controller by setting the fan speed while in auto mode. The fan will respond to your command but the automatic controller will shut it down after noticing what you did. 🙂

While playing with the fan use the following command to read the CPU temperature:

cat /sys/devices/virtual/thermal/thermal_zone0/temp

And to run a CPU stress-test that utilizes all 4 cores use this command:

sudo openssl speed -multi 4

User xana (among others) has posted a script on the odroid u3 forum that uses the commands described above to periodically set the fan speed based on CPU temperature: http://forum.odroid.com/viewtopic.php?f=83&t=6275

Update:
If you have the latest version of the kernel it gets even simpler. You can set the temperature above which the fan should be used to cool down the SoC:

echo 60 > /sys/bus/platform/devices/odroidu2-fan/start_temp

Categories: Uncategorized

How to easily switch the default Java version on Mac OSX

After installing Netbeans and Java7 for some JavaFX tinkering several of my other apps stopped working.

A lot of the solutions I found online involve writing scripts or changing startup scripts for specific programs, but I found none of them easy or maintainable enough. I ended up altering the symbolic link named “Current” in /System/Library/Frameworks/JavaVM.framework/Versions

A link called CurrentJDK in the same directory still pointed at a 1.6 version, so I simply changed the Current link to point to the CurrentJDK link. That way I can simply change it back when I want 1.7 to be the default.

sudo ln -s CurrentJDK/ Current

Categories: Uncategorized

How to install Glassfish 3.1 Clustering on multiple hosts using linux command line

September 25, 2012 Leave a comment

Today a colleague needed help with setting up a Glassfish cluster and I remembered having read a very good tutorial that created the entire cluster using only asadmin commands. In my experience using only asadmin commands not only gives you a greater understanding of the way Glassfish works internally but also enables you to create scripts for Glassfish administration commands.

Anyway, I managed to find the blogpost that I read about a year ago and decided that it was a good link to share with the world: http://www.randombugs.com/java/glassfish/installing-glassfish-31-cluster-debian-60-command-line.html

Categories: Glassfish, Java, Uncategorized

How to post nice looking source code on WordPress.com

If you want to post source code and want to make it easy for your audience to read it, use Syntax Highlighter. Blogs on WordPress.com can use this without having to install anything. See http://en.support.wordpress.com/code/posting-source-code for more information.