Connect the K8055 Hardware Device with Kettle
You can do a lot of stuff with Kettle: ETL, EAI and much more and you can even connect Kettle to hardware devices to measure or control external things.
For example reading of RFID tags are possible and already in production: Intelligent InSites Integrates Pentaho to Help Hospitals Improve Efficiencies with RFID tags
Here is a prove-of-concept described, to control a model train by Kettle via USB and a hardware controller (K8055).
The K8055 board has 5 digital inputs, 8 digital outputs, 2 analog inputs and 2 analog outputs. It is available as a construction kit or already assembled.
Short history
This project was started back in December 2010 to control a model train just for fun. The working prove-of-concept can be found on my blog soon and it was first demonstrated at the Pentaho community event September 2011 in Frascati (see also the video).
The real challenge was to find a suitable Java driver since the original K8055 SDK delivers only Windows DLLs. There are a couple of projects that I tested, so here is a part of my journey:
- TWUsb2.4 – It worked well, but it was in my opinion too overloaded with functionality that is not needed by this project, has only German documentation and is only for Windows via DLLs.
- J-K8055-Wrapper – This one has only German doc and is also only for Windows via DLLs. Since this was almost what I looked for since it covers just what it needs, I planned to work on this project and improve and translate the doc. But I stopped this idea, because after more investigation a couple of months later, I finally found this:
- K8055-x64-java – this works via the native Java USB (libUSB) and for the non Windows platforms,you can use the Library K8055 for Linux
How to
Windows 64 bit only (I didn't tried this with Windows 32 bit nor Linux, so I don't know if it works with these platforms, but for Linux Library k8055 for Linux is available and supposed to work):
- It is always good to test your K8055 with the supplied software by the board vendor (K8055 Demo)
- Download libUSB (even when it states win32, it has also installers for 64 bit in the archive, I tested version 1.2.5.0)
- Download k8055-x64-java (tested with version 1.0)
- Read the Install instructions of libUSB, especially "Device Driver Installation" (The installation of the filter driver is not necessary any more!)
- Attention: At the time when you plug-in the USB port, please remember the USB port location. It does not work in different USB slots afterwards and the Java application (Kettle) will crash on different USB ports!
- Attached is a sample USB_K8055.inf file, but you should create it by the INF-Wizard program as described in the install instructions.
- Unzip the k8055-x64-java
- Check the README.txt
- Copy the k8055.jar to data-integration\libext
- Copy the K8055-x64-java-1.0\dll\x64\k8055JavaCall.dll and k8055.dll to data-integration\libswt\win64 and \Windows\System32
- Start Spoon
- Connect your K8055 board to the correct USB port
- Execute the attached k8055_first_test.ktr and all digital outputs should be switched on
Background
It was implemented with the User Defined Java Class. It needs the following code snippets (the full code is in k8055_first_test.ktr)
import k8055.K8055JavaCall; [...] if (first) { first = false; K8055JavaCall k8055 = new K8055JavaCall(); k8055.OpenDevice(0L); k8055.SetAllDigital(); k8055.CloseDevice(); }
A more advanced sample can be found on my blog soon.
I look forward to your experiences.