Open IoT Challenge 2.0 – eHealth Personal Gateway – Summary

During second Eclipse Open IoT Challenge I’ve been working on personal eHealth gateway. It is a system for monitoring human health parameters and allowing medical personnel or fitness instructors to assess current and historical data. It consist of personal gateway device, web client and ancillary sensor devices.

There are a lot of bio-electrical sensors on the market. Many of them provide connectivity options through Bluetooth Low Energy profile. My project utilize small embedded computer that act as local home gateway. During development I was working on Raspberry Pi 2. It acquire data from BLE sensors and send it to the message broker. Backend application with web UI access broker server and present obtained data.

My system consist of four components:

  1. Sensor devices ( Silicon Labs Sensor Puck, Generis Heart Rate BLE Monitor, custom ECG 3 lead monitor with BLE using Cypress PSoC4 BLE 
  2. eHealth Personal Gateway software ( Eclipse Kura 1.4 running on Raspberry Pi )
  3. Eurotech Everyware Cloud ( trial version of commercial IoT device cloud offering )
  4. Web client application ( OSGi EnRoute based AngularJS web application and backend running on Red Hat OpenShift DIY cartridge )

I’m a big fan of OSGi and Eclipse based technologies, so my software stack decisions where rather biased ;). I’ve used Eclipse Kura on gateway and OSGi enRoute (project, framework, and tooling …) as a base for implementing needed functionality.

High level overview is shown on below diagram:

eHealth system overview

During analysis of available sensor devices, Linux Bluetooth stack and abilities of Kura framework I’ve discovered that one of my sensor devices, Silicon Labs Sensor Puck, transmits data in Bluetooth advertising packages. Unfortunately at that time, Kura wasn’t able to get those data. Meanwhile,  Lee Marshall submitted pull request which allows to listen for Bluetooth Beacons. They works similar – transmit data in advertisement packets (Bluetooth specification describes it as EXTENDED INQUIRY RESPONSE DATA FORMAT).

I’ve modified org.eclipse.Kura.Bluetooth.linux bundle in order to listen for advertising packets specific for SensorPuck device. I have a plan to contribute my code to Kura project. I’ve already presented it on mailing list. Hopefully it will be my first contribution.

The second device, generic heart rate monitor belt, caused serious problems. Although it provides appropriate profile (Heart Rate Profile) and it looked pretty simple to integrate, connecting to this device was impossible from Linux. Apparently, my heart rate belt during connecting to it issues connection parameters update request (as in Bluetooth specification). I faced serious problems to answer this request or force change of initial connection parameters. So, currently my system do not support generic HRM devices.

Application on local gateway (based on Kura) collects measured heart rate values and raw data from optical sensor (extracted  from advertisement packets) and if measurement was correct sends it to the Everyware cloud. Raw data are available locally through  Event Admin service for bundles interested in processing such data. Currently, those data are not used.

I use Everyware Cloud as message broker and for remote configuration. It is a commercial solution and helps a lot during development and operation. It provides REST API and java client library that allows to access data available on the broker.

Because I use OSGi for developing application on Kura, I also choose it for creating Web based application. I choose OSGi enRoute project. It allowed me to easily develop AngluarJS frontend application and REST backend system. All of it is deployed as one jar file and can be started as any Java application. I choose Red Hat Openshift cloud offering. You can seen screenshot of the working dashboard.

Using open source technologies like Eclipse Kura, Linux, enRoute and OSGi specs allows to easily create systems and in case something is not working, or there is no particular feature, you can do it yourself and extend.

I had a lot of fun working with bluetooth and Kura, especially parts where I needed to change its implementation.



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;);



Hardware setup – Eclipse IoT Challenge project

It’s been a while since my last post. I’d like to show hardware setup for my IoT Challenge project.

My application is organized in form of services running on Eclipse Kura (OSGi based framework). I’m running it on Raspberry Pi B+ (512 MB RAM) with additional LCD shield from AdaFruit (PiTFT) and RS-485 adapter from Waveshare (RS-485 Board). Standard RASPBIAN distribution from RASPBERRY PI FOUNDATION is used.

Although Java 7 is advised by Kura documentation, I’ve used latest Java 8. Up till now I don’t have any problems.

Development Setup

LCD screen is intended to show values acquired from monitored device and alarms triggered by application logic. Currently I’m using JavaFx for visualization layer.


RS-485 Adapter is connected with RPi UART0 interface and one additional GPIO. This adapter needs additional pin to control transmission direction. I’ve used GPIO17 as direction control pin.


For development I’m using additional Raspberry Pi (old B version with 256MB of RAM) that acts as Modbus slave. I’ve created simple Modbus simulation app using libmodbus library for testing purposes.

Connection diagram using RS-485 adapter – SP3485 / MAX3485 :


Outline of my proposal for Eclipse Open IoT Challenge – monitoring MODBUS

Logging and monitoring industrial automation equipment with remote management capabilities.

It’s a time to write quick overview about my application for Eclipse Open IoT Challenge.

As I’m working with industrial automation equipment recently I started to dig into it a bit more.

Industrial automation devices like PLCs, Inverters, Power meters, Flow meters, etc used as a field devices operate as a standalone equipment with ability to interchange information between each other on demand or on a periodic basis. Field devices need to be monitored and maintained, which is usually handled manually by technician. Existing installations with legacy protocols (e.g. DeviceNet, ControlNet) usually are hard or expensive to integrate with other systems. IoT technologies currently available may constitute a significant solution when facing such problems.
Use cases like monitoring process value, operation of equipment or even power consumption in summer house can be realized with open source IoT software accompanied with hardware on common HW platform like Raspberry Pi or Beaglebone.

Wide range of field devices support MODBUS communication interface that allows to configure or access log data stored in the device.

The purpose of my project is to design an universal network integration module which would allow to utilize IoT protocols to interface with MODBUS compatible devices.

Main goals to be achieved are:

  • monitor MODBUS registers or discrete inputs – defined by address
  • send updates to remote server – MQTT
  • be remotely managed – OMA LightweightM2M

Additionally, ability to present monitored values and alarms on local display (HMI) will broaden possible applications.

The plan is to realize application based on Eclipse Kura framework that will pool defined MODBUS registers/discrete inputs and based on defined rules take actions (store in internal memory, show as value/graph on local LCD or send using MQTT protocol). Thanks to OSGi, it will be easier to achieve modularity and extensibility of the application yet at the design stage.

User will be able to freely define MODBUS registers, poling interval, monitoring rules and actions remotely over OMA Lightweight M2M. Additionally, it will be possible to control local display remotely.

Logging and monitoring industrial automation equipment - overview diagram

Logging and monitoring industrial automation equipment – overview diagram

My project will be realized using Raspberry Pi connected with monitored device using UART port with RS-485 converter. Connection to the remote server will be realized using Ethernet port or through USB WiFi. Using of mobile modem is not planned right now.

I’d like to use Leshan project as device management server and it’s client libraries inside my allocation running on Kura.

For testing my application I’m going to create simple device that will act as MODBUS slave. I was going to use 4DIAC project for this. Unfortunately, there is no MODBUS slave in 4DIAC right now. That’s why for the beginning, I’m going to implement one using libmodbus library. Additionally, I’m going to test my solution with real industrial automation device.

In the next post I will describe detailed HW setup.

Stay tuned for further info….