Over a million developers have joined DZone.

How to Exploit All Sensors of Your Mobile Phone as an IoT Device

How to use your Android phone, Apache Camel, Kibana, and ElasticSearch to use your mobile phone sensors as an IoT device.

· IoT Zone

Access the survey results 'State of Industrial Internet Application Development' to learn about latest challenges, trends and opportunities with Industrial IoT, brought to you in partnership with GE Digital.


This post will show you how you can exploit and send all data generated by the sensors of your mobile phone to the Internet of Things service by using Apache Camel, store the data with Elasticsearch and then how to visualize with Kibana.

Lastly, it shows you how to create and use a Rhiot Android application that exploit the following android sensors:

  • Accelerometer
  • Linear Acceleration sensor
  • Gravity sensor
  • Gyroscope
  • Light sensor
  • Orientation sensor
  • Other sensor ….

Here is an overview of the architecture:Image title

How Can We Implement This?

  • Step1: Install Camel Route on JBoss Fuse:Image title

As you can see from the camel route, after we retrieve messages from the HTTP endpoint, we will process it and store them into Elasticsearch, which will be picked up by Kibana and displayed in a Dashboard.

  • Step 2: At the Elasticsearch level, you have to create a new index, with the following mapping: https://github.com/abouchama/Rhiot_SensorDevice/blob/master/ELK/Mapping.json
  • Step 3: At this moment all the data is available in Elasticsearch, and we have just to explore, discover data, and visualize it via Kibana. For that, you have to create some visualizations that will be included in your Dashboards.
  • Step 4: Install and configure the Android app.

The Rhiot app is now installed on your Android device.

Note: The .apk file is compiled for Android version 5.0.1.

    • Start the Rhiot app.
    • Fill the URL and click on Start button.Image title

Below is an example of the Dashboard generated:

Image title

You can find the project code here:

 https://github.com/abouchama/Rhiot_SensorDevice/

Conclusion

Admittedly, this example is very simple and demonstrates how to turn your mobile phone into a sensor device, connect it to the Internet of Things server (Can be a Rhiot gateway), send data, and receive data. You also learned how to process and visualize device data with Apache Camel and Kibana.

I hope that you find this post useful and good luck with your projects!

The IoT Zone is brought to you in partnership with GE Digital.  Discover how IoT developers are using Predix to disrupt traditional industrial development models.

Topics:
iot ,mobile ,android ,sensors

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

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

{{ parent.tldr }}

{{ parent.urlSource.name }}