eHealth Personal Gateway – Eclipse Open IoT Challenge 2.0


It is almost two months since my start in Eclipse Open IoT Challenge 2.0. It’s a last moment to explain my proposal and start publishing progress of my work.

During last few weeks I’ve been busy with researching in the field of bio-medical signals – heart rate, pulse oximetry, body temperature end ECG.  I was exploring field of measuring and processing signals that are used to assess human health condition.

It is not my first encounter with body health monitoring. During my master thesis (long long time ago in my university days), I’ve designed and implemented software system for doctors that allows to manage ECG tests (store them offline, annotate, describe, visualize and export for consultation). Back then, majority of ecg equipment offered at most serial connectivity with raw acquisition data.

Currently, there are a lot of medical and personal devices that are widely available and allows to connect easily with personal computers or smartphones. Using your smartphone and additional equipment you can monitor you heart rate, weight, body temperature, blood pressure, glucose, electrocardiogram (ECG) end even images from inside your body using ultrasound. Mostly they are used with dedicated application running on smart phone using Bluetooth low energy. I can see huge potential in aggregating those data, analyzing it and exposing to medical professionals in order to improve access to health care, especially for elderly or babies in home environments. Additionally, current progress in signal processing and predictive analytic algorithms allows to detect, predict and alert when three is something wrong with human body condition.

Furthermore, bio-medical signals can assist during body workouts (fitness and wellness).

Instead of mobile phone I’m using IoT gateway running Eclipse Kura with Bluetooth low energy capabilities in order to gather bio-medical data from various sensors. With this competition I’ll use:

  • simple hear rate sensor with BLE connectivity – Biometric Sensor Puck from Silicon Labs
  • Fitness Bluetooth 4.0 Heart Rate Monitoring Belt
  • DIY prototype of 3 lead ECG with Bluetooth 4.0 – AD8232 based module from Sparkfun and PSoC 4 BLE  from Cypress


I’m in proves of creating prototype of medical IoT gateway that will:

  • acquire bio signal data using Bluetooth LE
  • analyze it locally
  • communicate to the user outcome of local analysis
  • send data to application in the cloud
  • allow medical professionals/fitness trainer to access those data and have possibility to describe it
  • as an option, I’d like to use predictive analytic techniques in order to analyze and classify gathered data using application in the cloud
  • take security of the solution seriously


Stay tuned, I’ll follow with post about Eclipse Kura and BLE.


Summary of Open IoT Challenge – Monitoring Industrial Automation Equipment

During last minutes of the Open IoT Challenge I’d like to summarize my work in this project.

An idea of remotely monitoring industrial equipment came form my experience with those systems. There are SCADA systems that tend to be complicated and expensive. Transmitting interested data to end user dashboard or “big data” intelligent system can involve several intermediate systems/databases. With open source IoT technologies it can be made simple.

I’ve managed to successfully establish communication between Eclipse Kura and Modbus device, poll registers periodically and use kura cloud service to send it to MQTT broker. Remote configuration is possible using Kura Configuration UI and remote LwM2M server. However, only simple configuration of UART and fixed set of Modbus Discrete Input and Holding Registers is possible to configure.

I’ve faced several major problems during my development. Most of the time took me to establish reliable communication channel between Eclipse Kura and Modbus Simulator device through RS485 line. Because I’ve used RS485 converters without automatic direction control, software arbitration was needed. Unfortunately current implementation of Modbus in Kura is not sufficient for providing decent handling of synchronization between sending data through UART and  controlling data direction over GPIO. I implemented dirty workaround inside Kura Modbus bundle.

Second fight I have had with the Leshan client functionality and it’s dependencies. It took me several hours to successfully connect from bundle to Leshan server. But it was worth it.

Summarizing :

I’ve managed to realize :

  1. Modbus slave simulator  – implemented using libmodbus library –
  2. Modbus Monitoring application with basic functionality – based on Eclipse Kura framework

However, I haven’t implemented local alarm and data visualization application and full feature remote configuration using LwM2M.

Nevertheless, I’m not going to stop this project and continue with joy of exploring IoT space.

Later this month I will publish source code. It needs a little bit of cleanup 😉

Stay tuned….

One Bundle Project – Modbus and Eclipse Kura

Default installation of Eclipse Kura 1.1.1 do not provision org.eclipse.kura.protocol.modbus bundle. Nevertheless, you can find it in source code (compile yourself) or grab it from .

All you need is to install modbus budle in Kura.

First you need to upload org.eclipse.kura.protocol.modbus-1.0.1.jar to your target device (RPi or BBB), connect with osgi console and install mentioned jar file:

telnet localhost 5002

