Android Core

Internet of Things: Arduino, Android, ESB

Internet of things (IoT) is one of the most emerging topic and one of the most discussed lately. 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 set of sensors and we can use it through our smartphones. In this world, Arduino plays an important role, because it is a low cost system that can be used in several contexts and it connects to the internet.

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

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:

iot1
Instead of connecting directly the Android smartphone to the Arduino, i used a component calledESB (Enterprise Service Bus) . In this case, my preference is forWSO2 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:

proxy1

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.

Reference: Internet of Things: Arduino, Android, ESB from our JCG partner Francesco Azzola at the Surviving w/ Android blog.

Francesco Azzola

He's a senior software engineer with more than 15 yrs old experience in JEE architecture. He's SCEA certified (Sun Certified Enterprise Architect), SCWCD, SCJP. He is an android enthusiast and he has worked for long time in the mobile development field.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
Back to top button