Monday, July 6, 2015

Internet of Things: Arduino, Android, ESB

How to connect Arduino board to Android smartphone using an Enterprise Service Bus (ESB) as middle layer

Topics covered

Arduino connection

ESB

Enterprise service bus Proxy

Internet of things (IoT) is one of the most emerging topic and one of the most discussed lately. What is Internet of things? When talking about IoT, we mean a set of smart objects that are connected together and can exchange information.
In this way, it is possible, for example, to create a sensor network and we get information from them using our smartphones. In this world, Arduino plays an important role, because it is a low cost system that can be used in several contexts.
In the previous post, we talked about a simple project that uses Arduino and Android to control a remote led. This post shows a different approach and the Android smartphone does not connect directly to the Arduino and its sensors but uses a component that decouples the Android client and the source of information (Arduino).

Internet of things architecture: Android, ESB, Arduino



IoT Architecture

Recently i came across an interesting article explaining the IoT architecture. This architecture is quite complex and general purpose, i want to simplify it using just some components.
This image show the simplified architecture:

iot reference architecture
Instead of connecting directly the Android smartphone to the Arduino, i used a component called ESB (Enterprise Service Bus). In this case, my preference is for WSO2 ESB because it is an full open source project and it fits perfectly in the IoT ecosystem. Moreover, WSO2 proposed the reference architecture.


Why we should use an ESB in IoT?

First of all, if you don't know the ESB feature i suggest you to give a look here. There are several reason why we should use an Enterprise Service Bus:
  • We can connect to several Arduino board and we want to have a single entry point that can route the request to the right board.
  • We might require some data transformation from Arduino data to other formats so that we can connect other devices than smart phone
  • We want to implement some authentication logic so that only authenticated client can access to the data
  • We want to implement some business logic before send back the data from Arduino to the client
  • We don't want to expose Arduino board directly on the internet
Using an ESB, we can move some logic from Arduino board to the ESB, leaving to the Arduino only the "electronic" tasks. For example, we could use Arduino to monitor the indoor temperature but we don't want to add authentication logic or some other controls.

The Project: Android and Arduino with ESB

As test project, we want to monitor a indoor temperature using a sensor connected to Arduino. In this first example, the Android smartphone connect to the ESB and requests the current temperature. The general IoT context is shown below:

internet of things architecture

In the picture, inside the ESB it is implemented a custom proxy. A proxy is a component that lives inside the ESB and hanldes incoming request from external resources.
Using a proxy, it is possibile to transform the incoming request send it to the destination and then read the response and transform it back.
In our case, the source that creates the request is the Android smartphone that sends the requests to the Proxy (ESB) and the destination is the Arduino board.

In the next post, we will start to analyze how to create all the components and how we can make them talking.
By now, if you want to set up WSO2 ESB you can go here and install the app.

In this post you get a basic knowloedge of the internet of things definition and how to start coding applications of internet of things.
The next post will show how to implement it.


Internet of Things: Arduino, Android, ESB Rating: 4.5 Diposkan Oleh: Unknown

0 comments:

Post a Comment