Android Based Edge Computing Gateway for WSO2 IoT Server : Overview
In my previous blog on Edge Computing for Data Driven IoT, I was focused on what is Edge Computing, why Edge Computing is Important and what are the main features that should be integrated to an Edge Computing Gateway.
As I have mentioned in the above mentioned article, I had the opportunity to develop an Android Based Edge Computing Gateway for WSO2 IoT server . As the Edge Computing Gateway is Android Based, it is focused on handling light weight IoT devices (for example, it can read values which are sent by sensors and controllers of household devices such as an AC and take decisions based on the input values).
When it comes to Edge Computing, it can be said that IoT Servers, Edge Computing Gateways and Edge Devices play equally important roles. Therefore, before moving into the functionalities of the Android Edge Computing Gateway, it is important to have an idea on the environment. The environment is basically made up of 3 parts — WSO2 IoT Server , the Android Edge Computing Gateway and Edge Devices.
WSO2 IOT Server is an extremely adaptive platform for device Integration and device management. It is made up by combining 3 major components.
- Message Broker — Broker supports different communication protocols such as MQTT, HTTP etc. and allows IoT devices to do their communication activities via those protocols.
For example, when Android Edge Computing gateway receives events which are sent by Edge Devices, those events are processed by the Edge Computing Gateway. Then it publishes the results of those processed event streams into different MQTT topics in the Message Broker so that the IoT server can receive those data. So the Message Broker allows the IoT Server to receive data which are sent by the Edge Computing Gateway using MQTT protocol.
2. IOT Core — IOT core is the platform which has the core capabilities of device integration such as device management,authentication, authorizations, security, device type management etc.
For example, in order to access the WSO2 IOT Server and it’s functionalities, an Edge Computing Gateway has to enroll into the IOT server by providing a valid username and password. Then only the Edge Computing gateway is able to communicate with the IoT server. Also the mechanism of adding Edge Devices to a particular Edge Computing Gateway can be controlled via the IoT server. (for example, IoT server can determine what Edge Devices should be allowed to communicate with a particular Edge Computing Gateway)
3. Analytics server — This is the component within WSO2 IoT server,which can be used for historical analytical and real time analytical purposes.This has the capabilities to receive data and events from connected devices in a secured manner, to process those data and to persist the necessary data for further analytics purposes.
For example, when an Edge Computing Gateway publishes data to MQTT topics in an IoT server, IoT server will receive those data and will be then sent to Analytics server as Input Event Streams. Then those data can be processed inside the Analytics server, and if needed can be persisted for further analytics purposes.
To have a better idea about WSO2 IOT Server you can study it’s architecture here. Additionally, you can refer WSO2 CEP documentation to understand how the analytics server works.
In the IoT server, each connected Edge Computing Gateway will have it’s own dashboard.

As you can see, we can enroll an device to the Edge Computing gateway, Send Commands to Edge Devices, Configure the Siddhi Stream Processor query which is run in the Edge Computing Gateway, Analyse data which is sent by Edge devices to the Edge Gateway etc. using this dashboard. Therefore, the IOT server can control all the Edge Computing Gateways connected to it and thereby the Edge Devices which are connected to an Edge Computing Gateway.
Android Edge Computing Gateway
In this project , an Android TV Box with Android API Level 23 is being used as the Edge Computing Gateway. The functionalities of the Edge Computing Gateway are carried out by an Android App which is run inside the Android TV box.
The High-Level Architecture diagram of Edge Computing Gateway is shown below.

The Edge Computing Gateway is empowered with WSO2 Siddhi which is an extremely fast and light weight Stream Processor which can also be embedded in Android as a Java Library.(You can find out how to embed Siddhi into Android here).
WSO2 Siddhi has given following capabilities to the Edge Computing Gateway,
- Dynamically detect input event streams from various Edge Devices.
- Process received event streams in real time.
- Publish the results dynamically to the IoT server.
- Alerts generation within the Edge Computing Gateway according to the inputs received from connected devices.
- Facilitate Data Caching mechanisms .

Edge Devices
One of the best thing about this Android Edge Computing Gateway is that it has been developed in a manner to support different edge devices which are communicating in different data formats. These data formats can be JSON, Comma Separated Values, Just the value, HTTP Get request, XML or any other text format. The way how the Edge Computing Gateway got this capability will be explained in a separate blog.
When testing this project an Edge Device Simulator with multiple sensors and switches were used to simulate the behavior of different edge devices.

In the device shown in the figure there are sensors to read surrounding Temperature and Humidity values. Also there are two switches to simulate the behavior of an AC and a Window. If Window switch is ON , it will be taken as Window is open and if the switch is off, it will be taken as Window is closed. Same applies to the AC switch. Also, there is an LED bulb to simulate a Light Bulb.
This Edge Device Simulator has a serial number. Communication between the Edge Device Simulator and the Edge Computing Gateway is happening via Zigbee protocol using xBee modules.
Setting Up
- Download WSO2 IoT Server .
- Install Edge Computing Gateway plugin inside the WSO2 IoT Server.
- Clone Samples-Iots repository.
- Copy androidtv directory to samples directory of the WSO2 IoT Server you downloaded.
- Copy androidtv-samples-deployer.xml file to samples directory of the WSO2 IoT Server.
- Install the plugin by running the command- mvn clean install -f androidtv-samples-deployer.xml file. (Run the command inside the samples directory)
3. Build and Install the Edge Computing Gateway android app (Use Android Studio 3) to the Edge Computing Gateway.
4. Enroll the Edge Computing Gateway to WSO2 IoT Server by Signing In.
Server End Point — https://ip adress of the IoT Server: 8243
In default case,
username — admin.
password — admin.

5. Make sure Edge Devices can communicate properly with the Edge Computing Gateway.
The way of enrolling Edge Devices to the Edge Computing Gateway, the protocols in which the Edge Devices communicate with the Edge Computing Gateway can be customized according to the type of Edge Devices and according to the requirement.
In this project, the communication between the Edge Devices Simulator and the Edge Computing Gateway is happening via Zigbee. In order to enroll an Edge Device to an Edge Computing Gateway, click add Xbee Edge Device and enter the Serial Number of relevant Edge Device.
Hope this article was helpful to understand the Edge Computing Environment , Setup and to get an overview on how things are connected together. In the next blog, I’m planning to write on features, considered requirements, design and architecture, implementation methodology of the Android Based Edge Computing gateway which was developed. That blog will also explain how WSO2 Siddhi plays the key role in this Edge Computing Gateway. Thanks for reading.