2013/05/24

Geo-Fencing in M2M Applications

Many M2M applications monitor real-world objects and their location. In many cases, it's important to know when a unit enters or leaves a certain area. For instance:
  • sending alerts if cattle leaves farmland
  • checking if rental vehicles are only used within their designated areas
  • react when a transport unit approaches its target to prepare offloading
That's where geofences come in. These are virtually defined areas, and applications can monitor if mobile units (i.e., vehicles, cattle, etc...) enter or leave these areas. The geofence generates then events, which be used to trigger relevant behavior, like alarms or notifications.

With the Reactive Blocks SDK, you can now use our new library for geofencing in your applications. With this library, you can:
  • Define geofences as polygons of coordinates
  • Define geofences as a radius around a coordinate
  • Monitor if a unit enters or leaves the geofence
  • Monitor if an entire fleet of units enter or leave the geofence
You can also install an example system. Here is how it works:

The geofence is read in from a *.kml file that contains a polygon. You can create such files for instance with Google Earth. To make the demo self-contained, we simulate the positions of the units. For that, we use again a polygon from a *.kml file, and push out each coordinate from the polygon, one at a time. The blue polygon will be our geofence, spanning around the inner city of Trondheim. The red polygon is the route that is simulated:


In Reactive Blocks, the application looks as simple as this:


  • The route simulator block periodically sends the coordinates of the simulated route. In a real system, this would be for example live GPS data.
  • The route data is fed into the geofence, that was previously initiated with the data of the blue polygon from a *.kml file.
  • If our simulated unit crosses the geofence, we get different alerts, depending on entering or exiting the geofence. 
As an alert in the example, we use the Speech module, simply because its easy to setup. That's of course only an example. Once you have the geofence events, there are no limits of what you can do:
To try this example, sign up for the Reactive Blocks SDK and join the team for the Geofence Example. In this way you will get access to all needed resources.

2013/05/07

Testing Reactive Block Libraries with JUnit


The Reactive Blocks SDK now includes a code generator for JUnit.

junit testingThis means you can create tests for your building blocks. These tests are translated automatically into JUnit test suites, and can then be executed directly in Eclipse. This lets you implement and run also many tests at once, to systematically check if your building blocks have the quality you like them to have.


Testing building blocks is complementary to the automatic analysis and the animation provided by the SDK:
  • With the analysis, a building block is checked for internal consistency, that means, if it contains deadlocks, conforms with its interface contract, and if it uses other building blocks correctly. 
  • With the animation, you can check if the internal actions execute the way you expect. 
  • With testing, you can check if your blocks are usable the way you want, and if they perform their actions on data correctly. 
Together, the automatic analysis, animation and testing are the full package to make robust, valid and good libraries. Have a look at the tutorial for all the details.

We love the new step towards continuous testing. (It was about time.)

2013/03/18

Home Automation I: Tellstick and Nexa

Ever wanted to build your own home automation system? We tried, and it works. The main ingredients are the following:

  1. Tellstick and Nexa as hardware, to control real-world objects.
  2. MQTT as protocol.
  3. The Reactive Blocks SDK to build the application.

The first result is a simple solution with not that much practical application, but it illustrates what is possible. What did we do? We purchased a Tellstick USB-stick radio frequency transmitter that we connected to a computer and a Nexa self-learning dimmer from our local hardware store and used Reactive Blocks SDK to develop a simple solution to control the dimming of a simple light-bulb.

(The Tellstick USB-stick, picture is a courtesy of Telldus Technologies AB)

The light-bulb setup looked like this:
Yes, I know, it is soon-to-be-obsolete lighting technology, but it sorely needed to be used one last time.
Anyway, these two devices speak with each other and by sending dimming commands to the dimmer through the Tellstick, we are able to set the light intensity to whatever we want (up to the maximum as defined by the bulb itself) at any time we want.



To automate the dimming, we needed some continuously running logic producing some kind of signal that we could translate to a dimmer setting for the bulb. To make it simple, we copied the GridBoard example from the MQTT article and modified it to generate a dimming signal where the intensity is a function of the distance between two avatars on the board (the above picture is the solution in the Reactive Blocks SDK). You can find the example project for our first home automation attempt here.

To be able to use the Tellstick from Reactive Blocks SDK, we made a block library for it that you can find here.

We will continue to experiment and build our knowledge on home automation and available devices, so  stay tuned.

2013/03/14

MQTT example



At Bitreactive we are working on many interesting in-house projects and through one of them we had the chance to use the MQTT lightweight publish/subscribe protocol for efficient and flexible cross-machine messaging.

MQTT (MQ Telemetry Transport) is a messaging protocol developed to handle routing of short messages in systems where conserving resources (bandwidth, memory, processing power, etc) is vital, such as in machine-to-machine communication.

To use MQTT you need access to an MQTT server and preferably a client-side API to simplify using the protocol. There are many open-source implementations of MQTT servers and client-side APIs around. We used the paho.mqtt.java client-side Java API and a public MQTT server hosted at (test.mosquitto.org).

The project we started using MQTT on was a demonstration project where we built a server application with a GUI grid, where each cell in the grid could be addressed and a client avatar created and moved around in addition to setting an RGB color code on the cell where the avatar was currently occupying. Simple, yes, but also quite fun to watch when more than one developer concurrently started implementing their own logic on how to move around and change cell colors.

To keep the client application developer isolated from the communication protocol and at the same time build this framework quickly and with high quality, we wrapped the client-side control interface in a reactive block and made this library available to each developer. With the addition of a simple GUI-based joystick block (simple up, down, left, right and action buttons), the developers could combine manual input and automated control in any way they wanted to move their avatars around and change cell colors. In the end it looked like a multiplayer version of the classic game Snake where each avatar tried to outdo the others on setting their preferred colors on as many cells as possible. This, of course exposed the real-time limits of the external MQTT-server we used which was interesting to observe. All in all, lots of fun and educational at the same time.

The server, the client interface and the client applications where all developed in Reactive Blocks SDK.

If you want to learn more about MQTT you can find an article here that will help you.

The example project webpage is found here.

2013/01/19

New location

We have moved to new office location in Trondheim, Norway. New visiting and post address: Professor Brochs gate 2, 7030 Trondheim Norway. Welcome!

2012/12/18

Embedded world

Meet us at Embedded World in Nuremberg, Germany 26.- 28.2.2013. We will be present with a stand in hall 5, booth 140. Drop by our booth or contact us in advance to get an insight into how you can develop and maintain reactive systems smarter.

2012/06/01

Positions available

(Yes, we are hiring)


Right now we are seeking the right candidates for bringing the company to the next level.

A unique possibility and great challenge for the right candidate: Become a part of a new software engineering adventure in Trondheim.

We seek outgoing candidates who can contribute with their expertise to help our customers to develop software smarter. New employees will have great possibilities for taking key positions within a growing company. We are now seeking a total of 5 people for various roles in the company.