Over a million developers have joined DZone.

Arduino, Android, ESB

DZone's Guide to

Arduino, Android, ESB

· IoT Zone ·
Free Resource

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:

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:

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.

arduino ,arduino uno ,esb ,iot ,android

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}