osgi> install file:/{path to folder with jar file}/org.eclipse.kura.protocol.modbus-1.0.1.jar

Now, you can reference it from your bundle.

<?xml version="1.0"?>
<scr:component xmlns:scr="" name="io.github.tobidi.modbus.monitor.service.impl.ModbusMonitorServiceImpl" activate="activate">
  <implementation class="io.github.tobidi.modbus.monitor.service.impl.ModbusMonitorServiceImpl"/>
    <provide interface="io.github.tobidi.modbus.monitor.service.api.ModbusMonitorService"/>
  <reference name="connectionFactory" cardinality="1..1" interface="" bind="setConnectionFactory" unbind="unsetConnectionFactory"/>
  <reference name="modbusDeviceService" cardinality="1..1" interface="org.eclipse.kura.protocol.modbus.ModbusProtocolDeviceService" bind="setModbusDeviceService" unbind="unsetModbusDeviceService"/>

There is more about modbus on Kura Documenation.

One bundle project – Serial connection over RS-485 using Eclipse Kura

RS-485 standard (TIA/EIA-485) specifies a communication interface that uses differential signal lines to establish communication between devices. Majority of application consists of half-duplex transmission mode with a twisted pair copper wire as a physical medium. Each device turns its line driver only when transmitting. During remaining time the driver is kept turned off in order to allow other devices on network to operate by avoiding the data collision. It is the responsibility of the application-layer protocol to supervise data being exchanged.

In order to connect RS-485 to Raspberry Pi or BeagelBone Black we need to use appropriate HW converter. There are adapters that handle direction control automatically and ones that need external control. I’m using RS485 Board (3.3V version) from Wavesare.

Below is an example that that utilizes RS-485 Transceiver (like SP3485 or MAX3485). Converter that I’m using has RSE pin that control internal line drivers (it is connected to  DE and RE pins of SP3485). More information can be found in the datasheet.

Example code uses RSE line in order to turn on/off transmission driver. It is based on Eclipse Kura Serial Example and Device I/O example (from Kura Documentation and JavaDoc). I’m using Bndtools to develop OSGi bundles under Eclipse, that’s why the Bnd annotations are visible in the code.

Later, I will write post about how to use Bndtools to create bundles for Eclipse Kura.

Below is simple example that sets direction to transmit and sends some string to uart. You can implement reading using InputStream and direction pin.

package io.github.tobidi.obp.kura.comm.serialRS485;


import jdk.dio.DeviceConfig;
import jdk.dio.DeviceManager;
import jdk.dio.gpio.GPIOPin;
import jdk.dio.gpio.GPIOPinConfig;

import org.eclipse.kura.comm.CommConnection;
import org.eclipse.kura.comm.CommURI;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import aQute.bnd.annotation.component.Activate;
import aQute.bnd.annotation.component.Component;
import aQute.bnd.annotation.component.Reference;

public class SerialRS485Example {

	private static final Logger log = LoggerFactory

	ConnectionFactory connectionFactory;

	private CommConnection connOne;

	private InputStream isOne;

	private OutputStream osOne;

	public void setConnectionFactory(ConnectionFactory connectionFactory) {
		this.connectionFactory = connectionFactory;

	public void unsetConnectionFactory(ConnectionFactory connectionFactory) {
		this.connectionFactory = null;

	public void activate() {

		GPIOPinConfig pinConfig = new GPIOPinConfig(DeviceConfig.DEFAULT, 22,

		GPIOPin directionPin = null;

		try {
			directionPin = (GPIOPin),

		} catch (IOException e1) {
			log.error(e1.getMessage(), e1);

		if (connectionFactory != null) {

			try {
				String uri = new CommURI.Builder(&quot;/dev/ttyAMA0&quot;)

				connOne = (CommConnection) connectionFactory.createConnection(
						uri, 1, false);

				isOne = connOne.openInputStream();
				osOne = connOne.openOutputStream();

				byte[] array = &quot;ping\n\r&quot;.getBytes();


				isOne = null;
				osOne = null;

				connOne = null;


			} catch (Exception e) {
				log.error(e.getMessage(), e);
		} else {
			log.warn(&quot;No ConnectionFactory&quot;);



My first Blog post ever… Welcome

Welcome to my blog. My name is Tobiasz Dworak. I’m software engineer working currently as software architect.

I have strong background in Java, C and C++. Currently I’m mostly working with embedded systems, especially embedded middleware stuff.

The spark that triggered me to launch this blog was an Open IoT Challenge hosted by Eclipse Foundation, mainly the gift award for my project proposal. ( The Open IoT Challenge has officially started! )

Here I will document the progress on my IoT project.

Stay tuned.